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 转载请注明出处。
查看全文
相关阅读:
RDay2-Problem 2 B
杭电 1862 EXCEL排序(sort+结构体)
杭电 2803 The MAX(sort)
杭电 5053 the Sum of Cube(求区间内的立方和)打表法
杭电 2089 不要62
杭电 4548 美素数(素数打表)
杭电2098 分拆素数和
杭电1722 Cake (分蛋糕)
素数判定 (素数打表)
最小公倍数
原文地址:https://www.cnblogs.com/evlon/p/684040.html
最新文章
LightOJ 1284
LightOJ 1140 计数/数位DP 入门
LightOJ 1218 概率水题(几何分布)
POJ 2891- Strange Way to Express Integers CRT 除数非互质
LightOJ 1319
LightOJ 1306
LightOJ 1326 – Race 第二类Stirling数/
LightOJ 1161
LightOJ 1419 – Necklace Polya计数+费马小定理求逆元
LightOJ 1028
热门文章
LightOJ 1375
营业额统计
USACO15DEC最大流MaxFlow
FHQ-Treap小结
网络流小结
NOIP2018Day1T2 货币系统
NOIP2018Day1T1 铺设道路
NOIP2018游记
LuoGu P1168 中位数
LuoGu P4996 咕咕咕
Copyright © 2011-2022 走看看