Um diesen Tread mal abzuschließen am Ende eine Frage.
so sieht es jetzt mit euerer Hilfe aus. (das eine oder andere Licht ist aufgeleuchtet)
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<script type="text/javascript" src="js/script.js"></script>
<title>new Beginning</title>
</head>
<body>
<nav id="menu">
<div id="brand">Michael Schlegel</div>
<button type="button">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#about">Aboutme</a></li>
<li><a href="#">Kulinarisches</a></li>
<li><a href="#">Galerie</a></li>
<li><a href="#">Datenschutz</a></li>
</ul>
</nav>
<header>
<img src="img/kasper.png">
</header>
<main>
<section>
<div id="about">
<h2>Übermich</h2>
<div class="about-text">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing
elit. Doloremque repellendus recusandae doloribus repudiandae minima est
nam reiciendis cum eligendi inventore! Eius hic fugit nostrum
laudantium, corporis voluptatum nihil ipsam esse?</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Illo, numquam? Aspernatur tempore earum soluta adipisci sit
eveniet, iusto non saepe, optio dolor deserunt quidem molestias sunt
facilis molestiae? Itaque, asperiores.</p>
</div>
</div>
</section>
<section id="kuli">Kulinarisches</section>
</main>
<footer class="footer">Footer</footer>
</body>
</html>
Alles anzeigen
*
{
margin: 0;
padding: 0;
}
html, body
{
height: 100%;
background-color: blue;
}
#brand
{
margin: 20px;
font-size: 1.2em;
font-weight: bold;
color: aqua;
align-self: center;
}
#menu
{
position: absolute;
width: 100%;
height: 80px;
display: flex;
justify-content: space-between;
align-items: flex-end;
background-color: rgb(56,54,54);
color: white;
}
#menu>ul
{
display: flex;
background-color: rgb(56,54,54);
}
#menu>ul>li
{
padding: 30px;
list-style: none;
border-bottom: 4px solid transparent;
}
#menu>ul>li:hover
{
border-color: purple;
}
#menu>ul>li>a
{
text-decoration: none;
font-size: 1em;
font-family: sans-serif;
color: white;
}
#menu>button
{
position: absolute;
top: 25px;
right: 25px;
display: none;
justify-content: space-between;
width: 30px;
height: 23px;
background: none;
border: none;
cursor: pointer;
}
#menu>button>span
{
height: 4px;
width: 100%;
background-color: white;
border-radius: 2px;
}
body>header
{
height: calc(100vh - 80px);
padding-top: 80px;
display: flex;
align-items: center;
justify-content:flex-end;
background-color: black;
}
body>header>img
{
min-width: 200px;
max-height: 90%;
}
#about
{
height: 100vh;
background-color:white;
width: 100%;
}
h2
{
font-family: Arial, Helvetica, sans-serif;
text-align: center;
text-decoration: underline;
padding-top: 2rem;
margin-bottom: 2rem;
}
.about-text
{
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold ;
color: rgba(75, 72, 72, 0.912);
width: 70%;
margin:auto;
}
#kuli
{
height: 500px;
display: flex;
background-color: chocolate;
}
.footer
{
height: 80px;
background-color: rgb(56, 54, 54);
}
@media(max-width: 750px)
{
#menu
{
flex-direction: column;
}
#menu>ul
{
display: none;
flex-direction: column;
width: 100%;
}
#menu>ul.active
{
display: flex;
}
#menu>ul>li
{
text-align: center;
}
#menu>ul>li:hover
{
border-color: purple;
width: auto;
align-self: center;
}
#menu>button
{
display: flex;
flex-direction: column;
}
body>header
{
justify-content: center;
}
body>header>img
{
max-height: 80%;
}
}
Alles anzeigen
Wann nutze ich id's und wann class?
Ich verstehe es jetzt so.
Für eine Section, ein einzelnes sich nicht wiederholendes Element. Etwas das nur einmal vorkommt, verwendet man "id" .
Innerhalb der "id" verwendet man zb id="top" dann #top>ul>li und #top>ul>li>hover.
Eine class wird einmal definiert und greift wo sie im HTML angesprochen wird.
Doch wieso musste ich in der section about ".about-text" als klasse angeben?