card.html(文件已创建)
| @@ -0,0 +1,51 @@ | |||
| 1 | + | <!DOCTYPE html> | |
| 2 | + | <html lang="de"> | |
| 3 | + | <head> | |
| 4 | + | <meta charset="UTF-8"> | |
| 5 | + | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| 6 | + | <title>Card mit Order</title> | |
| 7 | + | <style> | |
| 8 | + | ||
| 9 | + | * { | |
| 10 | + | margin: 0; | |
| 11 | + | padding: 0; | |
| 12 | + | box-sizing: border-box; | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | img { | |
| 16 | + | max-width: 100%; | |
| 17 | + | height: auto; | |
| 18 | + | } | |
| 19 | + | ||
| 20 | + | .container { | |
| 21 | + | max-width: 1200px; | |
| 22 | + | margin-inline: auto; | |
| 23 | + | width: 100%; | |
| 24 | + | border: 1px solid red; | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | .card { | |
| 28 | + | padding: 1rem; | |
| 29 | + | border: 5px solid black; | |
| 30 | + | width: 400px; | |
| 31 | + | display: flex; | |
| 32 | + | flex-direction: column; | |
| 33 | + | gap: 1rem; | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | .card img { | |
| 37 | + | order: -1; | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | </style> | |
| 41 | + | </head> | |
| 42 | + | <body> | |
| 43 | + | <div class="container"> | |
| 44 | + | <div class="card"> | |
| 45 | + | <h3>Überschrift</h3> | |
| 46 | + | <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Autem animi porro tempora eos. Quia magni placeat asperiores natus optio necessitatibus.</p> | |
| 47 | + | <img src="https://picsum.photos/800" alt=""> | |
| 48 | + | </div> | |
| 49 | + | </div> | |
| 50 | + | </body> | |
| 51 | + | </html> | |
styles.css(文件已创建)
| @@ -0,0 +1,48 @@ | |||
| 1 | + | * { | |
| 2 | + | margin: 0; | |
| 3 | + | padding: 0; | |
| 4 | + | box-sizing: border-box; | |
| 5 | + | } | |
| 6 | + | ||
| 7 | + | body { | |
| 8 | + | min-height: 100vh; | |
| 9 | + | font-family: system-ui; | |
| 10 | + | display: flex; | |
| 11 | + | justify-content: center; | |
| 12 | + | align-items: center; | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | .container { | |
| 16 | + | width: 100%; | |
| 17 | + | max-width: 1200px; | |
| 18 | + | margin-inline: auto; | |
| 19 | + | border: 5px solid black; | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | .flex-container { | |
| 23 | + | display: flex; | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | .box { | |
| 27 | + | background-color: mistyrose; | |
| 28 | + | font-size: 2rem; | |
| 29 | + | color: #777; | |
| 30 | + | text-align: center; | |
| 31 | + | padding: 2rem; | |
| 32 | + | border: 2px solid green; | |
| 33 | + | flex-grow: 1; | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | /* Reihenfolge mit order (Standardwert = 0 */ | |
| 37 | + | ||
| 38 | + | .box1 { | |
| 39 | + | order: 1; | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | .box2 { | |
| 43 | + | order: 5; | |
| 44 | + | } | |
| 45 | + | ||
| 46 | + | .box4 { | |
| 47 | + | order: -1; | |
| 48 | + | } | |
上一页
下一页