-2

This is my super simple code and the background color isn't changing for some reason. I know that the external CSS is linked correctly because the text color of h1 is changing.

<!DOCTYPE html>
<html>
<head>
<title>random</title>
    <link rel="stylesheet" href="randomnezs style.css">
<style>


body{
    background-color: black !important;
}
h1 {
    color: red;
}
<style>
</head>
</html>
Temani Afif
  • 211,628
  • 17
  • 234
  • 311

1 Answers1

0

Because your body height is 0, you can set some height for it.

body{
    background-color: black !important;
    height: 10px;
}

<!DOCTYPE html>
<html>
<head>
<title>random</title>
    <link rel="stylesheet" href="randomnezs style.css">
<style>


body{
    background-color: black !important;
    height: 10px;
}
h1 {
    color: red;
}
<style>
</head>
</html>
Hien Nguyen
  • 23,011
  • 7
  • 48
  • 55