html中如何让li之间有空格,在元素之间添加空格 您所在的位置:网站首页 如何在html中添加空格呢 html中如何让li之间有空格,在元素之间添加空格

html中如何让li之间有空格,在元素之间添加空格

2024-06-29 17:12| 来源: 网络整理| 查看: 265

我有一个导航菜单,我似乎无法在

元素之间添加一个空格(margin: 3px;)。

您可以在jsfiddle或更低版本上看到HTML和CSS代码。

您会看到我已经将border-bottom: 2px solid #fff;添加到#access li以模拟元素之间的空间,但这不起作用,因为在导航菜单下我将会有一堆不同的颜色。如果我添加margin-button: 2px,它不起作用。

这是HTML:

About Us

Services

Environmental Surface Cleaning

Regulations

Contact Us

这是CSS:

#access {

background: #0f84e8; /* Show a solid color for older browsers */

display: block;

margin: 0 auto 6px 55px;

position: absolute;

top: 100px;

z-index: 9999;

}

#access ul {

font-size: 13px;

list-style: none;

margin: 0 0 0 -0.8125em;

padding-left: 0;

}

#access li {

position: relative;

padding-left: 11px;

}

#access a {

border-bottom: 2px solid #fff;

color: #eee;

display: block;

line-height: 3.333em;

padding: 0 10px 0 20px;

text-decoration: none;

}

#access li:hover > a,

#access ul ul :hover > a,

#access a:focus {

background: #efefef;

}

#access li:hover > a,

#access a:focus {

background: #f9f9f9; /* Show a solid color for older browsers */

background: -moz-linear-gradient(#f9f9f9, #e5e5e5);

background: -o-linear-gradient(#f9f9f9, #e5e5e5);

background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9f9f9), to(#e5e5e5)); /* Older webkit syntax */

background: -webkit-linear-gradient(#f9f9f9, #e5e5e5);

color: #373737;

}

#access ul li:hover > ul {

display: block;

}



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有