试图在导航链接之间创建漂亮的线条时,当我使用border-right制作上述线条时遇到了一个奇怪的问题:
请注意链接之前的间距。
这是我当前正在使用的HTML和CSS:
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar {
background-color: #000000;
text-align: right;
font-family: "Lucida Console", Monaco, monospace;
padding: 0px 0px 0px 0px;
border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar a {
padding: 20px 0px 20px 0px;
margin: 0px;
text-decoration: none;
color: white;
border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar a:hover {
color: lightgray;
border-bottom: 0px solid white;
border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar a:active {
color: gray;
border-collapse: separate;
border-spacing: 0px 0px;
}
nav {
margin: 0px;
padding: 0px border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar ul {
margin: 0px;
padding: 0px;
border-collapse: separate;
border-spacing: 0px 0px;
}
.topnavbar li {
display: inline;
color: white;
border-collapse: separate;
border-spacing: 0px 0px;
border-right: 1px solid white;
padding: 0px 0px 0px 0px;
margin: 0px;
}
nav li:last-child {
border-right: 1px solid #000;
/* This will not give border to last li element */
}
.logo {
color: white;
float: left;
padding: 12px 20px 0px 20px;
}
.logo h1 {
color: white;
display: block;
font-family: "Lucida Console", Monaco, monospace;
text-align: center;
}
.logo h2 {
color: white;
display: block;
text-align: center;
font-family: "Courier New", Courier, monospace;
}
body {
background-color: #212121;
}
header {
margin: 0px;
}
<body>
<header>
<div class="logo">
<a href="#"></a>
<h1>nullNOVA</h1>
<h2>Vidya Games!</h2>
</div>
<nav class="topnavbar">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Games</a></li>
<li><a href="#">Consoles</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
</header>
<main>
</main>
</body>
如您所见,我尝试添加边框间距0 EVERYWHERE以及填充和边距以尝试解决此问题,但可惜它失败了。
在检查我的浏览器中的元素时,它不会在两个边框之间拾取任何东西,而只是标头本身。
请帮助!