text-align:center居中問題
<!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{
? ? display:inline-block;
width:20px;/*在默認(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>
</body>
</html>
text-align:center只能水平居中,上下居中要手動設(shè)置line-height?
2022-03-24
表格中的內(nèi)容必須放在列中,也就是必須放在lt;tdgt;lt;/tdgt;中。代碼中沒有語言編碼
2016-07-12
甚至上下邊距也可以啊
2016-07-12
設(shè)置行高line-height就可以垂直居中了