Thursday, 12 December 2019

CSS help needed for body?

answers1: Background Image Code: <br>
<br>
For the body tag example: <br>
<br>
body { <br>
width: XXpx; <br>
height: YYpx; <br>
margin: 0 auto; <br>
background: #fff url(image_name.jpg) no-repeat center scroll; <br>
} <br>
<br>
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 as is 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. <br>
<br>
For a tiled image, change to: <br>
<br>
body { <br>
width: XXpx; <br>
height: YYpx; <br>
margin: 0 auto; <br>
background: #fff url(image_name.jpg) repeat top left scroll; <br>
} <br>
<br>
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". <br>
<br>
Inline CSS example: <body style="background: url(homesky.gif)
no-repeat center fixed;"> <br>
<br>
Ron
answers2: body {background-image:url('yourimage.gif');}

No comments:

Post a Comment