ナビゲーションバーを作成して、https://www.w3schools.com/css/tryit.asp?filename=trycss_navbar_vertical_grayをフォローしようとしています。 ナビゲーションバーが期待どおりに機能していません。リストオブジェクトの上にマウスを置くと、ブロック全体ではなく、テキストと小さな背景の色しか表示されません。ブロック全体の色をどのように変更するのですか?HTMLリストのオブジェクトスタイリングはブロック全体には適用されません
のindex.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="default.css">
<title>My Dashboard</title>
</head>
<body>
<!--Navigation Bar-->
<ul id="navbar">
<li><a href="index.html">Home</a></li>
<li><a href="weather.html">Weather</a></li>
<li><a href="time.html">World Time</a></li>
<li><a href="help.html">Help</a></li>
</ul>
<!--Navigation Bar End-->
</body>
</html>
default.css:
/*Importing Fonts*/
@import url('https://fonts.googleapis.com/css?family=Raleway:400,700,900');
/*Finish Import*/
#navbar{
font-family: "Raleway SemiBold", serif;
list-style-type: none;
margin: 0;
padding: 0;
width: 200px;
background-color: #13006e;
display: block;
}
#navbar li {
color: white;
display: block;
padding: 8px 16px;
text-decoration: none;
}
#navbar li a:hover{
color:white;
background-color: #008000;
}
ありがとう! Neeron。
の例のように – iSZ