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 스타일을 가지고 있습니다 –