0

.jumbotron {
  margin-bottom: 0px;
  height: 350px;
  color: white;
  text-shadow: black 0.3em 0.3em 0.3em;

  
}
<div class="jumbotron" style="background: url('~/images/hdpic.jpg') no-repeat; background-size:cover">
</div>

My image url is correct but i do't now why it is not working. if any one know please help me. Thanks.

Tetsuya Yamamoto
  • 24,297
  • 8
  • 39
  • 61
Adnan ali
  • 25
  • 6

5 Answers5

1

Check your background image path, I've replaced the image path by another and it works.

Maybe replace the '~' by a relative path like '../'

<div class="jumbotron" style="background: url('https://picsum.photos/200/300') no-repeat; background-size:cover">
</div>

See this fiddle

Vincent G
  • 8,547
  • 1
  • 18
  • 36
0

Try the following code, changed background to background-image,

<div class="jumbotron" style="background-image: url('~/images/hdpic.jpg') no-repeat; 
background-size:cover">
</div>
Hamza Khan
  • 107
  • 1
  • 11
0

Refer to this one. Try using background-image. See below:

.jumbotron {
  margin-bottom: 0px;
  height: 350px;
  color: white;
  text-shadow: black 0.3em 0.3em 0.3em;

  
}
<div class="jumbotron" style="background-image: url('~/images/hdpic.jpg') no-repeat; background-size:cover">
</div>
Rigel1121
  • 2,022
  • 1
  • 17
  • 24
0

Try this

<div class="jumbotron" style="background-image: url('~/images/hdpic.jpg') no-repeat; background-size:cover">
</div>

Use background-image instead of background.

mechnicov
  • 12,025
  • 4
  • 33
  • 56
Jz Lim
  • 1
  • 2
0

The background css logic seems to be fine. Then you should check that the div is being shown has the proper size with the browser's inspector (has it got width...?)

José Antonio Postigo
  • 2,674
  • 24
  • 17