前端的居中的问题
1、垂直居中:a、结合使用height和line-height:这两个值相等。 b、设置padding值
</head>
<styletype="text/css">
div{
width: 200px;
}
p{
line-height: 100px;
height: 100px;
}
</style>
<body>
<div>
<p>1221233</p>
<p>1111 </p>
</div>
</body>
2、元素水平居中:在其父辈元素中加入:text-align:center;
div{
width: 200px;
text-align:center;
}
}
</style>
<body>
<div>
<span>1221233</span>
<span>1111 </span>
</div>
</body>
3、小图片的居中:在包含小图片标签中添加vertical-align的样式。
<styletype="text/css">
.bg-title{
background:url(/images/tuku/bg-title.png)no-repeat center;
vertical-align:middle;
}
</style>
<body>
<div>
<a id="full"target="_blank" href="#" class="comment">
<i class="bg-titlebg-map2"></i>查看原图
</a>
</div>
</body>