<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>宽度和高度</title>
<style type="text/css">
li{
border:1px dotted #ccc;
width:200px;
height:30px;
text-align :center;
padding-bottom:auto;
}
</style>
</head>
<body>
<ul>
<li>别让不会说话害了你</li>
<li>二十七八岁就应该有的见识</li>
<li>别让不好意思害了你</li>
</ul>
</body>
</html>
怎么讲 li里面的文字在 li 框里居中 上下左右都居中
li{
border:1px dotted #ccc;
width:200px;
height:30px;
text-align :center;
padding-bottom:auto;
line-height:30px;
}
样式加一个
line-height:30px;,这个高度等于height就行了
1111111111 <li style="text-align: center;">1111111111</li>
这个已经水平居中了,垂直没有居中,要垂直按dan大神回复修改即可。还有就是200宽太小了,看不出来居中。