Responsive Design
This commit is contained in:
43
Week-02/Day_03/index.html
Normal file
43
Week-02/Day_03/index.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Responsive Task - Week 2 - Day 3</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<header>
|
||||||
|
<h1>Responsive News</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Home</a></li>
|
||||||
|
<li><a href="#">Articles</a></li>
|
||||||
|
<li><a href="#">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="grid">
|
||||||
|
<article class="card">
|
||||||
|
<img src="https://via.placeholder.com/400x200" alt="Sample">
|
||||||
|
<h2>Article 1</h2>
|
||||||
|
<p>This layout uses CSS Grid to stay organized on desktop.</p>
|
||||||
|
</article>
|
||||||
|
<article class="card">
|
||||||
|
<img src="https://via.placeholder.com/400x200" alt="Sample">
|
||||||
|
<h2>Article 2</h2>
|
||||||
|
<p>On mobile, these cards will stack one on top of the other.</p>
|
||||||
|
</article>
|
||||||
|
<article class="card">
|
||||||
|
<img src="https://via.placeholder.com/400x200" alt="Sample">
|
||||||
|
<h2>Article 3</h2>
|
||||||
|
<p>Responsive design makes the web accessible to everyone.</p>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
53
Week-02/Day_03/style.css
Normal file
53
Week-02/Day_03/style.css
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul {
|
||||||
|
display: flex;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
gap: 20px;
|
||||||
|
background: #1a08e9;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
nav a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: 2px solid #271e1e;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul {
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user