Было несколько вещей, которые вам нужно изменить, поэтому я сделал от вашего имени:
Для правильного выравнивания просмотрите его на полной странице.
Наблюдения:
Вам не нужно объявлять код следующим образом:
ul {
li {
display: inline-block;
margin-right: 60px;
}
}
Это должно быть примерно так:
ul li {
display: inline-block;
margin-right: 60px;
}
Причина, по которой это было в 2 строки, потому что размер h1
и ширина бара nav
были переполнены, поэтому вам нужно увеличить width
h1
.
Я также вижу, что неправильно comments
используется в CSS файле, используйте правильный, в идеале вы должны использовать что-то вроде этого /* .... */
* {
margin: 0;
padding: 0;
}
header {
background-color: #F4C724;
color: white;
text-transform: uppercase;
width: 100%;
}
h2 {
color: white;
}
body {
background-image: url("../img/growing.jpeg");
background-repeat: no-repeat;
background-size: cover;
}
ul li {
display: inline-block;
margin-right: 60px;
}
nav {
float: right;
vertical-align: middle;
}
#leftContent {
width: 60%;
}
h1 {
font-family: 'Teko', sans-serif;
color: white;
border-style: solid;
text-align: center;
}
span {
color: #218c74;
}
.nav-link {
text-decoration: none;
color: #218c74;
font-weight: bolder;
font-size: 12px;
&:hover {
color: white;
}
}
.hero {
text-align: center;
width: 50%;
color: white;
p {
text-align: justify;
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Permanent+Marker&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta http-equiv="refresh" content="">
<title>Grow Plants</title>
</head>
<body>
<header>
<div id="leftContent">
<h1>How to <span>Grow Plants</span></h1>
</div>
<nav>
<ul>
<li class="navbutton"><a class="nav-link" href="html/seedling.html">Seedling</a></li>
<li class="navbutton"><a class="nav-link" href="html/germination.html">Germination</a></li>
<li class="navbutton"><a class="nav-link" href="html/vegetative.html">Vegetative</a></li>
<li class="navbutton"><a class="nav-link" href="html/flowering.html">flowering</a></li>
<li class="navbutton"><a class="nav-link" href="html/about.html">About</a></li>
</ul>
</nav>
</header>
<section class="hero">
<h2>Every Man Falls in Love with Mary Jane</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</section>
</body>
</html>