Background Rectangular Shape
In my html page I have put a background image. Now I need a simple rectangular box, where I will put in my rest of the html stuff.
I need it something like the example webpage shown here. I am somehow able to put the background image, but I don't know how to create the white backgrounded space where rest of the html stuff is there
example is here http://www.foxtab.com/1.3/d/
can anyone help me say how to put this rectangular shape on top of my background image.
If you look at the source code and styling of that site you will notice that the background image is applied to the <body> and the "White Box" is just a <div> placed inside of the <body> as a child element. Here is an ultra simplified example I just made:
<title>Background Image eg</title>
margin: 0px auto;
I am a big white box on top of a background image.
hey it works,
A big thanks from my part!!!
hey!! In the container tag, I had put height as 1000px, but in that case the background image duplicates(I mean second images develops due to scrolling) how do I make sure that the image does not repeat itself
In case w3schools.com wasn't too clear:
Background Image Code:
For the body tag example:
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.
margin: 0 auto;
background: #fff url(image_name.jpg) no-repeat center scroll;
For a tiled image, change to:
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".
margin: 0 auto;
background: #fff url(image_name.jpg) repeat top left scroll;
Thanks for the so explanation. I have done that stuff, now I was actually playing with gradients as a background image(e-g msn.com or cricinfo.com). I got one image and I am tryng to use it as a gradient background image.
But it doesnot work. I used your directions as well as the one that I had done earlier but in both the cases the gradient image doesn't work as needed.
I am unable to send here a screenhot of the image neither can I upload it.
well in short I want to tiny image to stretch whole of my page. no matter how much scroll I need to add to the page.
Last edited by refhat; 07-02-2010 at 11:46 AM.
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)
Tags for this Thread