当前阅读教程:CSS入门到精通 > fixed 定位 | |
阅读(22555525) 收藏 赞(5685) 分享 | |
上一篇: static 定位 | 下一篇: relative 定位 |
元素的位置相对于浏览器窗口是固定位置。 即使窗口是滚动的它也不会移动: 实例代码<!doctype html> <html> <head> <meta charset="utf-8"> <title>CSS Position(定位)-fixed 定位</title> <!--定义内部样式--> <style> .css1{ position:fixed; top:30px; /*顶部30px*/ right:5px;/*右侧5px*/ } </style> </head> <body> <p>使用fixed定位的内容</p> <p><b>注意:</b> IE7 和 IE8 支持只有一个 !DOCTYPE 指定固定值.</p> <p>第01行文本</p><p>第02行文本</p><p>第03行文本</p><p>第04行文本</p><p>第05行文本</p><p>第06行文本</p> </body> </html> 效果图 |
|
上一篇: static 定位 | 下一篇: relative 定位 |