Supreja
Supreja

Reputation: 7

Css background-image navigation bar

nav {
  padding : 10px 10px 10px 10px;
  background-image : url("This PC/Pictures/motivationportfolio.jpg");
}
li
{
 padding : 10px; 
}
div
{
  text-align : justify;
  margin : 20px;
}
p
{
  text-indent : 15px;
}

This code is not inserting background image to my navigation bar.you can check the entire code in http://codepen.io/Supreja/pen/zKERvd. I have also tried giving the online URL . Even that doesnot work. I am working online ,so how to know my current directory ?

Upvotes: 0

Views: 49

Answers (2)

Yahya Essam
Yahya Essam

Reputation: 1912

well , you need to know where is the path of your image first. for example you have images folder and CSS folder . and this style is in the CSS folder , then the path should be like that ../images/iamgename.jpg

this two dots (..) make you back one step then enter images folder and choose your image

url("../Pictures/motivationportfolio.jpg");

Upvotes: 0

Omri L
Omri L

Reputation: 769

That should work just paste a valid URL:

For instance:

background-image : url('http://www.verypdf.com/wordpress/wp-content/uploads/2011/11/clip_image00455.jpg');

Upvotes: 1

Related Questions