Hi there,
I’ve faced this problem and can’t figure out what’s wrong:
I have this code in FreeCodeCamp online:
HTML part:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Picasso Painting</title>
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
</head>
<body>
<div id="back-wall"></div>
</body>
</html>
CSS part:
body {
background-color: rgb(184, 132, 46);
}
#back-wall {
background-color: #8B4513;
width: 100%;
height: 60%;
}
This results in this:
This is the correct outcome
When I type the same code in VS Code it does not apply the #back-wall selector style and results in just showing the styled body
However, if i put width and height for #back-wall in vw instead of % it would work
Why is that and how to fix it?
Best regards
P.S., once I’ve applied:
position: absolute;
top: 0;
left:0;
it would work and show #back-wall div.
Anyway, I’d like to hear why it hadn’t work before that))