我的 CSS 有什么问题:文本没有像我期望的那样居中
参见 https://jsfiddle.net/L5bgrg8d/
<html>
<head>
<title>
</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<div id="header">
My header
</div>
<div id="content">
<div id="nav"></div>
</div>
<div id="footer"></div>
</div>
</body>
</html>
样式.css
#header {
background-color: teal;
color: white
text-align: center;
}
最佳答案
在 css 中你漏掉了分号。
#header {
background-color: teal;
color: white;
text-align: center;
}
关于html - CSS 文本对齐不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42314140/