<html> <head> <style type="text/css"> img.x { position:absolute; left:0px; top:0px; z-index:-1 } </style> </head> <body> <h1>这是一个标题</h1> <img class="x" src="http://img.gaodaima.com/paperimg_gaodaima_chengxuyuan.jpg" /> <p>默认的 z-index 是 0。Z-index -1 拥有更低的优先级。</p> </body> </html>
本文案例为大家展示了《如何使用Z-index将在一个元素放置于另一元素之后》的代码,若要看代码效果请大家点击“运行代码”按钮。
[code]<html> <head> <style type=”text/css”> img.x { position:absolute; left:0px; top:0px; z-index:-1 } </style> </head> <body> <h1>这是一个标题</h1> <img class=”x” src=”http://img.gaodaima.com/paperimg_gaodaima_chengxuyuan.jpg” /> <p>默认的 z-index 是 0。Z-index -1 拥有更低的优先级。</p> </body> </html>[/code]