SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should i ad a container div to wrap around columns?

    Greetings from Wetherby UK :-)

    On this page http://tutorial.davidclick.com/curvy.html & illustrated her http://i216.photobucket.com/albums/c...pscd939adb.jpg I'd like to know why i should ad a div container to wrap around the columns. Some tutorials recommend it but why do i need to do it?

    Thanks in advance,
    David
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,363
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    There is no real need to add an extra wrapper around those two columns unless you are starting another series of floats and need then all to start afterwards without snagging and even so you could wrap the new element in the (cleared) wrapper anyway.

    As long as you have set the following non floated element to clear:both then you should be good to go.

    However, one benefit of wrapping floating columns is that you can contain them within that parent (overflow:hidden or some other mechanism) and then the top margins on elements that follow would work. Top margins on a non floated element that follows a float will not work as the margin slides under the float.

    It all depends on context as there is no hard and fast rule but sometimes its nice to group elements so that you have a point of reference for the content within.

  3. #3
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Paul :-)
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com


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
  •