手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >让图片img标签在div里上下左右居中的方法
让图片img标签在div里上下左右居中的方法
摘要:如何让img标签在div里左右上下居中#container{width:400px;height:400px;background:#ccc...

<!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 name="author" type="Nancle from CAU CS101" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>如何让img标签在div里左右上下居中</title>

<script type="text/javascript">

</script>

<style type="text/css">

#container{width:400px; height:400px; background:#ccc; text-align:center;}

img{margin:100px auto 0 auto;}

</style>

</head>

<body>

<div id="container">

<img src="http://img.my.csdn.net/uploads/201207/14/1342258377_8375.png" width="200" height="200" />

</div>

<p>

</p>

</body>

</html>

【让图片img标签在div里上下左右居中的方法】相关文章:

CSS实现同一行的图片和文字垂直居中对齐的方法

CSS条状图表形式的实现方法

css中不确定高度垂直居中2种方法

chrome居中但ie不居中的解决方法

CSS div居中的三种方法

CSS让ul所有的li居中显示的方法

纯CSS实现鼠标悬停提示的方法

让div旋转一定的角度方法

css控制div不能居中的解决办法

div+css垂直居中的五种实现方法

精品推荐
分类导航