我希望我的導航background: rgba(0,0,0,.5)
顯示爲全寬。CSS導航 - 高亮顯示全寬
我已將導航重新定位到右側。但是,頂部不透明的黑色背景未顯示在左側。請檢查這是什麼代碼的問題:
body {
font-size: 1em;
font-family: sans-serif;
color: #000000;
margin: 0;
padding: 0;
}
h1 {
margin-bottom: 10px;
}
nav {
background: rgba(0, 0, 0, .5);
}
nav > ul {
float: right;
background: rgba(0, 0, 0, .5);
}
nav ul > li {
display: inline-block;
padding: 10px;
margin: 10px;
}
nav ul li:hover {
background-color: #587058;
}
nav ul li > a {
text-decoration: none;
color: #ffd800;
}
nav ul::after {
content: '';
display: block;
clear: right;
}
header {
height: 500px;
background: url("1.jpg") no-repeat center;
background-size: cover;
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CSS Menus</title>
<link rel="stylesheet" type="text/css" href="assets/menus1.css">
</head>
<body>
<header id="the_header">
<a class="logo" href="#"></a>
<nav id="the_nav">
<ul>
<li><a href="">Home</a>
</li>
<li><a href="">Skills</a>
</li>
<li><a href="" aria-haspopup="true">Projects</a>
</li>
<li><a href="">Contact Me</a>
</li>
</ul>
</nav>
</header>
</body>
</html>
把所有的在一個小提琴,我很樂意幫助你解決它(: –
編輯完成,請幫助 –