实例
<!DOCTYPE html> <html> <head> <title>固定定位小案例</title> <link rel="stylesheet" type="text/css" href="css/style5.css"> <style type="text/css"> body{ background-color: #ccc; height: 2000px; } .ads{ width: 250px; height: 200px; background-color: yellow; position: fixed; right: 0; bottom: 0; text-align: center; } .ads button{ float: right; margin-right: 1px; } </style> </head> <body> <h1>实现一个跟随窗口滚动固定广告位</h1> <div class="ads"> <button onclick="this.parentNode.style.display = 'none'">关闭</button> <h3>热门广告位</h3> <h1>招商进行中</h1> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例