dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Clear both and position relative

  1. #1
    Join Date
    Sep 2005
    Posts
    1,636

    Clear both and position relative

    I like to test clear both and effects.

    div1(Floated Left)
    ------------------
    <div style="clear: both;"><!--This <div> as a separator--></div>
    ----------------------------------
    Other div renders here now

    This will bring second DIV into bottom position under DIV1.

    What will happen if all this DIV's are inside one DIV with relative position.
    border: 0 none;
    position: relative;
    top: 0;

    Can all float elements influence main div position which should have CLEAR BOTH?
    #div2 {
    clear: both;
    margin: 0;
    overflow: hidden;
    }
    or it is correct to place position: absolute; and not clear: both; to place DIV element regardless of other DIV's?

    Sample:

    <DIV><!--This <div> acts as a relative position-->

    div1(Floated Left)
    div3(Floated Right)
    ------------------
    <div style="clear: both;"><!--This <div2> acts as a separator--></div>

    </DIV>
    ----------------------------------
    Other div renders here now
    Last edited by toplisek; 03-01-2013 at 07:39 AM.

  2. #2
    Join Date
    Mar 2012
    Posts
    1,819
    I do not find relative positioning is useful at all. I'd suggest either the default (static) or absolute positioning are the most useful.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles