How to put a background in html and css?
-
i want to put a picture of the background but not sure how to put it on the css and html lets say my url is soccer.net and image is soccer123.jpeg how would they look on both the html index and css this is what i have tried but i only put it in the css body {background-image:http://socceri.net/('soccer.jpeg');} this is the image i plan to put http://images.search.yahoo.com/images/view;_ylt=A2KJkK1iu5BPlUMAJrKJzbkF;_ylu=X3oDMTBlMTQ4cGxyBHNlYwNzcgRzbGsDaW1n?back=http%3A%2F%2Fimages.search.yahoo.com%2Fsearch%2Fimages%3Fp%3Dcool%2Bbackground%2Bsoccer%26fr%3Dyfp-t-701-1%26fr2%3Dpiv-web%26tab%3Dorganic%26ri%3D502&w=1080&h=864&imgurl=www.soccer-wallpapers.net%2Fsoccer_wallpaper%2Fchelsea_logo_wallpaper_made_by_sam_mirpuri_chelsea.jpg&rurl=http%3A%2F%2Fwww.soccer-wallpapers.net%2Fwallpaper%2Fchelsea_logo_wallpaper_made_by_sam_mirpuri%2C_chelsea%2F1585&size=457.6+KB&name=chelsea+logo+wallpaper+made+by+sam+mirpuri%2C+chelsea+photo&p=cool+background+soccer&oid=c1c82ac4753859d144b62db357aad33b&fr2=piv-web&fr=yfp-t-701-1&tt=chelsea%2Blogo%2Bwallpaper%2Bmade%2Bby%2Bsam%2Bmirpuri%252C%2Bchelsea%2Bphoto&b=481&ni=84&no=502&tab=organic&ts=&sigr=133o2r7t6&sigb=13jttks4r&sigi=131d6tsro&.crumb=tjRHYbah5u6 and on top i will write text thanks
-
Answer:
Background Image Code: For the body tag example: body { width: XXXpx; height: YYYpx; /* optional */ margin: 0 auto; /* centers page */ background: #fff url(image_name.jpg) no-repeat center scroll; } That is the proper CSS code for a non-tiled image where the contents scroll with the background image. Change "#fff" to preferred bg color. Change "scroll" to "fixed" if you want page contents to scroll over bg image. Be sure to set proper width/height to provide minimum page size to display bg image. Put the CSS on an external CSS file. If using embedded CSS, then place CSS between the style tags and place those style tags between the head tags of the page. For a tiled image, change to: body { width: XXpx; height: YYpx; margin: 0 auto; background: #fff url(image_name.jpg) repeat top left scroll; } Put that CSS on an external CSS file if you have more than one page. Put the CSS between the style tags and place them between the head tags if using it on one page. Style another tag other than the body tag if you are using a div wrap container. Should you want the contents of page to scroll over the background image, change "scroll" to "fixed". Inline CSS example: <body style="width: 960px; margin: 0 auto; background: url(image.gif) no-repeat center fixed;"> Inline CSS example: <body style="width: 960px; margin: 0 auto; background: url(image.jpg) no-repeat center scroll;"> Ron
Natalia Foster at Yahoo! Answers Visit the source
Other answers
i suggest to use css external file for easier maintenance. body {background-image:url('http://socceri.net/soccer.jpeg');%7D
nicefx
<body background="example.gif">
Matthew
Related Q & A:
- Is it possible for me to put a background in my group?Best solution by Yahoo! Answers
- How do I put a background on my YouTube?Best solution by Yahoo! Answers
- How do you put a background on a private myspace page?Best solution by Yahoo! Answers
- How do i put a background on GIMP 2.6?Best solution by Yahoo! Answers
- How do you put a background on your youtube video?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.