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 转载请注明出处。
查看全文
相关阅读:
Eclipse中SVN插件的安装方式
Javascript实现DIV滚动自动滚动到底部
Android程序开发的环境配置
Android程序开发基础之——页面布局
TinyMCE使用手册
PHP中使用mktime获取时间戳的一个黑色幽默
VS11本地IIS调试时(URL不使用虚拟目录,直接用localhost)
[VS扩展工具] Image Optimizer(图像优化压缩)
[程序安装包制作] Advanced Installer 备忘
安装VS2010 SP1时遇到WCF RIA Service 版本错误
原文地址:https://www.cnblogs.com/evlon/p/684040.html
最新文章
用Detours实现API拦截(1)
WMI工具
常用中断
windbg 驱动对象命令
游戏修改教程
Windbg常用命令
360的驱动(qutmdrv.sys)分页内存泄露
【强烈强烈推荐】《ORACLE PL/SQL编程详解》全原创(共八篇)系列文章导航
[推荐推荐][提供下载]ORACLE SQL:经典查询练手系列文章收尾(目录篇)
ASP.net中实现双表格同步缩放不变形
热门文章
SQLServer2008 动态SQL实践
软件开发中的完整测试所包括的环节UT、IT、ST、UAT
BAT实现照片文件批量改名
Android系统权限配置
Android程序开发基础之——页面传值
从mysql中导出单个表结构和数据
Wicket中JQuery事件绑定失效的解决
Android开发调试工具ADB的使用
LINQ中的OrderBy实现多字段升序、降序排序实现
代码帝:一个月10万行代码
Copyright © 2011-2022 走看看