• I place a picture and beneath the picture some text in the center, when I publish the post, you sea the text around my picture, the text is not centered anymore, it wraps around my picture, what can I do?

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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>

    Great, I’ll have to ‘unlearn’ html I guess! Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    My first reaction was indeed that Macsoft’s idea may make too many divs in a file, but it does work. Thanks for the extra info Otto, I’ll give it a go.

    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…….

    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 ;.

    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘can’t center my text in post’ is closed to new replies.