图片上下左右居中
来源:互联网 发布:matlab哈密顿回路算法 编辑:程序博客网 时间:2024/05/16 05:00
<style> body{ margin: 0; padding: 0; } /*方法一*/ .box{ position: relative; width: 300px; height: 300px; border: 1px solid red; } .box img{ position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; } /*方法二*/ .box { display: table-cell; vertical-align:middle; text-align:center; width:200px; height:200px; border: 1px solid red; } .box img{ vertical-align: middle; } /*方法三*/ .box{ width: 300px; height: 300px; border: 1px solid red; position: relative; } .box img{ width: 100px; height: 100px; background-color: black; position: absolute; left: 50%; top: 50%; margin-top: -50px; margin-left: -50px; } </style><body> <div class="box"> <img src="images/public/logo_s.png"> </div></body>
参考:http://www.cnblogs.com/2050/p/3392803.html
0 0
- 图片上下左右居中
- 图片上下左右垂直居中
- html图片上下左右居中
- 图片上下左右居中等比缩放
- 设置图片的上下左右居中
- 图片在容器内上下左右居中
- css任意图片文字上下左右都居中对齐
- css实现div中的图片自动上下左右居中
- Delphi DBGridEh 嵌入图片,显示文字,且上下左右居中
- CSS实现图片在DIV中上下左右居中(1)
- CSS3实现图片在DIV中上下左右居中(2)
- css div上下左右居中
- div 上下左右居中显示
- css3 样式上下左右居中
- html 上下左右都居中
- div上下左右居中
- html 上下左右居中
- 区块上下左右居中布局
- EF学习小记
- 思科最简单3层配置
- error MSB8008: 指定的平台工具集(v110)未安装或无效。请确保选择受支持的 PlatformToolset 值
- 获得 1000 个赞的程序员高薪职业建议
- TableViewCell分割线为一个像素点
- 图片上下左右居中
- pAdTy_-4 与其它应用程序的交互
- 财务报表开发实例分析:几个通用维度介绍与关键点
- LeetCode 046 Permutations
- 八皇后问题
- swift 快速奔跑的兔几 本节的内容是:SceneKit 第一说 创建一个3D胶囊
- android获取网络数据
- android 如何去获取手机Gps的信号强度
- sql异常