Roy
(@gangleri)
I have a similar thing. In a post I try to do make-up with html. For example, I review a translation of a book and I like to open with the original title, small and centered. My post opens thus: <p align="center"><font size="1">Original title</font>
. My theme (Fluid Blue) has no problems with<font>
, but completely disregards the<p>
. On validation of my site, all these<p>
‘s even come up as errors. Is there something else I can use to center a piece of text, or an image like Liesbeth asks? (<img... align="right">
does work, but makes a ‘wrap’ that Liesbeth doesn’t want.)
Trying using div tag like
<div align="center">Hello</div>
Roy
(@gangleri)
Great, I’ll have to ‘unlearn’ html I guess! Thanks.
Actually, align=center is deprecated. Use the text-align style instead.
<p style="text-align:center;">Centered text or whatever</p>
You can style anything as centered like this, including paragraphs, divs, whatever.
Roy
(@gangleri)
My first reaction was indeed that Macsoft’s idea may make too many div
s in a file, but it does work. Thanks for the extra info Otto, I’ll give it a go.
Roy
(@gangleri)
Argh, this doesn’t work at all. When I use Otto’s code, WP deletes it. When I use the visual editor, WP makes a <p align="center">
which doesn’t work. I AM talking about a group of images now. One image seems to work, text too, but a group of images not…….
Roy
(@gangleri)
I’ve got it, I’ve got it, it’s <p style="text-align: center">
(with a space between : and center and no ; ).
Yes technically you can leave off the last ; with no problems but if you have more than one style then you need to have the ; between the differnet styles.
Such as
<p style="text-align: center; background-color: #fff;">
But as good web design practices go it’s always best to close all styles with a ;.
Roy
(@gangleri)
Okidoki! Then I guess it was the lack of a space that mae WP dislike the code (it kept being changed back to <p>
). I found the correct code when I activated the visual editor and found one image that remained centered.
Re:
<p style="text-align: center; background-color: #fff;">
from jeremyclark13, Moderator
Just wanted to say THANKS, this worked for me.