'background-color of a div
I want to my project look like this:
But i can't get the background div to turn white or get the content to fit exactly like in the image i've uploaded. My project is currently like this:
enter image description here How do I make that background white colored div ? I really need help. I'm stuck.
this is the code:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" type="text/css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bigelow+Rules&family=Outfit:wght@100&display=swap" rel="stylesheet">
<title>Qr Code</title>
</head>
<body>
<br>
<br>
<br>
<div class="flex-container">
<div class="flex-items">
<div class="flex-container2">
<div class="flex-items2">
<img src="./images/resize-16462332111065516967imageqrcode.png">
</div>
<h1>Improve your front-end<br>skills by building projects</h1>
<p>Scan the Qr Code to visite Frontend<br>Mentor and take your coding skills to<br>the next level</p>
</div>
</div>
</div>
</body>
</html>
CSS:
body{
background-color: hsl(212, 45%, 89%);
font-family: 'Bigelow Rules', cursive;
font-family: 'Outfit', sans-serif;
}
.flex-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
align-content: center;
background-color: hsl(212, 45%, 89%);
}
.flex-items:nth-child(1) {
display: block;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
align-self: auto;
order: 0;
}
.flex-container2 {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
align-content: center;
}
.flex-items2:nth-child(1) {
display: block;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
align-self: auto;
order: 0;
}
img{
border-radius: 10px 10px 10px 10px;
}
h1{
font-weight: 700;
}
p{
font-weight: 400;
}
Solution 1:[1]
I added to .flex-container2 this properties:
text-align:center;
background-color:#fff;
border-radius:20px;
padding:15px;
height:430px;
Also for h1 tag in css:
font-size:21px;
for p tag in css:
font-size:15px;
Finally image size is:
width:250px;
height:250px;
And looks like this:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

