-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
  • 245,468
  • 26
  • 309
  • 415

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
  • 24,551
  • 7
  • 52
  • 62