标签:
<button>First</button> <br> <button>Second</button> <br> <button>Last</button> <br>界面在Chrome中的效果如下:
<button style="position: static;top: 200px;">First</button> <br> <button>Second</button> <br> <button>Last</button> <br>在添加了该样式后,界面的效果将无任何变化,但如果我们将position的值修改为relative:
<button style="position: relative;top: 200px;">First</button> <br> <button>Second</button> <br> <button>Last</button> <br>然后布局的效果发生了变化:
<button>First</button> <br> <button style="position: absolute;top: 200px;">Second</button> <br> <button>Last</button> <br>在chrome中的效果如下
<p style="position: relative;top: 100px;"> <button>First</button> <br> <button style="position: absolute;top: 200px;">Second</button> <br> <button>Last</button> <br> </p>在chrome中的效果就发生了变化,因为second按钮会相对于position值不为static的第一位祖先元素来定位。
<p style="position: relative;top: 100px;"> <button style="position: relative;top: 200px;">First</button> <br> <button style="position: absolute;top: 200px;">Second</button> <br> <button>Last</button> <br> </p>在chrome中的效果如下:
<p style="position: relative;top: 100px;"> <button style="position: relative;top: 200px;">First</button> <br> <button style="position: absolute;top: 600px;">Second</button> <br> <button style="position: fixed;top: 110px;">Last</button> <br> </p>在chrome中的效果如下:
p { column-count: 3; column-file: balance; column-rule: medium solid black; column-gap: 1.5em; }注意如果应用column-width属性,浏览器会通过添加或者删除列数维持指定列宽。目前大部分浏览器还不支持多列布局。
标签:
原文地址:http://blog.csdn.net/tomato__/article/details/50887521