SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Tizer's Avatar
    Join Date
    May 2002
    Location
    Beach
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make div obey floated div

    OK - in this example I want the orange div#highlight to obey the width & margins of the right floated div#right_col.

    The amount of images in #right_col will varying in height for each page. The position of #highlight within the content will also vary.

    What I would like is for div#highlight to be width 100% when not next to div#right_col, and if it is next to div#right_col, to obey the margins and width of div#right_col.

    So as it is at the moment, the div would not be 100% width in the ideal situation.

    Is this possible?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,592
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Just add overflow: hidden to the highlight div, like so:

    Code:
    #highlight {
      background-color: #FFCC66;
      border: 1px solid red;
      color: red;
      overflow: hidden;
      padding: 10px;
    }

  3. #3
    SitePoint Addict Tizer's Avatar
    Join Date
    May 2002
    Location
    Beach
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    too easy

    Thank you - I have been wondering about that for a while now


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •