私はHTMLのナビゲーションバーを作成する必要がある学校プロジェクトをやっています& CSS。私は以下のコードを持っていますが、それが欲しいほど反応しません。HTMLとCSSのナビゲーションバーのエラー
私は画面を小さくすると、テキストが近くになる。 p
クラスの間に固定スペースを追加する方法や、別の方法でこの問題を解決する方法はありますか?
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Header</title> <!-- This is the page title -->
<link href="style.css" rel="stylesheet" type="text/css"> <!-- This adds the stylesheet so that "style.css" can edit this page -->
<meta content="Hugh Chalmers" name="author">
</head>
<body>
<div class="header"> <!-- This will be the Navigation Bar part of the page. Currently, it is invisible, but the CSS will change that. -->
<p class="text" id="home">Home</p>
<p class="text" id="about">About Us</p>
<p class="text" id="contact">Contact Us</p>
<p class="text" id="products">Products</p>
<p class="text" id="forums">Forums</p>
</div>
</body>
</html>
はCSS:
.header {
position: absolute;
width: 100%;
height: 10%;
left: 0;
top: 0;
background-color: red;
}
.text {
font-family: font-family: 'PT Sans',sans-serif;
font-size: 30px;
font-weight: 700;
color: #fff;
position: absolute;
}
#home {
position: absolute;
left: 5%;
}
#about {
position: absolute;
left: 15%;
}
#contact {
position: absolute;
left: 27%;
}
#products {
position: absolute;
left: 40%;
}
#forums {
position: absolute;
left: 53%;
}
です絶対的な位置付けの_awful_多くはあなたのページが成長するにつれて維持する本当のクマになります。私は確かにいくつかのより穏やかなルールに従ってページがあなたのコンテンツを自然に流すことができる何かより少ないマニュアルを行うことを検討することをお勧めします。 –
あなたは本当に面倒なCSSスタイルを持っています –