-1

I am following a tutorial from YouTube. There I followed the same procedure. I checked it several times. But the video's authors background color shows up and mine doesn't. I have tried overflow, clear etc but it doesn't work. People with big brains I need help?

here is the css code:

*{
       
        margin: 0;
        padding: 0;
        font-family: sans-serif;
}

.container{

             width: 100%;
             height: 100%;
             background: #42455a;
}

And here is the html code:

<!DOCTYPE html>
<html>
<head>
    <title>Crypto Currency Web App - Easy Tutorials</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="container">
       
    </div>
</body>
</html>

Edit: problem resolved. The solution was to specify the html and body height

like


              height:100%;
              padding:0;
              margin: 0;
}```

2 Answers2

0
<!DOCTYPE html>
<html>
<head>
    <title>Crypto Currency Web App - Easy Tutorials</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="container">
        <p> just write something to here your width and height percent not fixed size </p>
       
    </div>
</body>
</html>

if you want to see the container then your CSS should be following:

.container{

             width: 100px;
             height: 100px;
             background: #42455a;
}

100 px is a just example you can enter what you want

Yusuf Şengün
  • 284
  • 3
  • 13
0

body{       
        margin: 0;
        padding: 0;
        font-family: sans-serif;
}

.container{

             width: 100%;
             height: 100%;
             background: #42455a;min-height:145px;
             color:#fff;padding: 15px;
}
<!DOCTYPE html>
<html>
<head>
    <title>Crypto Currency Web App - Easy Tutorials</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="container">
        You need to insert some content or add some CSS like min-height to empty div to show background color
       
    </div>
</body>
</html>
Onkar
  • 2,409
  • 2
  • 11
  • 14