怎么設(shè)置,讓數(shù)字處于方格的正中央
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>內(nèi)聯(lián)塊狀元素</title>
<style type="text/css">
a,span{
? ? display:inline-block;
width:50px;/*在默認(rèn)情況下寬度不起作用*/
height:50px;/*在默認(rèn)情況下高度不起作用*/
background:pink;/*設(shè)置背景顏色為粉色*/
text-align:center; /*設(shè)置文本居中顯示*/
? ??
}
</style>
</head>
<body>
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a><br/>
<span style="color:blue;background:yellow">5</span>
<span style="color:blue;background:yellow">6</span>
<span style="color:blue;background:yellow">7</span>
<span style="color:blue;background:yellow">8</span>
</body>
</html>
2017-07-25
試試line-height屬性
line-height:50px
2017-07-25
加一個(gè)line-height:50px。。。OK
2017-07-25
將height:50px;改為line-height:50px