Datum
Datum

Reputation: 121

background-image :url(); not working

html:

<div id="banner">
  <h1>My Page</h1>
  <p>This is the important line everyone reads..</p>
  <a href="#">Enroll</a>
</div>

css:

#banner{
  background-image: url('https://usplash.it/1000/600/?random');/*problem is here*/
  padding: 150px 0;
  text-align: center;
  background-size:cover;
  color: white;
}

background-image: url('https://usplash.it/1000/600/?random')

This is not displaying any image . Not only for this link but for all other links.

Only if the image is downloaded and the path is given there as a link, then it is working.

Upvotes: 1

Views: 1460

Answers (1)

RizkiDPrast
RizkiDPrast

Reputation: 1725

seems like your link down is the cause. this one work

#banner {
  background-image: url(http://lorempixel.com/400/200);
  padding: 150px 0;
  text-align: center;
  background-size: cover;
  color: white;
}
<div id="banner">
  <h1>My Page</h1>
  <p>This is the important line everyone reads..</p>
  <a href="#">Enroll</a>
</div>

Upvotes: 1

Related Questions