Home >Web Front-end >HTML Tutorial >Reasons and solutions for the existence of whitespace characters between html tags under IE6 and 7, resulting in unnecessary white space occupied after rendering_html/css_WEB-ITnose
Directly above:
Reason: The content contained in this div is printed and output in the background. If nothing is output, the browser will add whitespace to the empty area by default.
Under IE6 and 7, when the browser parses and renders, it will consider that whitespace characters also occupy space. By default, they have font attributes, so the "excess space-occupying" bug will appear.
Solution:
1. Let the html tags be connected and output. For example:
. ??It’s too cumbersome, the code is irregular, and it’s difficult to maintain.2. Set font-size:0; ??Can’t be a perfect fix~
2. Use the comment character . For example:
, so that there is no white space in the middle of the div. ??Although this can fix the problem, it is not good enough3. Use the Additional knowledge: wbr tag: It functions as a soft line break. The browser will automatically break the text content according to the width of the container Compatibility: View URL: http://www.quirksmode.org/oddsandends/wbr.html