Ich habe mich bei selfhtml eingelesen und mein derzeitiges Projekt überarbeitet.
Wenn irgendwas unsauber ist wäre es schön, wenn man mich darauf hinweist damit ich daraus lernen kann.
<!DOCTYPE html>
<html lang="de">
<head>
<title>pp</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" media="all" type="text/css">
<script src="js/menu.js" defer></script>
</head>
<body>
<nav class="navbar">
<div class="brand-title">pp</div>
<a href="#" class="toggle-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
<div class="navbar-links">
<ul>
<li><a href="#">item</a><li>
<li><a href="#">item</a><li>
<li><a href="#">item</a><li>
<li><a href="#">item</a><li>
</ul>
</div>
</nav>
<header>
<h1 class="header_title">p blog</h1>
</header>
<main>
<section class="news">
<h1>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<a class="button_1" href="#">---</a>
</section>
<section class="news">
<h1>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<a class="button_1" href="#">---</a>
</section>
<section class="news">
<h1>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<a class="button_1" href="#">---</a>
</section>
</main>
<footer>
</footer>
</body>
</html>
Alles anzeigen
@import url('https://fonts.googleapis.com/css2?family=Covered+By+Your+Grace&display=swap');
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
background-color: #fafafa;
font: 13px/1.65em "HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;
color: #444;
display: flex;
flex-direction: column;
min-height: 100vh;
}
header footer {
flex: none;
}
header {
background-image: url(images/background.jpg);
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
height: 250px;
opacity: 0.85;
}
.header_title {
font-family: 'Covered By Your Grace', cursive;
line-height: 1.65em;
font-size: 3.125rem;
color: #ffffff;
text-align: center;
padding: 4.813rem;
}
main {
margin: 0 auto;
max-width: 950px;
flex: 1;
}
.news {
margin-top: 50px;
padding: 10px;
background-color: #ffffff;
border: 1px solid #f0f0f0;
border-radius: 2px;
text-align: center;
}
.button_1 {
display: block;
margin: 10px;
padding: 10px;
border: 1px solid #f0f0f0;
border-radius: 2px;
letter-spacing: 4px;
text-align: center;
text-decoration: none;
}
.button_1:hover {
background-color: #fafafa;
}
aside {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.box {
flex-basis: 35%;
margin-top: 50px;
margin-left: 10px;
margin-right: 10px;
background-color: #ffffff;
border: 1px solid #f0f0f0;
padding: 15px;
border-radius: 3px;
}
.break {
flex-basis: 100%;
height: 0;
}
footer {
margin-top: 100px;
background-color: #1a1a1a;
}
/*nav*/
.navbar {
display: flex;
position: relative;
justify-content: space-between;
align-items: center;
background-color: #ffffff;
color: #444;
}
.brand-title {
font-size: 1.5rem;
margin: .7rem;
font-family: 'Covered By Your Grace', cursive;
}
.navbar-links {
height: 100%;
}
.navbar-links ul {
display: flex;
margin: 0;
padding: 0;
}
.navbar-links li {
list-style: none;
}
.navbar-links li a {
display: block;
text-decoration: none;
padding: 1rem;
font-size: 1.125rem;
font-family: 'Covered By Your Grace', cursive;
color: #444;
}
.navbar-links a:hover {
background-color: #1a1a1a;
color: #ffffff;
}
.toggle-button {
position: absolute;
top: .75rem;
right: 1rem;
display: none;
flex-direction: column;
justify-content: space-between;
width: 30px;
height: 21px;
}
.toggle-button .bar {
height: 3px;
width: 100%;
background-color: #444;
}
/*nav*/
/*responsive Elemente*/
@media only screen and (max-width: 800px) {
main {
margin-right: 20px;
margin-left: 20px;
margin-top: 10px;
margin-bottom: 10px;
}
.news {
margin-top: 20px;
}
.navbar {
flex-direction: column;
align-items: flex-start;
}
.toggle-button {
display: flex;
}
.navbar-links {
display: none;
width: 100%;
}
.navbar-links ul {
width: 100%;
flex-direction: column;
}
.navbar-links ul li {
text-align: center;
}
.navbar-links ul li a {
padding: .5rem 1rem;
}
.navbar-links.active {
display: flex;
}
}
/*responsive Elemente*/
/*Schriften,Überschriften&Links*/
h1 {
font: 18px/1.65em "HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;
color: #444;
margin: 10px;
}
a {
font: 13px/1.65em "HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif;
color: #444;
text-decoration: none;
}
/*Schriften,Überschriften&Links*/
Alles anzeigen
Das zweite Problem ist weiterhin vorhanden. Diese zweite Datei ist eine Unterseite. Ich möchte, dass drei Boxen die volle Breite von main ausnutzen und der Rest in die zweite Zeile umbricht. Das funktioniert nicht so richtig.
<!DOCTYPE html>
<html lang="de">
<head>
<title>pp</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" media="all" type="text/css">
<script src="js/menu.js" defer></script>
</head>
<body>
<nav class="navbar">
<div class="brand-title">pp</div>
<a href="#" class="toggle-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
<div class="navbar-links">
<ul>
<li><a href="#">item</a><li>
<li><a href="#">ite</a><li>
<li><a href="#">item</a><li>
<li><a href="#">item</a><li>
</ul>
</div>
</nav>
<header>
<h1 class="header_title">pathos blog</h1>
</header>
<main>
<aside>
<section class="box"></section>
<section class="box"></section>
<section class="box"></section>
<div class="break"></div>
<section class="box"></section>
<section class="box"></section>
<section class="box"></section>
<div class="break"></div>
<section class="box"></section>
<section class="box"></section>
<section class="box"></section>
</aside>
</main>
<footer>
</footer>
</body>
</html>
Alles anzeigen