进度条圆圈不在引导程序中心

时间:2017-07-01 06:26:25

标签: html css twitter-bootstrap progress-bar

我试着在网页这个进度条圈子中心,但我不能这样做,我怎么能居中,请帮我解决这个问题,我试着把它text-center但不适合我,请看看这个图像,你可以理解这个问题, 谢谢 Look issue

/jsfiddle

HTML

<div class="content-wrap">
<div>

<div class="progress-bar position text-center" data-percent="48" data-duration="1000" data-color="#6a6f77,#5fb756"><script>$(".progress-bar").loading()</script></div>
</div>
</div>

CSS

/* Progress Bar */

.progress-bar {
    text-align: center;
    height: 150px;
    width: 150px;
    margin-left: 55px;
    margin-top: 65px;
}
.progress-bar {
    float: left;
    width: 0;
    height: 100%;
    font-size: 12px;
    line-height: 20px;
    color: #fff;
    text-align: center;
    -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
    -webkit-transition: width .6s ease;
    -o-transition: width .6s ease;
    transition: width .6s ease;
}
.progress-bar div {
    position: absolute;
    height: 200px;
    width: 200px;
    border-radius: 50%;
}
.progress-bar div span {
    position: absolute;
    font-family: sans-serif;
    font-size: 60px;
    line-height: 175px;
    height: 175px;
    width: 175px;
    left: 12.5px;
    top: 13.5px;
    text-align: center;
    border-radius: 50%;
    background-color: #ffffff;
    color: black;
}
.progress-bar .background {
    background-color: #b3cef6;
}
.progress-bar .rotate {
    clip: rect(0 100px 200px 0);
    background-color: #4b86db;
}
.progress-bar .left {
    clip: rect(0 100px 200px 0);
    opacity: 1;
    background-color: #b3cef6;
}
.progress-bar .right {
    clip: rect(0 100px 200px 0);
    transform: rotate(180deg);
    opacity: 0;
    background-color: #4b86db;
}
@keyframes toggle {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
/*End of Progress Bar*/

3 个答案:

答案 0 :(得分:0)

enter image description here

.progress-bar {
        text-align: center;
        height: 150px;
        width: 150px;
        /* margin-left: 55px;*/
        margin-left: calc(100%/2 - 100px);
        margin-top: 65px;
    }

答案 1 :(得分:0)

试试这个:只需在div中添加样式:“text-align:center”,在content-wrap div下面

答案 2 :(得分:0)

试试这个

.progress-bar{
    float: none;
    display: block;
    margin: 0 auto;
}

如果您使用多个进度条,请尝试此

.progress-bar{
    float: none;
    display: inline-block;
    margin: 0 auto;
}
.on-parent-element{
    text-align: center
}

更新 -

这是工作小提琴 - https://jsfiddle.net/thesumit67/6jz40dfa/6/

您应该在进度条元素上添加适当的宽度,然后删除float使用内联块。

在你的小提琴中,你犯了两个错误。

  1. 在进度条插件之前添加jQuery。

  2. 使用HTTPS加载外部资源。 (检查你的控制台)

相关问题