...

View Full Version : CSS - background-image external



adamwestrop
08-13-2011, 01:16 PM
Hi,

I am getting to grips with CSS and am experimenting with it without getting hosting and using FTP, then using notepad and validating software, then viewing the changes in my browser.

Obviously I'd like to make use of the background-image value quite a bit for my various <div> sections, however am OK with using external images to play around...The thing is, how do I reference external in CSS??

I understand I use:-

background-image:url (anexample.jpg);

For internal (do I need quotations around 'anexample.jpg' above?)

How do I modify this so I can play around with external images please?

Thanks

bullant
08-13-2011, 01:30 PM
How do I modify this so I can play around with external images please?

try specifying the full pathname to the external image starting with http://..........

vikram1vicky
08-13-2011, 01:47 PM
Use absolute path in case your are using images from Internet :like


.yourclass {
background:URL('http://www.abcwebsite/images/yourimage.png');
}

Use relative path for the images placed on same server/folder from where your site is hosted. Like


.yourclass {
background:URL('images/yourimage.png');
}

VIPStephan
08-13-2011, 01:53 PM
try specifying the full pathname to the external image starting with http://..........

For example: background: url(http://example.com/images/anexample.jpg);

Be aware, however, to not use images from other sources without asking the owner as image hotlinking is frowned upon.

bullant
08-13-2011, 03:17 PM
Be aware, however, to not use images from other sources without asking the owner as image hotlinking is frowned upon.

yep, and not to mention that if the owner finds out their images are being hot-linked, they could replace those images with images you normally wouldn't want displayed on the website doing the hot-linking to external images :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum