<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<main>
<section>
<aside class="card one">
<div>
<img src="https://user-images.githubusercontent.com/78242022/297184236-b744205c-36be-4162-a1d9-e390102dd462.jpg" alt="">
</div>
<p>using the img tag</p>
</aside>
<aside class="card two">
<div>
<!-- we are using the background-image property to import image -->
</div>
<p>using the background-image property</p>
</aside>
</section>
</main>
</body>
</html>
*, *::after, *::before {
padding: 0;
margin: 0;
box-sizing: border-box;
}
main {
width: 100vw;
height: 100svh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
section {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
}
.card {
width: 300px;
height: 300px;
}
img {
width: 100%;
}
div {
border: 2px solid #8d8989;
width: 100%;
}
.card.two div {
height: 300px;
width: 300px;
background-image: url("https://user-images.githubusercontent.com/78242022/297184236-b744205c-36be-4162-a1d9-e390102dd462.jpg");
background-repeat: no-repeat;
background-size: 200px 100px;
background-position: center;
}
p {
font-family: calibri;
font-size: 18px;
color: #8d8989;
}
@media screen and (max-width: 650px) {
section {
margin-top: 2em;
flex-direction: column;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.