我试图让我的条在文本之后对齐。它们使用 css 绘制并使用 jQuery 进行动画处理。当我使用 div 类“meter orange”并使用 span 样式的宽度设置进度条的大小时,会触发 span。
<div class="meter orange">HTML
<span style="width: 65.3%"></span>
</div>
有什么建议么?
截屏:
CSS:
#progress-bars-page-wrap {
width: 490px;
margin: 80px auto;
}
.meter {
height: 8px; /* Can be anything */
position: relative;
padding: 3px;
}
.meter > span {
height: 100%;
background-color: rgb(43,194,83);
}
.orange > span {
background-color: #e94939;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<link rel="stylesheet" type="text/css" href="bars.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(function() {
$(".meter > span").each(function() {
$(this)
.data("origWidth", $(this).width())
.width(0)
.animate({
width: $(this).data("origWidth")
}, 900);
});
});
</script>
</head>
<body>
<div id="progress-bars-page-wrap">
<div class="meter orange">Javascript<span style="width: 33.3%"></span>
</div>
<div class="meter orange">HTML
<span style="width: 65.3%"></span>
</div>
<div class="meter orange">CSS
<span style="width: 70.3%"></span>
</div>
<div class="meter orange">Java
<span style="width: 60%"></span>
</div>
<div class="meter orange">Python
<span style="width: 84%"></span>
</div>
<div class="meter orange">.Net
<span style="width: 32%"></span>
</div>
<div class="meter orange">Ajax
<span style="width: 60%"></span>
</div>
</div>
</body>
</html>