Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
setting an image into the background
Old 06-22-2010, 10:29 PM setting an image into the background
Junior Talker

Posts: 1
Trades: 0
I want to learn how to set an image into the background so I can place text or other html over the top of it - can anyone help me with this?

Last edited by chrishirst; 06-23-2010 at 10:41 AM..
heidrek is offline
Reply With Quote
View Public Profile Visit heidrek's homepage!
 
 
Register now for full access!
Old 06-23-2010, 03:23 AM Re: setting an image into the background
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
You would be best to use CSS.

You can apply the image to your body tag like so:

Code:
body {
     background #fff url('/path/to/image.jpg') no-repeat 50% 0;
}
You can either put this is a CSS file and include it into your HTML file:

HTML Code:
<link href="style.css" rel="stylesheet" type="text/css">
or place it withing <style type="text/css"></style> tags in your head section:

HTML Code:
<style type="text/css">
body {
     background #fff url('/path/to/image.jpg') no-repeat 50% 0;
}
</style>
This is the full declaration for the background property, if you would rather keep it to "standard" and not shorthand you will need to apply each part seperatly:

Code:
body {
     background-color: #fff;
     background-image: url('/path/to/image.jpg');
     background-position: 50% 0;
     background-repeat: no-repeat;
}
As you can see, the best method is the shorter one.
__________________

Please login or register to view this content. Registration is FREE

Learn professional skills from professional people, from $6.50 a month.
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 06-23-2010, 04:34 AM Re: setting an image into the background
stevecane's Avatar
Skilled Talker

Posts: 64
Name: Steve Q
Location: Newcastle UK
Trades: 0
Just to add that you can also apply the above CSS to any div in your code.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
stevecane is offline
Reply With Quote
View Public Profile Visit stevecane's homepage!
 
Old 06-23-2010, 10:39 AM Re: setting an image into the background
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.w3schools.com/css/pr_background-image.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to setting an image into the background
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16730 seconds with 12 queries