Build a House Painting

Tell us what’s happening:

Hi everyone! I’m building a simple house layout using divs. One of the requirements I’m trying to pass is this:

“Your windows should be placed below your #roof and at least higher than one third of your #door’s height.”

I’m confused about what exactly this means in terms of positioning. Here’s what I understand so far:

My house (#house) is 400px tall.

The roof is 100px tall and is placed at the top (top: 0).

The door is 200px tall and positioned at the bottom of the house.

The windows need to be positioned somewhere between the roof and a certain height above the door, but I’m not sure how to calculate or interpret “one third of your #door’s height” in this context.

How do I figure out the correct top or bottom values for my windows so that they:

Appear below the roof, and

Are higher than one third of the door’s height (but still on the house)?

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="./styles.css" rel="stylesheet">
    <title>House Painting</title>
</head>
<body>
    <div id="house">
        <div id="chimney">
            <div class="smoke"></div>
<div class="smoke"></div>
<div class="smoke"></div>
        </div>
        <div id="roof"></div>
        <div id="window-1"></div>
        <div id="window-2"></div>
        <div id="door">
            <div id="door-knob"></div>
        </div>
    </div>
</body>
</html>
/* file: styles.css */
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(to bottom, #87ceeb 0%, #87ceeb 60%, #228B22 60%, #228B22 100%);
}

#house {
  position: relative;
  width: 500px;
  height: 400px;
  background-color: rgb(255, 244, 244);
  border: 2px rgb(181, 163, 163) solid;
  align-self: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

#chimney {
  width: 80px;
  height: 100px;
  background-color: brown;
  border: 2px solid gray; 
  box-shadow: 2px 2px 5px black;
  z-index: -1;
  overflow: visible;
}

#chimney {
  position: absolute;
  top: -102px;
  left: 300px;
}

.smoke {
  position: absolute;
  bottom: 100%; /* start above the chimney */
  left: 50%;
  width: 20px;
  height: 20px;
  background: rgba(50, 50, 50, 0.7);
  border-radius: 50%;
  animation: puff 4s infinite ease-in-out;
}

.smoke:nth-child(2) {
  animation-delay: 1s;
}
.smoke:nth-child(3) {
  animation-delay: 2s;
}

@keyframes puff {
  0% {
    transform: translateX(0) translateY(0) scale(0.5);
    opacity: 0.6;
  }
  50% {
    transform: translateX(-10px) translateY(-40px) scale(1);
    opacity: 0.4;
  }
  100% {
    transform: translateX(-20px) translateY(-80px) scale(1.5);
    opacity: 0;
  }
}

#roof {
  position: absolute;
  width: 500px;
  height: 100px;
  border: brown;
  background-color: rgb(139, 123, 93);
}

#window-1,
#window-2 {
  position: absolute;
  width: 80px;
  height: 80px;
  border: 1px solid black;
  background-color: rgb(144, 144, 158);
  border-radius: 50%;
}

#window-1 {
  bottom: 180px;
  left: 50px;
}

#window-2 {
  bottom: 180px;
  left: 200px;
}

#door {
  position: absolute;
  bottom: 0;
  left:350px;
  width: 100px;
  height: 250px;
  background-color: red;
  border: 1px solid black;
}

#door-knob {
  position: absolute;
  top: 120px;
  left: 70px;
  width: 20px;;
  height: 20px;
  background-color: black;
  border-radius: 90%;
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Challenge Information:

Build a House Painting - Build a House Painting

check this out: change the size of the preview, specifically the height, if you reduce the height the windows go above the roof

why are you using flexbox?

Hi , fella.
You need to do a math between the door and the roof, so the distance of the windows is one third higher. Reduce the height of the door.