首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >进程条圆在引导过程中不中心

进程条圆在引导过程中不中心
EN

Stack Overflow用户
提问于 2017-07-01 06:26:25
回答 3查看 2K关注 0票数 0

我试着在网页上居中这个进度条圈,但我做不到,我怎么能中心,请帮我解决这个问题,我试着把那个text-center放在,但不是为我工作,请看这张图片,你可以理解这个问题,谢谢

/jsfiddle

html

代码语言:javascript
复制
<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

代码语言:javascript
复制
/* 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*/
EN

回答 3

Stack Overflow用户

发布于 2017-07-01 06:43:06

代码语言:javascript
复制
.progress-bar {
        text-align: center;
        height: 150px;
        width: 150px;
        /* margin-left: 55px;*/
        margin-left: calc(100%/2 - 100px);
        margin-top: 65px;
    }
票数 0
EN

Stack Overflow用户

发布于 2017-07-01 06:43:37

试一试:只需在div中添加样式:“文本对齐:中心”,在内容包装div下面。

票数 0
EN

Stack Overflow用户

发布于 2017-07-01 06:54:33

尝尝这个

代码语言:javascript
复制
.progress-bar{
    float: none;
    display: block;
    margin: 0 auto;
}

如果您正在使用多个进度条,则尝试以下操作

代码语言:javascript
复制
.progress-bar{
    float: none;
    display: inline-block;
    margin: 0 auto;
}
.on-parent-element{
    text-align: center
}

更新-

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

您应该在进度条元素上添加适当的宽度,并移除浮动使用内联块。

你在小提琴上犯了两个错误。

  1. 在进度条插件之前添加jQuery。
  2. 使用HTTPS加载外部资源。(请检查您的控制台)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44858008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档