![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, Conside simple HTML/CSS code... style type="text/css" .left{ display:inline; float:left } .right { display:inline; float:right; } .clear { clear:both; } /style div class="left"> left </div div class="right"> right </div after two floated DIV, which of the following one is correct? 1. <div class="clear"></div 2. <div class="clear"> </div 3. <div class="clear"><!-- --></div 4. <br class="clear" / I see different sites are using different way, any suggestions? Thanks. |
#3
| |||
| |||
|
|
Hello, Conside simple HTML/CSS code... style type="text/css" .left{ display:inline; float:left } .right { display:inline; float:right; } .clear { clear:both; } /style div class="left"> left </div div class="right"> right </div after two floated DIV, which of the following one is correct? 1. <div class="clear"></div |
|
2. <div class="clear"> </div 3. <div class="clear"><!-- --></div 4. <br class="clear" / |
|
I see different sites are using different way, any suggestions? |
#4
| |||
| |||
|
|
after two floated DIV, which of the following one is correct? 1. <div class="clear"></div 2. <div class="clear"> </div 3. <div class="clear"><!-- --></div 4. <br class="clear" / |
#5
| |||
| |||
|
|
On 2009-09-08, Ryan Chan <ryanchan404 (AT) gmail (DOT) com> wrote: 3. <div class="clear"><!-- --></div There should be no reason for the or <!-- --> nonsense but I expect it's because of some IE bug. I'd be surprised if even IE saw <div class="clear"><!-- --></div> as |
#6
| |||
| |||
|
|
Hello, Conside simple HTML/CSS code... style type="text/css" .left{ * * display:inline; * * float:left } .right { * * display:inline; * * float:right; } .clear { * * clear:both; } /style div class="left"> left </div div class="right"> right </div after two floated DIV, which of the following one is correct? 1. <div class="clear"></div 2. <div class="clear"> </div 3. <div class="clear"><!-- --></div 4. <br class="clear" / I see different sites are using different way, any suggestions? |
#7
| |||
| |||
|
|
Hello, Conside simple HTML/CSS code... style type="text/css" .left{ * * display:inline; * * float:left } .right { * * display:inline; * * float:right; } .clear { * * clear:both; } /style div class="left"> left </div div class="right"> right </div after two floated DIV, which of the following one is correct? 1. <div class="clear"></div 2. <div class="clear"> </div 3. <div class="clear"><!-- --></div 4. <br class="clear" / |
#8
| |||
| |||
|
|
I'd be surprised if even IE saw <div class="clear"><!-- --></div> as different to <div class="clear"></div>. |
#9
| |||
| |||
|
|
Setting clear to an empty element may not be semantically correct. To clear an element, you shouldn't have to create and insert an empty element (it increases the DOM tree for no reason). So, #1 and #2 are definitely not recommendable, not best practice. |
#10
| |||
| |||
|
|
On 8 sep, 18:31, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote: I'd be surprised if even IE saw <div class="clear"><!-- --></div> as different to <div class="clear"></div>. IE 7, at least, considers, treats SGML comment differently. It does really treat div class="clear"><!-- --></div as different to div class="clear"></div Adjacent sibling selector and comment bug in Internet Explorer 7 and Internet Explorer 8 beta 1. http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/#bug165 and http://web.archive.org/web/20080210175201/http://www.unics.uni-hannover.de/nht capri/ie7-bugs from Andreas Prilop but there are also another bunch of cases where IE 6, IE 7 and even IE 8 treats SGML comments differently. |
![]() |
| Thread Tools | |
| Display Modes | |
| |