[英]CSS UL List tabs issue
I have created the following 我创建了以下内容
And I don't know how to fix the spacing between the tabs. 而且我不知道如何固定标签之间的间距。
Maybe the solution is extrimply simple but I cannot figure it out. 也许解决方案非常简单,但我无法弄清楚。
I have try several methods but I cannot find out a solution. 我尝试了几种方法,但找不到解决方案。
Any idea please for what is wrong with that ? 请问这有什么问题吗?
Here you can find the code : http://jsfiddle.net/SFw6V/ 在这里您可以找到代码: http : //jsfiddle.net/SFw6V/
The problem is in tabs li class 问题在tabs li类中
Problem: display:inline-block
add extra margin to right 问题:
display:inline-block
向右添加额外的边距
Two Solutions: 两种解决方案:
display:block
& float:left
display:block
和float:left
margin-right:-4px;
Working Fiddle: http://jsfiddle.net/surendraVsingh/SFw6V/2/ 工作小提琴: http : //jsfiddle.net/surendraVsingh/SFw6V/2/
Better explained & different solutions: http://css-tricks.com/fighting-the-space-between-inline-block-elements/ 详细说明和不同的解决方案: http : //css-tricks.com/fighting-the-space-between-inline-block-elements/
They have a margin because there is a whitespace character (space, 它们之间有一个空白,因为有一个空白字符(空格,
) between them:
) 它们之间:
<ul class='tabs'>
<li data-tab="#tab1">
Tab 1
</li><li data-tab="#tab2"> <!-- remove spaces -->
Tab 2
</li><li data-tab="#tab3"> <!-- remove spaces -->
Tab 3
</li>
</ul>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.