Getting my background to appear in the live server

Viewed 52

I cant get my background to open with the live server. I am not sure what I did wrong. I have attached both my index.html sheet and my style.css sheet. All that appears is a grey screen for my background instead of the image. I am going to put login information on top of the background thats why I used linear-gradient.

* {
  margin: 0;
  padding: 0;
}

.hero {
  height: 100%;
  width: 100%;
  background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url(123.jpg);
  background-position: center;
  background-size: cover;
  position: absolute;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Global Automation Timesheet</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="hero">
      <div class="form-box"></div>
    </div>
  </body>
</html>

1 Answers

.hero {
  height: 100%;
  width: 100%;
  background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('images/123.jpg');
  background-position: center;
  background-size: cover;
  position: absolute;
}

Use apostrophes '' in url('123.jpg'). Also be sure, that you correctly wrote image location.

Related