space-between не работает
body {
background-color: #fff;
color: #333;
margin: 0;
font: 1.2em / 1.2 Arial, Helvetica, sans-serif;
}
img {
max-width: 100%;
display: block;
}
.logo {
font-size: 200%;
padding: 50px 20px;
margin: 0 auto;
max-width: 980px;
}
.grid {
display: grid;
margin: 0 auto;
padding: 0 20px;
max-width: 980px;
grid-template-columns: 3fr 1fr;
grid-gap: 20px
}
nav{
display: flex;
background-color: #000;
padding: .5em;
justify-content: space-between;
position: fixed;
width: 100%;
top: 110px;
}
nav ul {
display: flex;
margin: 0;
padding: 0;
list-style: none;
}
nav a {
color: #fff;
text-decoration: none;
padding: .5em 1em;
}
.photos {
display: grid;
list-style: none;
margin: 0;
padding: 0;
flex-wrap: wrap;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
grid-gap: 1px;
}
.feature {
width: 200px;
float: left;
margin-right: 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My page</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="logo">
My exciting website!
</div>
<nav>
<ul>
<li>
<a href="">Home</a>
</li>
<li>
<a href="">Blog</a>
</li>
<li>
<a href="">About us</a>
</li>
<li>
<a href="">Our history</a>
</li>
<li>
<a href="">Contacts</a>
</li>
</ul>
</nav>
<main class="grid">
<article>
<h1>
An Exciting Blog Post
</h1>
<img src="maketIMG/balloon-sq6.jpg" alt="placeholder" class="feature">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon
azuki bean garlic.</p>
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens
dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>
<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon
napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach carrot soko.
Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin onion chickpea gram
corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot carrot watercress.
Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea prairie
turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane fennel azuki
bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p>
<p>Celery quandong swiss chard chicory earthnut pea potato. Salsify taro catsear garlic gram celery bitterleaf wattle
seed collard greens nori. Grape wattle seed kombu beetroot horseradish carrot squash brussels sprout chard.</p>
</article>
<aside>
<h2>
Photography
</h2>
<ul class="photos">
<li>
<img src="maketIMG/balloon-sq1.jpg" alt="placeholder">
</li>
<li>
<img src="maketIMG/balloon-sq2.jpg" alt="placeholder">
</li>
<li>
<img src="maketIMG/balloon-sq3.jpg" alt="placeholder">
</li>
<li>
<img src="maketIMG/balloon-sq4.jpg" alt="placeholder">
</li>
<li>
<img src="maketIMG/balloon-sq5.jpg" alt="placeholder">
</li>
</ul>
</aside>
</main>
</body>
</html>
Не работает space-between, я хочу чтобы он распределил элементы navbar по всему контейнеру.
Ответы (1 шт):
Автор решения: budaPest
→ Ссылка
он и не будет работать, потому что в в теге nav всего один элемент, вам нужно применить на <ul> потому что все элементы в нем
nav ul {
display: flex;
justify-content: space-between;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}