WordPress.org

Ready to get started?Download WordPress

Forums

Have I finally figured out how to caption images? (3 posts)

  1. Asecondforever
    Member
    Posted 8 years ago #

    Beginner here. I spent a good deal of time trying to get captions positioned under images on my test blog. I'm using the Fasttrack theme. I think I've got it now, but wonder if I'm truly doing it correctly.

    I opted to follow the advice in the Codex:

    http://codex.wordpress.org/Wrapping_Text_Around_Images#Captioning_The_Image

    I had inserted into my style.css all the code on that page, used the recommended HTML in a post, and everything worked well enough except for captions which were appearing within the blue box surrounding the photo (just testing with the example color from the Codex which appears as blue on my site) just to the right of the lower right hand corner of the photo.

    After much searching I found some advice on another forum which used roughly the same approach to creating captions. There were a few small differences in the strings of code they recommended, but with some tinkering I found the only bit I really needed to add was:

    "style="width: 250px""

    just after

    "div class="caption left"" at the beginning of the HTML when posting.

    So is the reference to "width" indeed necessary?

    In my test blog the first photo shows where I seem to have it right. The photos below it show the result using only the code from the Codex (without the "style="width: 250px""):

    http://www.smalltownproject.org/wptest/wordpress/

    My question: Is there really a piece missing from the advice in the Codex, or am I overlooking something? If it was not an error or oversight on my part (something in my style.css interacting with the Codex-recommended code?) is this something that needs revision in the Codex?

    I did see a different approach recommended here:

    http://tinyurl.com/e4ylz

    But it seems to be wholey different, while the method above allowed me simply to add to the codex advice.

    Thanks in advance for any thoughts or opinions!

    (If it would be clearer, I can post examples of the HTML for inserting a cation in a post using just the Codex advice versus with the extra string added. Just ask.)

  2. Lorelle
    Member
    Posted 8 years ago #

    There are many ways to do this. If you put a width restriction in your CSS, then put an image narrower or wider, you have problems. For examples of different ways of captioning and framing your photographs, you might look here.

    There is a lot to consider when trying to caption images, including the space around the images, the size of the fonts, the padding around the image, within the container - it gets complicated. But stick to the simplest look you can and it will be fine.

  3. Asecondforever
    Member
    Posted 8 years ago #

    Thanks Lorelle. I may not have put it clearly, but it's in the html that I put in a post that I find I have to include the reference to width (style="width: ###px"). I just wondered if the codex instructions alone work for others, if I need this extra bit in a post because of something (presumably) in the Fastrack style.css that necessitates it. In any event it works! :)

Topic Closed

This topic has been closed to new replies.

About this Topic