我的悬停效果不完全与导航栏对齐。事实上,它们稍宽一些,我想解决这个问题。我尝试了一些东西,但没有成功。更改悬停效果的高度
这是怎么看起来像现在:
代码:
body {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('img/tape-measure.jpg');
background-size: cover;
height: 1000px;
color: #000305;
font-size: 100%;
font-family: 'Coming Soon', 'Lucida Sans Unicode', cursive;
line-height: 1.5;
}
a {
text-decoration: none;
}
a:link, a:visited {
color: #CF5C3F;
}
a:hover, a:active {
background-color: #CF5C3F;
color: #fff;
}
.mainHeader {
width: 90%;
margin: 0 auto;
}
.mainHeader img.Logo {
position: absolute;
right: 5%;
top: 54%;
width: 15%;
height: auto;
}
.mainHeader img.Margrit {
position: absolute;
right: 5%;
top: 15%;
width: 15%;
height: auto;
}
.mainHeader nav {
background-color: #9cb34f;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.mainHeader nav ul {
list-style: none;
overflow: auto;
}
.mainHeader nav ul li {
text-align: center;
float: left;
width: 24%;
}
.mainHeader nav a:link, .mainHeader nav a:visited {
color: #fff;
background-color: #CF5C3F;
}
.mainHeader nav a:hover, mainHeader nav .active a:visited {
background-color: #CF5C3F;
text-shadow: none;
}
.mainHeader nav ul li a {
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
display: inline-block;
height: 30px;
padding: 10px 130px;
}
.mainHeader p {
}
.mainHeader p.inBearbeitung {
position: absolute;
top: 45%;
left: 5%;
font-size: 150%;
color: #CF5C3F;
font-size: 200%;
}
.mainFooter {
position: absolute;
bottom: 3%;
width: 90%;
left: 5%;
right: 5%;
height: 30px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background-color: #9cb34f;
\t display: table;
}
.mainFooter p {
color: #fff;
display: table-cell;
vertical-align: middle;
padding-left: 1%;
}
<!DOCTYPE html>
<html lang="de">
<head>
\t \t <title>Couture Anni</title>
\t \t <meta charset="utf-8">
\t \t
<link rel="stylesheet" type="text/css" href="resources/css/style.css">
<link href="https://fonts.googleapis.com/css?family=Coming+Soon" rel="stylesheet">
\t \t <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
\t \t <header class="mainHeader">
\t \t \t <img class="Logo" src="resources/img/Content%5Cvariation_800_e.png" alt="Logo">
\t \t \t <img class="Margrit" src="resources/img/IMG_5347_small.jpg" alt="Annamaria Hofstetter">
\t \t \t
\t \t \t <nav>
\t \t \t \t
\t \t \t \t <ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Kontakt</a></li>
</ul>
\t \t \t \t
\t \t </nav>
\t \t \t
\t \t \t
\t \t \t <p class="inBearbeitung"><strong>Diese Seite ist in<br>Bearbeitung.<br> Bis demnächst!</strong></p>
\t \t </header>
\t \t
\t \t
<footer class="mainFooter">
\t \t \t
\t \t <p>Copyright © <a href="#" title="couture-anni">couture-anni.ch</a></p>
\t \t \t
\t \t </footer>
</body>
</html>
当前问题:
的文本无法在导航栏的中间,间距是错误的悬停效果
东西是不正确的,你可以在我上面添加的图片中看到。 我也编辑了代码。这个问题在最新的图片 – Arborem