Page 1 of 1
Help with CSS
Posted: Fri Dec 09, 2005 1:15 am
by srg_13
Hi,
I am developing a new web site, but I have run into a problem, and was wondering if it was possible to fix it. I have an area of text in between two <div> tags. In the CSS stylesheet, I specify a background for that div's id. The problem that I am having is that I cannot got the image to scale in the background. I have searched Google for it, but I could not find any answers.
Thankyou in advance,
-Stephen
Re:Help with CSS
Posted: Fri Dec 09, 2005 6:56 pm
by iammisc
width and height should both be set to 100%.
Re:Help with CSS
Posted: Fri Dec 09, 2005 7:54 pm
by srg_13
How do you do that? It seems that the background property only has these properties:
Code: Select all
background-color
background-image
background-repeat
background-attachment
background-position
How do you set the width and height?
-Stephen
Re:Help with CSS
Posted: Sat Dec 10, 2005 6:49 pm
by Cjmovie
The only thing I can think of:
div.Container {
width: 100%;
height: 100%;
position: relative; /* important! */
}
img.Inside{
width: 100%;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
z-index: 0;
}
div.Inside{
width: 100%;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
z-index: 1;
}
then do this, replacing [ with < and ] with >:
[div class="Container"]
[img class="Inside" src="..." /]
[div class="Inside"]
This is some text this is some text more text more text
[/div]
[/div]
See what I'm getting at?
Re:Help with CSS
Posted: Sun Dec 11, 2005 11:30 pm
by srg_13
Thanks for that. I'll try it out soon.
-Stephen
Re:Help with CSS
Posted: Mon Dec 12, 2005 4:40 am
by srg_13
OK, I have another question:
My site is contained in a div tag, that has padding and widths and things like that defined. Is it possible to make this float in the centre of the page, without using the HTML center tag? I have tried this:
Code: Select all
<div id="container" align="center">
<!-- Website code -->
</div>
but that made everything (text, images etc.) centered, which I do not want.
Thanks,
-Stephen
Re:Help with CSS
Posted: Tue Dec 13, 2005 4:19 am
by The Polar One
Set your margins to auto and make sure you specify your width.
#container {
width:500px;
margin:0px auto auto;
}
Should keep it central.
Re:Help with CSS
Posted: Tue Dec 13, 2005 5:01 am
by srg_13
Thanks, that works great!
-Stephen