我的结果:http://i.imgur.com/P50RS.png 我的style.css
body {
background: url("img/bgs.png") repeat #cccccc;
color: #000000;
}
main {
margin-left: auto;
margin-right: auto;
}
Run Code Online (Sandbox Code Playgroud)
我的index.html
<html>
<head>
<title>Progress</title>
<link rel="stylesheet" href="css3-progress-bar.css" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link type="text/css" href="style.css" rel="stylesheet" />
</head>
<body>
<div id="main">
<p><b>215/160 LBS.</b></p>
<div class="bar_mortice rounded green_mortice">
<div class="progress rounded green" style="width: 05%;"></div>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
为什么文本不居中?此外,进度条没有居中,直到我添加了
margin: 0 auto;
Run Code Online (Sandbox Code Playgroud)
我尝试了主要但没有运气.有任何想法吗?
在css中,你需要使用#main而不是仅仅使用main.
此外,您需要给它一些宽度,否则它可能会占用整个宽度.试试这个:
#main {
margin-left: auto;
margin-right: auto;
width: 50%;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
805 次 |
| 最近记录: |