Link to home
Start Free TrialLog in
Avatar of slickdeals
slickdeals

asked on

setting an image as a background and putting it on the center of the web page?

Hi,

I am trying to create webpage where I just have an image which should be on the background. It should be in the center of the page and below that image I want to say we are coming soon.

It is possible. I want to do it thru div tag.

Thanx in advance,

slick
Avatar of Roonaan
Roonaan
Flag of Netherlands image

<div style="background:url(image.jpg) no-repeat 50% 50%;">
</div>

-r-
another method:

<STYLE type="text/css">
 <!--
 BODY { background-image:url(background.gif);
               background-repeat:no-repeat;
               background-position:center center;
               background-attachment:fixed }
 -->
</STYLE>
Avatar of slickdeals
slickdeals

ASKER

roonaan the div tag did not work.


ThinkPaper the style of the body works but then how do I control the size of the image.

Thanx in advance.
slickdeals, Have you added content to the div, or set a height to it?

-r-
nope I am novice in HTML can u quote me with an example. That will be a great help.
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you could just place something like a "non-breaking space" to the <div> or even a 1x1 transparent gif.

non-breaking space = <div>&nbsp;</div>

the <div> won't expand to its specified css dimensions if nothing is contained within it.