gpt4 book ai didi

html - CSS - 边框和背景颜色之间的空间

转载 作者:行者123 更新时间:2023-12-05 02:23:15 24 4
gpt4 key购买 nike

我需要在边框和背景颜色之间创建空白。

示例

enter image description here

好的,| = 边框,# = 背景色

上面的例子会画成|#####|我需要 | ##### |

我该怎么做呢?

我为图片中的示例编写的代码是(下)

CSS

.nav-justified > .active > a, .nav-justified > .active > a:hover, .nav-justified > active > a:focus {
background-color: #F0F0F0;
background-image: none;
color: #8f1b1f;
left: 0;
width: 100%;
margin-top: -17px;
padding-bottom: 20px;
padding-top: 20px;
padding-right: 20px;
padding-left: 20px;
}

.nav-justified > li > a {
border-left: 1px solid #d5d5d5;
line-height: 2px;
}

HTML

<ul class="nav nav-justified" id="tableButtons">    
<li class='active'><a href="#">Text here</a></li>
</ul>

最佳答案

在列表元素上设置边框,在 anchor 标签(不是列表元素)上设置背景颜色和填充,然后为 anchor 标签应用边距。

例如:

ul {
list-style:none;
}

li {
width:250px;
text-align:center;
border-left:1px solid #d5d5d5;
border-right:1px solid #d5d5d5;
}

li a {
color: #8f1b1f;
background-color: #F0F0F0;
text-decoration:none;
padding:10px;
display:block;
margin:0 2px;
}

fiddle :http://jsfiddle.net/RCwE6/2/

关于html - CSS - 边框和背景颜色之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24137499/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com