zoukankan
html css js c++ java
[收藏]DIV中图片居中
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
/>
<
title
>
一个div里面图片垂直居中的例子
</
title
>
<
style
type
="text/css"
>
<!--
div
{
}
{
width
:
120px
;
height
:
100px
;
border
:
1px solid #ccc
;
overflow
:
hidden
;
position
:
relative
;
display
:
table-cell
;
text-align
:
center
;
vertical-align
:
middle
;
background-color
:
blue
;
}
div span
{
}
{
position
:
static
;
+position
:
absolute
;
top
:
50%
;
}
img
{
}
{
position
:
static
;
+position
:
relative
;
top
:
-50%
;
left
:
-50%
;
}
-->
</
style
>
</
head
>
<
body
>
<
div
>
<
span
>
<
img
src
=http://images.sohu.com/uiue/sohu_logo/beijing2008/sohu.gif
>
</
span
>
</
div
>
</
body
>
</
html
>
QQ:273352165 evlon#126.com 转载请注明出处。
查看全文
相关阅读:
SpringBoot之集成slf4j日志框架
Maven项目优势
Idea操作技巧
Nginx服务器之负载均衡策略(6种)
Git操作规范
Mybatis之Tk
MyEclipse取消验证Js的两种方法
文件异步上传,多文件上传插件uploadify
EasyMock的使用
jquery 中post 、get的同步问题,从外部获取返回数据
原文地址:https://www.cnblogs.com/evlon/p/684040.html
最新文章
mysql join用法简介
《索罗斯传》读后感
nginx(三)反向代理和负载均衡
电商项目商品详情页架构设计
springmvc解决中文乱码问题
Idea 快捷键
DSO 代码框架
DSO windowed optimization 公式
DSO 优化代码中的 Schur Complement
直接法光度误差导数推导
热门文章
Madgwick IMU Filter
Windows::Docker::Ubuntu 做 SLAM
[LeetCode] #123 Best Time to Buy and Sell Stock III
[Alg::Trick]小白鼠找毒酒
[Alg::DP] 袋鼠过河
[Alg] 尺取法
SpringBoot之集成rocketmq消息队列框架
SpringBoot之集成redis缓存框架
SpringBoot之集成参数校验框架
SpringBoot之集成shiro鉴权认证框架
Copyright © 2011-2022 走看看