用CSS实现交叉的两个层,一个用CSs布局网站的好例子,代码就在下边,大家自己看看吧,希望对CSS初学者有帮助哦,如果你一点也不懂CSS,可以阅读烈火网提供的CSS手册。 演示: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>用CSS实现交叉的两个层 - Liehuo.Net</title> <style> #box1 { position: absolute; top: 100px; left: 100px; width: 400px; background-color: #B0C4DE; border: 2px solid #34537D } #box2 { position: absolute; bottom: 2em; right: 2em; width: 150px; background-color: #FFFAFA; border: 2px solid #CD5C5C; } </style> </head> <body> <div id="box1">This is box one. It is positioned 100 pixels from the top and 100 pixels from the left of the viewport <div id="box2">This is box two. It is positioned 2 em from the bottom and 2 em from the right of the parent element - box1</div> </div> </body> </html> <br /><center>如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></center>提示:可修改后代码再运行! 文章导航 Div+CSS弹出始终居中的半透明遮罩层效果CSS 半透明层的实现,文字层半透明显示图片