css position 属性 (absolute 和fixed 区别)
2015-06-03 00:20
537 查看
在css3中,position的属性值有:inherit, static, relative ,absolute, fixed.
inherit 是继承父元素的position属性值,IE不支持。
static 默认值,元素出现在正常的流中,忽略 (TRBL)和z-index的值。请参照下面的例子,div1由于position的值为static,所以top,left 没有起作用.
View Code
inherit 是继承父元素的position属性值,IE不支持。
static 默认值,元素出现在正常的流中,忽略 (TRBL)和z-index的值。请参照下面的例子,div1由于position的值为static,所以top,left 没有起作用.
<!Doctype html> <meta charset="utf-8"> <head> <title>test position static</title> <style type="text/css"> .divPos{ position:fixed; left:50px; top:50px; } .div1{ height:1000px; } </style> </head> <body> <div class="divPos"> The position of this div is fixed.And this div will be always here. </div> <div class="div1"></div> </body>
View Code
相关文章推荐
- css盒模型
- CSS实现DIV三角形
- CSS初始化代码
- CSS hack技巧
- CSS实现div居中
- css盒子模型
- CSS固定顶底之二(肯定有效)
- 设置webstorm的file watch 监视scss文件
- 【从0到1学Web前端】CSS伪类和伪元素
- 【从0到1学Web前端】CSS伪类和伪元素
- 【从0到1学Web前端】CSS伪类和伪元素 分类: HTML+CSS 2015-06-02 22:29 1065人阅读 评论(0) 收藏
- checkbox 设定文字和选框之间的距离及自定义样式
- 002_01CSS
- CSS position属性
- 使用CSS3的box-shadow实现双透明遮罩层对话框
- css伪元素过滤
- 【CSS3】---样式小技巧
- JS 获取style 里面的样式
- RS特殊报表样式需求处理
- CSS3中动画属性transform、transition 和 animation