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 转载请注明出处。
查看全文
相关阅读:
jQuery检测滚动条(scroll)是否到达底部
sql group by
hbm.xml 详解总结
net.sf.json 时间格式的转化
经典SQL语句大全
HashTable
in与exist , not in与not exist 的区别
网页布局常用的一些命名规则和书写
什么是SOA?
sql之left join、right join、inner join的区别
原文地址:https://www.cnblogs.com/evlon/p/684040.html
最新文章
诗经秦风
用户说明书,还是用户操作手册?
.net 2.0下C#单例模式的精简写法!
关于业务建模
X3你是啥?
2012 华为编程比赛 解决方案
VC6 在win7下无法兼容office2010问题解决 FileTool.dll
2013 华为编程比赛 解决方案 1
Ubuntu 下Eclipse+PyDev IDE环境的配置
ZOJ1010 奇偶剪枝
热门文章
HDU1009 贪心
ZOJ1002 回溯
libevent 环境配置
HDU 1005 矩阵的快速二分幂
大数四则运算之大数相减
如何中止javascript执行
C# 后台图片写字体
String 格式化
转@OneToMany或@ManyToOne的用法annotation关系映射篇(上)
jquery ajax 返回值 中文时乱码或变成问号解决方法
Copyright © 2011-2022 走看看