要加
line-height:外面那个div的高度;
追问没太懂,求详解
追答就是给套着““YJY个人博客”这几个字的的那个div的css那里添加一行设置一下他的line-height:属性,属性的值等于这个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" xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style>
#div1
{
width:200px;
height:200px;
background: #ccc;
margin:10px;
text-align: center;
}
#div2
{
width:200px;
height:200px;
background: #abcdef;
margin:10px;
text-align: center;
line-height: 200px;
}
</style>
</head>
<body>
<div id="div1">
<span>文本一(没有line-height)</span>
</div>
<div id="div2">
<span>文本二(有line-height)</span>
</div>
</body>
</html>