Forums

[resolved] Styling attachment id with css or preg_replace? (3 posts)

  1. teolives
    Member
    Posted 11 months ago #

    Dear all,

    I'm building a photo website that scrolls horizontally where WP post will be image galleries.
    I'd like my images to have captions but I can't find a way to style with CSS the <div id="attachment_[number]...> I'm getting from the_content() (now it forces a line break... quite annoying for a site that'd like to scroll horizontally...).

    The_content()'s output is as follows:

    <div class="entry">
        <div id="attachment_123" class="wp-caption aligncenter">
            <a href="...">
               <img src="..."/>
            </a>
            <p class="wp-caption-text">Caption 1</p>
        </div>
        <div id="attachment_456" class="wp-caption aligncenter">
            <a href="...">
               <img src="..."/>
            </a>
            <p class="wp-caption-text">Caption 2</p>
        </div>
    </div>

    Is there a simple way to style those attachment_[number] id with a changing [number] or do I have to modify the output of the_content() with a preg_replace? How then?

    Regards,

    Matteo

  2. alchymyth
    The Sweeper
    Posted 11 months ago #

    have you tried to style .wp-caption, which is the css class in the same div?

  3. teolives
    Member
    Posted 11 months ago #

    CSS 101 :-) so easy... thank you!

Reply

You must log in to post.

About this Topic