What Is The Html Code For Macking A Picture As The Web Page Background?
Sunday, December 13th, 2009 at
11:20 am
Im using Adobe Dreamweaver cs3 and I want to use a picture as the background. I need to know the code for making this happen? Also, my site is not up yet, but Im in the process of creating it. Please help
Tagged with: Background • Code. • HTML • Macking • Page • Picture • What
Filed under: HTML
Like this post? Subscribe to my RSS feed and get loads more!
Easy. Just modify the body tag a little like so
withReplace
Tom H has given you the correc t answer, but your actual code should look something like this for which ever container tag you are adding the background (bg) image to:
selector_name {
background: #fof url(image path) no-repeat center scroll;
}
selector_name could be the body or some div container with an id or class where you are adding bg image. Change “#fof” to color of choice for bg color while image loads. Change “scroll” to “fixed” if you want contents to scroll over bg image. Change center to some combination of center, top, left, bottom to position image. The above CSS is for an image that does not tile.
For a bg image that tiles, the code should look similar to this:
selector_name {
background: #fof url(image path) repeat top left scroll;
}
Could leave out “repeat” as the default action of browsers is to repeat bg images. Even remove “top left” as browsers will start at that position by default.
Ron
1. Click on the CSS panel, then the icon to add New CSS Rule.
2. For selector type choose Tag.
3. Select body. Choose to define your CSS with the document or an external style sheet. Click OK.
4. In the rule definition window select background
5. Browse to the image you want to use. There are also options for repeat and positioning.
Just make sure u put the something.jpg file in the same folder with your html file.
or u should use:
if the something.jpg is in folder a which is at the same level with your HTML file
Methods using CSS are correct.
are INcorrect – the “background” attribute has been deprecated, along with the link, alink, vlink and text attributes.body {
background-image: url (yourimage.gif);
}
Methods using
body {
background: url(images/your_background_image.jpg);
}
In the program menu, click on Modify>Page Properties and then under Appearance (should be the first thing that comes up) you will see the field to browse for a background image.
open your document, press CTRL +J then click on background image
http://www.w3schools.com/Html/html_backg…