触发haslayout:
position: absolutefloat: left | right
display: inline-block
width: except 'auto'
height: except 'auto'
zoom: except 'normal'
overflow: hidden | scroll | auto
overflow-x/-y: hidden | scroll | auto
position: fixed
min-width: any value
max-width: except 'none'
min-height: any value
max-height: except 'none'
writing-mode:tb-rl /* only for MS */
zoom: except 'normal'
清除hasLayout:
width: auto;height: auto;
max-width: none; /* IE7 */
max-height: none; /* IE7 */
position: static;
float: none;
overflow: visible;
zoom: normal;
writing-mode: lr-t;
若设置了display:inline;将不会触发haslayout。
haslayout是Windows Internet Explorer(IE7、IE6)渲染引擎的一个内部组成部分。在Internet Explorer中,使用布局概念来控制元素的尺寸和定位。在理想情况下,所有元素都控制自己的尺寸和定位。但是,这在IE中会导致很大的性能问题。因此,IE开发团队决定只将布局应用于实际需要它的那些元素,这样就可以充分地减少性能开销。
默认拥有haslayout属性
<html>, <body><table>, <tr>, <th>, <td>
<img>
<hr>
<input>, <button>, <select>, <textarea>, <fieldset>, <legend>
<iframe>, <embed>, <object>, <applet>
<marquee>