放大时身体如何居中?出一个网页?
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
body {
font-family: 'Merriweather Sans', sans-serif;
margin:0px;
font-weight: normal 300;
font-size:14px;
color:#595959;
text-align:center;
}
答案 0 :(得分:0)
当我将margin: 0 auto;
添加到该div时,请注意红色div的居中。尝试缩放,它只会留在中心。你不需要text-align: center
在身体的css属性中。只需将margin: 0 auto;
添加到您要居中的div (我假设您希望元素水平居中)
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id = 'justCreatedThisDiv' style = 'margin: 0 auto;'>
<!-- put all your code here -->
<div style = "width: 100px; height: 100px; background-color: red; margin: 0 auto;"></div>
</div>
</body>
</html>
&#13;