Thomas
Thomas

Reputation: 34218

CSS image path issue

Hi this way i give my image path in css. it works some time but not all the time.my site may have many sub folder and then the below path may not works. so i want to specify path in my css in such a way where ever i am on my site pages or whatever pages i will looking at but image show display on page. so tell me what trick i should apply in my css for specifying which works same way for all the pages. thanks

.labeltag { 
    background-image: url(../images/arrowbackground.png);
    margin:2px;
    border-radius:5px;
}

Upvotes: 0

Views: 96

Answers (1)

daniel
daniel

Reputation: 1433

Try finding the image from the root of your site instead: .labeltag{background-image:url('/images/arrowbackground.png');}

Assuming 'images' is a folder in your root directory

edit: I understand code can be more readable (regarding the suggested edit), but there is a reason I type it like this - it's better performance.

Upvotes: 2

Related Questions