WordPress.org

Ready to get started?Download WordPress

Forums

can't center my text in post (11 posts)

  1. onlyliesbeth
    Member
    Posted 6 years ago #

    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?

  2. Roy
    Member
    Posted 6 years ago #

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

  3. macsoft3
    Member
    Posted 6 years ago #

    Trying using div tag like

    <div align="center">Hello</div>

  4. Roy
    Member
    Posted 6 years ago #

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

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  6. Roy
    Member
    Posted 6 years ago #

    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.

  7. Roy
    Member
    Posted 6 years ago #

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

  8. Roy
    Member
    Posted 6 years ago #

    I've got it, I've got it, it's <p style="text-align: center"> (with a space between : and center and no ; ).

  9. Jeremy Clark
    Moderator
    Posted 6 years ago #

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

  10. Roy
    Member
    Posted 6 years ago #

    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.

  11. ditzy
    Member
    Posted 5 years ago #

    Re:

    <p style="text-align: center; background-color: #fff;">

    from jeremyclark13, Moderator

    Just wanted to say THANKS, this worked for me.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags