Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

background-color of a div

I want to my project look like this:

enter image description here

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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 :

You can add a few css properties like this:

.flex-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
align-content: center;
background-color:#FFF;
width: 300px;
margin: 0 auto; /* center the div */
border-radius: 15px;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading