Reputation: 10084
When you use a background image and set the src are you making that the src from the css file the path or the source from the file that the background image will actually be active in ?
Upvotes: 0
Views: 253
Reputation: 92913
Links in a CSS file are always relative to the location of that CSS file. This is desirable, since the CSS may be linked from any subdirectory or even from a different server.
Upvotes: 0
Reputation: 1437
The src
attribute in HTML is relative to the rendered document. If you had a file /index.html
and the img you wanted to inlude was at /img/1.png
, the attribute would read src="img/1.png"
.
Likewise, the url
attribute in CSS is relative to the CSS document. If your CSS file was at /css/styles.css
the attribute would read background:url('../img/1.png')
.
Upvotes: 1