1
Fork 0

Remove nesting

This commit is contained in:
Hadeed 2024-07-03 19:56:44 +05:00
parent 5d5cc6a6a4
commit d9df9406ef
2 changed files with 111 additions and 113 deletions

View file

@ -15,9 +15,8 @@
<link rel="stylesheet" href="styles.css" /> <link rel="stylesheet" href="styles.css" />
</head> </head>
<body> <body>
<div class="container center"> <main class="card">
<div class="card"> <div class="image-container">
<div class="image center">
<img <img
src="/images/illustration-article.svg" src="/images/illustration-article.svg"
alt="Article illustration" alt="Article illustration"
@ -29,19 +28,23 @@
<p class="date">Published 21 Dec 2023</p> <p class="date">Published 21 Dec 2023</p>
<h1>HTML & CSS foundations</h1> <h1 class="heading">HTML & CSS foundations</h1>
<p class="description"> <p class="description">
These languages are the backbone of every website, defining These languages are the backbone of every website, defining structure,
structure, content, and presentation. content, and presentation.
</p> </p>
</div> </div>
<footer> <div class="author">
<img width="32px" height="32px" src="/images/image-avatar.webp" alt="Author avatar"> <img
width="32px"
height="32px"
src="/images/image-avatar.webp"
alt="Greg Hooper"
/>
<p>Greg Hooper</p> <p>Greg Hooper</p>
</footer>
</div>
</div> </div>
</main>
</body> </body>
</html> </html>

View file

@ -14,23 +14,20 @@
margin: 0; margin: 0;
} }
img, img {
picture,
video,
canvas,
svg {
display: block; display: block;
max-width: 100%; max-width: 100%;
} }
body { body {
background-color: #f4d04e; display: flex;
font-family: "Figtree"; justify-content: center;
} align-items: center;
.container { background-color: #f4d04e;
padding: 24px; padding: 24px;
min-height: 100dvh; min-height: 100dvh;
font-family: "Figtree";
} }
.card { .card {
@ -46,8 +43,13 @@ body {
padding: 24px; padding: 24px;
max-width: 24rem; max-width: 24rem;
}
.image-container {
display: flex;
justify-content: center;
align-items: center;
.image {
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
@ -55,14 +57,15 @@ body {
height: 200px; height: 200px;
object-fit: cover; object-fit: cover;
} }
} }
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: 12px;
}
.learning { .learning {
border-radius: 4px; border-radius: 4px;
background-color: #f4d04e; background-color: #f4d04e;
padding: 4px 12px; padding: 4px 12px;
@ -71,28 +74,28 @@ body {
font-weight: 800; font-weight: 800;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
} }
.date { .date {
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
} }
h1 { .heading {
font-weight: 800; font-weight: 800;
font-size: 24px; font-size: 24px;
line-height: 1.5; line-height: 1.5;
} }
.description { .description {
color: #7f7f7f; color: #7f7f7f;
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
} }
@media screen and (max-width: 576px) { @media (max-width: 576px) {
.learning { .learning {
font-size: 12px; font-size: 12px;
} }
@ -108,10 +111,9 @@ body {
.description { .description {
font-size: 14px; font-size: 14px;
} }
} }
}
footer { .author {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 12px;
@ -121,11 +123,4 @@ body {
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
} }
}
}
.center {
display: flex;
justify-content: center;
align-items: center;
} }