• Per the style sheet comments in WordPress 1.5.2, I am trying to center an image doing this:

    <img src=”c:\fordescort.jpg” class=”centered” alt=”The Babe Magnet” />

    And it doesn’t work. I have read many articles on here with many different methods mentioned. None have worked for me. Please help.

    Thank you,

    Greg

Viewing 11 replies - 16 through 26 (of 26 total)
  • Thread Starter gshultz

    (@gshultz)

    Here is what finally worked:

    <div class=”center”>March 4, 1995 to October 28, 2005
    <img src=”/wp-content/FordEscort.jpg” width=”320″ height=”214″ alt=”The Babe Magnet” /><span>

    </span></div>

    I now only wish I understood why it works, and in between all the reading I have to do for my living I hope I can find the time to fully read the WP docs, and soon. In the meantime, thank you guys very much! Beers are on me!

    Greg

    Thread Starter gshultz

    (@gshultz)

    All right, all right, I spelled it SAYONARA!!! I think I got this thing whipped now! ??

    Greg

    Well, good for you! Glad it worked…. why is a whole dissertation in css.

    I may never get back to Orlando, but I’m tipping my glass of red to you. Have fun! Oh, btw, you can delete those span tags….

    [Beel, last time I tried a div in one of my posts, it didn’t validate. That’s why I said what I did….] [[though hmmm…. may not have tried the blank line trick – have to check that one out….]]

    Not if you are a stickler for valid code as I am. I use divs in my posts all the time without problems with p tag wrapping. I don’t know what you have in your post, but I would remove the empty span tags and any p tags and put the div with a blank line before and after it to see if WP will wrap properly.

    Edit: You beat me, but yea, I have divs in every post with an image in it and don’t have a problem. I suppose it could also be a plugin issue.

    Thread Starter gshultz

    (@gshultz)

    OK, I removed the span tags. For the record, then, this is the code that finally worked for me:

    <div class=”center”>March 4, 1995 to October 28, 2005
    <img src=”/wp-content/FordEscort.jpg” width=”320″ height=”214″ alt=”The Babe Magnet” /></div>

    Gracias, mi amigos!

    Greg

    No empty span tags, Beel…. I just manage with styling the p tags. Of course I mostly don’t post graphics I want centered either…. I tend to think it’s the blank line trick…. thanks!

    Good… and valid, too!

    Edit: and the empty span tags wasn’t directed at you – I keep getting a new post between me and the one I am responding to – like yours just now!

    Thread Starter gshultz

    (@gshultz)

    I actually used to be a programmer for a living, but that was over ten years ago. I quit that and went on easy street for a while doing network admin stuff. Now that the glory MCSE days are over I find myself editing “CSS style sheets.” Here I go again… ??

    Thread Starter gshultz

    (@gshultz)

    Yes, it would be nice if the forum software were threaded within the different subjects. But I guess we are in the early days of this blogging stuff, right?

    This forum software is outside the blog setup entirely. It’s another project…. I don’t think threading is likely, though I have a preference for threaded discussions myself.

    [Yeah, Beel, sorry! I figured that out after I’d already posted again…. my phone lines are giving me fits tonight as well, so that’s part of the problem as far as posting without “crossing” too….]

    Thread Starter gshultz

    (@gshultz)

    Hey Guys,

    While I am pleased with the results of getting that picture centered, I clicked on the XHTML validation link and it discovered five “errors.” The site didn’t like my kludgy home navigation button and it also seemed to have a problem with the /div related stuff. I’m trying to learn here, so any help would be appreciated. Is this validation site to be trusted?

    Also, I wanted recommendations for a good book to begin learning XHTML or anything else that would make me more proficient with WordPress. As I said before I have a programming background, but it’s been a long while since I coded anything outside of simple Visual.Net applications when I finished my MIS degree last year.

    Any suggestions are welcomed.

    Many Thanks,

    Greg

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘How To Center Image’ is closed to new replies.