Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-13-2011, 12:16 PM   PM User | #1
adamwestrop
New Coder

 
Join Date: Aug 2011
Posts: 58
Thanks: 31
Thanked 0 Times in 0 Posts
adamwestrop is an unknown quantity at this point
CSS - background-image external

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
adamwestrop is offline   Reply With Quote
Old 08-13-2011, 12:30 PM   PM User | #2
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Quote:
Originally Posted by adamwestrop View Post
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://..........
bullant is offline   Reply With Quote
Users who have thanked bullant for this post:
adamwestrop (08-13-2011)
Old 08-13-2011, 12:47 PM   PM User | #3
vikram1vicky
Regular Coder

 
Join Date: Jul 2011
Location: India
Posts: 496
Thanks: 3
Thanked 57 Times in 56 Posts
vikram1vicky is an unknown quantity at this point
Use absolute path in case your are using images from Internet :like

Code:
.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

Code:
.yourclass {
background:URL('images/yourimage.png');
}
vikram1vicky is offline   Reply With Quote
Users who have thanked vikram1vicky for this post:
adamwestrop (08-13-2011)
Old 08-13-2011, 12:53 PM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,615
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Quote:
Originally Posted by bullant View Post
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.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Users who have thanked VIPStephan for this post:
adamwestrop (08-13-2011)
Old 08-13-2011, 02:17 PM   PM User | #5
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Quote:
Originally Posted by VIPStephan View Post
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
bullant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:04 AM.


Advertisement
Log in to turn off these ads.