小技巧小经验之-----居中
来源:互联网 发布:防蹭网软件怎么用 编辑:程序博客网 时间:2024/05/01 03:30
/*图片居中*/<dl> <dt><img src=""/><span></span></dt> <dd></dd></dl>dt{height:100px;width:100px;text-align:center;}dt span{ width:0;height:50%;display:inline-block;}dt img{vertical-align:middle;}/*span为参照物,只有inline-block类型可以用vertical-align这个属性*//*法二:*/dt{height:100px;width:100px;text-align:center;}dt span{width:0;height:100px;display:inline-block;vertical-align:middle;}dt img{vertical-align:middle;}/*盒子居中*/html:<div class="fu"> <div class="zi"></div></div>css:/*法一*/.fu{height:500px;width:400px;background:red; position:relative;}.zi{height:100px;width:100px;background:blue; psition:absolute;left:50%;top:50%;margin:-50px 0 0 50px;}/*法二*/.fu{height:500px;width:400px;background:red; position:relative;}.zi{height:100px;width:100px;background:blue; position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;}/zi盒子的宽高可以自定义无论多少他都会居中z(自适应居中)/
1 0
- 小技巧小经验之-----居中
- 小技巧、小经验
- CSS居中小技巧
- 元素垂直居中小技巧
- 小图片居中的小技巧
- ①Android开发小技巧之ToolBar-文字居中
- 小技巧、小经验(2)
- 小技巧、小经验(3)
- 小技巧、小经验(4)
- 小技巧、小经验(6)
- C++ Builder 经验小技巧
- Python小技巧经验积累
- 小经验之
- css布局小技巧之:让一个小图片水平靠右对齐,垂直居中
- Div左右居中属性!(小技巧)
- 元素水平居中设置小技巧
- css垂直水平居中小技巧
- HTML`CSS_页面居中小技巧
- HttpModule的认识
- css布局:圣杯布局
- day11_python多线程基础
- st表
- UVA 1379 Pitcher Rotation
- 小技巧小经验之-----居中
- Arcgis插值方法简介
- C++ 硬件信息 获取CPU序列号
- Win7实现双ip设置
- mysql优化查询
- Android开发心得整理
- 前端之路
- ReentrantLock(重入锁)以及公平性
- 重拾C++ 关联容器