I have a progress bar. It works well, but my concern is for the style. Some lines are displayed and I don't know why. In the screenshot below you can see lines between numbers. Any ideas?
我有一个进度条。它工作得很好,但我关心的是它的风格。有些线显示出来了,我不知道为什么。在下面的截图中,你可以看到数字之间的界限。什么好主意吗?
My jsfiddle: JSFIDDLE
我的jsfiddle:jsfiddle
My code:
我的代码:
ol.progtrckr {
margin: 0;
padding: 0;
list-style-type: none;
}
ol.progtrckr li {
display: inline-block;
text-align: center;
line-height: 3em;
}
ol.progtrckr[data-progtrckr-steps="4"] li { width: 15%; }
ol.progtrckr li.progtrckr-done {
color: black;
padding-right: 12px;
border-bottom: 4px solid green;
}
ol.progtrckr li.progtrckr-todo {
color: silver;
padding-right: 12px;
border-bottom: 4px solid silver;
}
ol.progtrckr li:after {
content: "\00a0\00a0";
}
ol.progtrckr li:before {
position: relative;
bottom: -2.5em;
float: left;
left: 50%;
line-height: 1em;
}
ol.progtrckr li.progtrckr-done:before {
content: "\2713";
color: white;
background-color: green;
height: 1.2em;
width: 1.2em;
line-height: 1.2em;
border: none;
border-radius: 1.2em;
}
ol.progtrckr li.progtrckr-todo:before {
content: "\039F";
color: silver;
background-color: white;
font-size: 1.5em;
bottom: -1.6em;
}
<ol class="progtrckr" data-progtrckr-steps="">
<a href="#" >
<li class="progtrckr-done ">1 </li> </a>
<a href="#">
<li class="progtrckr-done">2 </li> </a>
<a href="#">
<li class="progtrckr-done">3 </li> </a>
<a href="#">
<li class="progtrckr-todo">4 </li> </a>
</ol>
8 个解决方案
#1
3
Please apply text-decoration:none for anchor under with class "progtrckr" this line will be disappear or add below css in your stylesheet file -
请应用文本修饰:“progtrckr”类下的“无锚”,这一行将在样式表文件中消失或添加到css下面
ol.progtrckr>a {
text-decoration:none;
}
#2
2
You using "display: inline-block" for "ol.progtrckr li", so these elements behave like inline elements but they have the space. So you should use "float:left" instead of "display: inline-block". You also should use "clearfix" for "ol" element. For example: add ".clerfix" class to "ol" element and use the following css:
使用“display: inline-block”表示“ol”。progtrckr li"这些元素像内联元素一样但它们有空间。因此,您应该使用“float:left”而不是“display: inline-block”。您还应该对“ol”元素使用“clearfix”。例如:添加”。将“类”标记为“ol”元素,并使用以下css:
.clearfix:after {
content: ".";3
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#3
1
You have to put your "li" tags before your "a" tags, like this:
你必须把你的“li”标签放在你的“a”标签之前,像这样:
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done"><a href="#">1</a></li>
<li class="progtrckr-done"><a href="#">2</a></li>
<li class="progtrckr-done"><a href="#">3</a></li>
<li class="progtrckr-done"><a href="#">4</a></li>
</ol>
#4
0
You are linking the entire <li>
element while you should link only the value inside it:
您正在链接整个
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done "><a href="#" >1</a></li>
<li class="progtrckr-done "><a href="#" >2</a></li>
<li class="progtrckr-done "><a href="#" >3</a></li>
<li class="progtrckr-done "><a href="#" >4</a></li>
</ol>
Here is the updated JSFiddle I also added a padding:0
here:
这里是更新的JSFiddle I也添加了一个填充:0:
ol.progtrckr li.progtrckr-done {
color: black;
padding-right: 12px;
border-bottom: 4px solid green;
padding: 0;
}
#5
0
Updated fiddle here: https://jsfiddle.net/aLwgrym8/63/
更新小提琴:https://jsfiddle.net/aLwgrym8/63/
You simply need to add text-decoration: none to the anchor elements:
您只需添加文本修饰:无锚点元素:
ol.progtrckr > a {
text-decoration: none;
}
Alternatively, you could move the anchor elements within the <li>
's as opposed to the other way around which you're currently doing. Updated fiddle for this here: https://jsfiddle.net/aLwgrym8/65/
或者,您可以将锚元素移动到
HTML:
HTML:
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done "><a href="#" >1</a></li>
<li class="progtrckr-done"><a href="#">2</a></li>
<li class="progtrckr-done"><a href="#">3</a></li>
<li class="progtrckr-todo"><a href="#">4</a></li>
</ol>
CSS:
CSS:
ol.progtrckr li > a {
text-decoration: none;
color: #000;
}
#6
0
Add
添加
a:link {
text-decoration: none;
}
(Links are underlined by default in many browsers)
(在许多浏览器中,链接默认都有下划线)
Addition: Or, if you want to keep the underline in your regular links, write this instead, and to be safe, include the other link states too:
添加:或者,如果你想在你的常规链接中保留下划线,那么写这个,为了安全起见,也包括其他链接状态:
.progtrckr-done a:link,
.progtrckr-done a:hover,
.progtrckr-done a:active,
.progtrckr-done a:visited {
text-decoration: none;
}
#7
0
Note that you have spaces between your closing </li>
tags and the closing </a>
tags.
注意,在关闭标记和关闭标记之间有空格。
<li class="progtrckr-done">2 </li> </a>
If you remove these, all the above actions won't be necessary at all, because there's nothing to underline in the links.
如果您删除了这些操作,那么上面的所有操作都没有必要,因为链接中没有下划线。
#8
0
It's default text decoration on the <a>
element.
Use:
使用:
a{
text-decoration: none;
}
#1
3
Please apply text-decoration:none for anchor under with class "progtrckr" this line will be disappear or add below css in your stylesheet file -
请应用文本修饰:“progtrckr”类下的“无锚”,这一行将在样式表文件中消失或添加到css下面
ol.progtrckr>a {
text-decoration:none;
}
#2
2
You using "display: inline-block" for "ol.progtrckr li", so these elements behave like inline elements but they have the space. So you should use "float:left" instead of "display: inline-block". You also should use "clearfix" for "ol" element. For example: add ".clerfix" class to "ol" element and use the following css:
使用“display: inline-block”表示“ol”。progtrckr li"这些元素像内联元素一样但它们有空间。因此,您应该使用“float:left”而不是“display: inline-block”。您还应该对“ol”元素使用“clearfix”。例如:添加”。将“类”标记为“ol”元素,并使用以下css:
.clearfix:after {
content: ".";3
display: block;
height: 0;
clear: both;
visibility: hidden;
}
#3
1
You have to put your "li" tags before your "a" tags, like this:
你必须把你的“li”标签放在你的“a”标签之前,像这样:
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done"><a href="#">1</a></li>
<li class="progtrckr-done"><a href="#">2</a></li>
<li class="progtrckr-done"><a href="#">3</a></li>
<li class="progtrckr-done"><a href="#">4</a></li>
</ol>
#4
0
You are linking the entire <li>
element while you should link only the value inside it:
您正在链接整个
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done "><a href="#" >1</a></li>
<li class="progtrckr-done "><a href="#" >2</a></li>
<li class="progtrckr-done "><a href="#" >3</a></li>
<li class="progtrckr-done "><a href="#" >4</a></li>
</ol>
Here is the updated JSFiddle I also added a padding:0
here:
这里是更新的JSFiddle I也添加了一个填充:0:
ol.progtrckr li.progtrckr-done {
color: black;
padding-right: 12px;
border-bottom: 4px solid green;
padding: 0;
}
#5
0
Updated fiddle here: https://jsfiddle.net/aLwgrym8/63/
更新小提琴:https://jsfiddle.net/aLwgrym8/63/
You simply need to add text-decoration: none to the anchor elements:
您只需添加文本修饰:无锚点元素:
ol.progtrckr > a {
text-decoration: none;
}
Alternatively, you could move the anchor elements within the <li>
's as opposed to the other way around which you're currently doing. Updated fiddle for this here: https://jsfiddle.net/aLwgrym8/65/
或者,您可以将锚元素移动到
HTML:
HTML:
<ol class="progtrckr" data-progtrckr-steps="">
<li class="progtrckr-done "><a href="#" >1</a></li>
<li class="progtrckr-done"><a href="#">2</a></li>
<li class="progtrckr-done"><a href="#">3</a></li>
<li class="progtrckr-todo"><a href="#">4</a></li>
</ol>
CSS:
CSS:
ol.progtrckr li > a {
text-decoration: none;
color: #000;
}
#6
0
Add
添加
a:link {
text-decoration: none;
}
(Links are underlined by default in many browsers)
(在许多浏览器中,链接默认都有下划线)
Addition: Or, if you want to keep the underline in your regular links, write this instead, and to be safe, include the other link states too:
添加:或者,如果你想在你的常规链接中保留下划线,那么写这个,为了安全起见,也包括其他链接状态:
.progtrckr-done a:link,
.progtrckr-done a:hover,
.progtrckr-done a:active,
.progtrckr-done a:visited {
text-decoration: none;
}
#7
0
Note that you have spaces between your closing </li>
tags and the closing </a>
tags.
注意,在关闭标记和关闭标记之间有空格。
<li class="progtrckr-done">2 </li> </a>
If you remove these, all the above actions won't be necessary at all, because there's nothing to underline in the links.
如果您删除了这些操作,那么上面的所有操作都没有必要,因为链接中没有下划线。
#8
0
It's default text decoration on the <a>
element.
Use:
使用:
a{
text-decoration: none;
}