Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post

    Internet Explorer clear: both; & <br clear="all" /> - Strange Behavior

    Hi Experts,

    I am facing a very strange problem. I aligned H1 tag & a div using floats. Then I used to put my clear div below H1 & div (like this... <div class="clear"></div> ). It doesn't look fine in all browsers. Then 1 of my friends suggested me to use "<br clear="all" />" instead of that CLEAR div. I used this method & it worked but in IE 6 & 7 the text touches the bottom now. I again pasted my CLEAR div along with the BR & now everything looks fine in all browsers.

    I just wanna know that what is the problem with my CLEAR div & why I need to use both methods same time? I read somewhere that BR method is not valid in STRICT xHTML.

    Please see my attached code also to have a clear idea of what the problem is.

    Looking forward for your help & guidance...

    Regards,
    Uzair
    Attached Files Attached Files

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Then 1 of my friends suggested me to use "<br clear="all" />" instead of that CLEAR div.
    Not really. A <br> tag always produce an unwanted line break when used to clear the floats. Also , the clear attribute is a depreciated one.

    www.positioniseverything.net/easyclearing.html will help you to learn the common practices in clearing a float.
    btw, Can we have a link to your page? (little lazy to download and test your code.)

    PS:
    I need to use both methods same time? I read somewhere that BR method is not valid in STRICT xHTML.
    br can be used in xhtml too, but we need to use it like <br/>
    Last edited by abduraooft; 11-18-2008 at 01:10 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post
    I haven't yet uploaded it anywhere. Please download it & see
    I wanna use the CLEAR div instead of the BR. But currently I am forced to use both.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I've looked your code, and I think you've a little confused about the use of clearing. I don't see any point in applying a clear in
    Code:
    <div class="grayBar">
                    	<h1>Main Heading here</h1>
                        <div>2 items in <a href="#">your cart</a></div>
                        <br clear="all" />
                        <div class="clear"></div>
                	</div>
    I'd recommend you to have a look at http://www.codingforums.com/showthre...640#post617640 to get a clear idea.

    PS: Are you trying to stick your footer at the bottom?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post
    Thanks for your reply. You are right, I am confused but my confusion is for the <br clear="all" /> thing.

    Well, I usually only use <div class="clear"></div> under the floating divs. But in this case, I also applied <br clear="all" /> to organize my GRAYBAR. I just wanna know why I need a <br clear="all" /> here. Don't you think that only the <div class="clear"></div> should work fine?

    This is the only confusion I am facing. Please guide me...

    Thanks


  •  

    Posting Permissions

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