• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

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
0
slickdeals
Asked:
slickdeals
1 Solution
 
RoonaanCommented:
<div style="background:url(image.jpg) no-repeat 50% 50%;">
</div>

-r-
0
 
ThinkPaperIT ConsultantCommented:
another method:

<STYLE type="text/css">
 <!--
 BODY { background-image:url(background.gif);
               background-repeat:no-repeat;
               background-position:center center;
               background-attachment:fixed }
 -->
</STYLE>
0
 
slickdealsAuthor Commented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
RoonaanCommented:
slickdeals, Have you added content to the div, or set a height to it?

-r-
0
 
slickdealsAuthor Commented:
nope I am novice in HTML can u quote me with an example. That will be a great help.
0
 
RoonaanCommented:
Please have a go with this one:

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

Kind regards

-r-
0
 
Jeremy DaleySenior DeveloperCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now