相对定位和绝对定位以及固定定位
来源:互联网 发布:无数据库论坛源码 编辑:程序博客网 时间:2024/06/05 02:42
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <style> #left,#center,#right{ float: left; } #left{ width: 200px; height: 200px; background-color: #ea2000; z-index: -2; } #center{ width: 200px; height: 200px; background-color: #ff7300; position: relative; /*position: relative相对定位 占用空间不会给别人*/ top: 20px; left: 50px; z-index: -1; } #right{ width: 200px; height: 200px; background-color: aqua; } #other{ width: 300px; height: 300px; background-color: #0D0000; } </style> <title>在css中的定位 相对定位</title></head><body><!-- 采用相对定位的元素 : 会相对与他的位置进行定位 并且,元素原始占用 的空间不会被其他的元素占用--><!--采用绝对定位的元素:会寻找离他最近的采用了定位的父元素,并以他为坐标进行定位 如果所有的父元素都没有使用定位,则以body为坐标进行定位 并且,元素占用的空间会被其他的元素占用--><div> <div style="position: relative;top: 100px ;left: 100px"> <div> <div id="left"></div> <div id="center"></div> <div id="right"></div> </div> </div> <div id="other"></div></div></body></html>
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <style> #back{ width: 100px; height: 100px; background-color: yellow; text-align: center; line-height: 100px; position: fixed; bottom: 20px; right: 20px; z-index: 1000; } </style> <title>固定定位</title></head><body><div style="height: 1000px"> <div id="back">返回页面顶部 </div></div></body></html>
0 0
- 相对定位和绝对定位以及固定定位
- css 固定定位 相对定位 绝对定位
- css相对定位、绝对定位、固定定位
- css :相对定位,绝对定位,固定定位
- 相对定位,绝对定位,固定定位
- 相对、绝对和固定定位的比较
- css相对、绝对和固定定位
- 相对定位和绝对定位
- 绝对定位和相对定位
- 绝对定位和相对定位
- 相对定位和绝对定位
- 相对定位和绝对定位
- 相对定位和绝对定位
- 绝对定位和相对定位
- 相对定位和绝对定位
- 绝对定位和相对定位
- 相对定位和绝对定位
- 绝对定位和相对定位
- 用python获取cmd下的相关信息
- Java在读取文件内容的时候,如何判断出空白行
- 树莓派学习资料链接
- hdu1258
- ZOJ3946-Highway Project
- 相对定位和绝对定位以及固定定位
- C/C++常用头文件及函数汇总
- 编解码基础2
- 报头压缩-Linux下安装ROHC协议库
- 堆栈
- JSTL标签和常用函数的使用
- 数据访问层(连接数据库)
- 行级元素上下边距 块级元素左右边距
- shell传参注意空格