Help CSS Expert Needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Waters
    Confirmed User
    • Mar 2003
    • 4402

    #1

    Help CSS Expert Needed

    I am using CSS instead of tables. So much easier, but I thing I haven't figured out how to do.

    I want to have a page of thumbs, which is easy, but I want to attach a caption below the image.

    Then have the next image appear to the right of the first image, and so on.

    Best I can think of is two div blocks and use a z overlay, but I hope there is something more eloquent.

    Thanks!


    Paul
  • Coyote
    Drinker of Scotch
    • May 2003
    • 242

    #2
    Howdy Paul,

    I'm no expert, but I used this method a few years ago. Obviously you'll need to modify it to fit your requirements, but it is a good starting point.

    To ensure I understand your question, I'll break the problem down by steps.

    You want the caption beneath the image, like so,

    Code:
    Image
    Caption
    Next, you want the resulting image/caption repeated horizontally, like so,

    Code:
    Image       Image
    Caption     Caption     ...and so on.
    Lastly, you want the image/caption pairs to wrap within a specified container, like so,

    Code:
    Image      Image
    Caption    Caption
    
    Image
    Caption   ...and so on.

    To associate centered captions beneath images, you can use this method in your css file...

    Code:
    div.float { float: left; }
    div.float p { text-align: center; }
    ...and your html might be...

    Code:
    <div class="float">
    <img tag><br />
    <p>caption</p>
    </div>
    This method will wrap any number of image/caption pairs within the browser window.

    You can also place the image/caption pairs within a container for positioning...

    ...add to css file...

    Code:
    div.container { margin: 6pt 6pt 6pt 6pt; }
    Note that because the container itself will not occupy render space, you have to trick-boink it by adding a style for the actual renderable content, like so,

    Code:
    div.boink { clear: both; }

    The resulting html might look like this...

    Code:
    <div class="container">
    
    <div class="boink"> </div>
    
    <div class="float">
    <img tag><br />
    <p>caption</p>
    </div>
    ...repeat image/caption pairs.
    
    <div class="boink">&ampnbsp;</div>
    
    </div>

    Hope this helps.

    ps. sorry for havin' to trick-boink the post to get the info to display correctly.
    Ethernet Servers

    Quote:
    CS: Linux can pretty much run on a potato. Which is a GOOD thing.

    Comment

    • Paul Waters
      Confirmed User
      • Mar 2003
      • 4402

      #3
      Originally posted by Coyote I'm no expert, ....


      To associate centered captions beneath images, you can use this method in your css file...

      Code:
      div.float { float: left; }
      div.float p { text-align: center; }
      Expert or not, that is exactly what I needed! Thank you. If you ever get to Toronto, you have an open invite for a few pints!

      What I hadn't tried, and don't understand why it works is the lines that are:

      div.float using "div" literally, not the identifier in the div section in the html code.

      That is a concept I don;t understand. Is there a simple explanation?

      Again, many thanks!


      Paul

      Comment

      • Coyote
        Drinker of Scotch
        • May 2003
        • 242

        #4
        You're welcome. I appreciate the pints too

        By definition, div.float selects any div element with a class attribute that contains the word float. It is just a means to identify multiple div tags to which you may want the sytle applied.
        Ethernet Servers

        Quote:
        CS: Linux can pretty much run on a potato. Which is a GOOD thing.

        Comment

        • Coyote
          Drinker of Scotch
          • May 2003
          • 242

          #5
          Howdy again,

          I just tried e-mailing you to the address on your site. It errors with User Unknown.

          Can you please contact me, coyote at undeadclan dot com.

          Thanks.
          Ethernet Servers

          Quote:
          CS: Linux can pretty much run on a potato. Which is a GOOD thing.

          Comment

          Working...