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
Help with CSS
Re:Help with CSS
How do you do that? It seems that the background property only has these properties:
How do you set the width and height?
-Stephen
Code: Select all
background-color
background-image
background-repeat
background-attachment
background-position
-Stephen
Re:Help with CSS
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?
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
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:
but that made everything (text, images etc.) centered, which I do not want.
Thanks,
-Stephen
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>
Thanks,
-Stephen
Re:Help with CSS
Set your margins to auto and make sure you specify your width.
#container {
width:500px;
margin:0px auto auto;
}
Should keep it central.
#container {
width:500px;
margin:0px auto auto;
}
Should keep it central.