Kurisu
10-15-2006, 06:15 AM
Hello, I'm pretty knew just started CSS last night and things are progressing, but I do have a few questions that perhaps someone can answer/clear up for me.
First my page layout can be seen from the following site:
http://one.xthost.info/Kurisu/Main.html
(hope the link works)
Anyways it is basically a:
header
menu
container
- Left navigation bar set with absolute.
- Main content set with relative.
- Right navigation bar set with absolute.
Here are my questions:
1) How do I center text vertically in an element? I want to center my title vertically in the header like it is horizontally.
#header h1
{
text-align: center;
/* what do I need here? */
}
2) I would like an image to be displayed in the bottom right corner of my container div. I thought something like the following might work, but it doesn't (i guess because of trying to do pixel math on a percentage?):
<div id="container">
<div id="bottom_right_image">
</div>
</div>
#bottom_right_image
{
position: absolute;
left: 100% - 118px; /*118px being the width of my image. */
top: 100% - 220px; /*220px being the height of my image. */
}
I'm sure there is a very easy way to accomplish what I'm trying to do, but what is it :P ?
3) This question relates to the height attributes of the divs. I would like my left bar, my main content, and my right bar to all always have the same height. I.e. if one grows the rest will follow. It seems the container div grows as one of its "relative" children does, but not an "absolute" child...
For example, the bars and main context are only the height of its own text. In my website the left bar is alot longer than my main text and my right bar so it looks really funny...
See here:
http://one.xthost.info/Kurisu/Main2.html
I can get around this by setting the container's background color the same as my bars so it appears the bars are expanding as the main text grows and all I have to due is make sure my main text is longer than either bar. This seems kinda lame though and would require like a bunch of <br />'s in my main content area plus IE has a weird hitch in the transition from my bars to the background behind it?
see here: See here:
http://one.xthost.info/Kurisu/Main.html
<p>
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</p>
Also what if I wanted the right bar to be a different color than the left the above scheme wouldn't work? Is there an easy way to do this?
Can someone clarify relative too? It sets up things like they are stacked vertically right? I can't put two relative divs in the same container and have the positioned side by side can i? I have to use absolute to do this right?
Thanx for any help..
First my page layout can be seen from the following site:
http://one.xthost.info/Kurisu/Main.html
(hope the link works)
Anyways it is basically a:
header
menu
container
- Left navigation bar set with absolute.
- Main content set with relative.
- Right navigation bar set with absolute.
Here are my questions:
1) How do I center text vertically in an element? I want to center my title vertically in the header like it is horizontally.
#header h1
{
text-align: center;
/* what do I need here? */
}
2) I would like an image to be displayed in the bottom right corner of my container div. I thought something like the following might work, but it doesn't (i guess because of trying to do pixel math on a percentage?):
<div id="container">
<div id="bottom_right_image">
</div>
</div>
#bottom_right_image
{
position: absolute;
left: 100% - 118px; /*118px being the width of my image. */
top: 100% - 220px; /*220px being the height of my image. */
}
I'm sure there is a very easy way to accomplish what I'm trying to do, but what is it :P ?
3) This question relates to the height attributes of the divs. I would like my left bar, my main content, and my right bar to all always have the same height. I.e. if one grows the rest will follow. It seems the container div grows as one of its "relative" children does, but not an "absolute" child...
For example, the bars and main context are only the height of its own text. In my website the left bar is alot longer than my main text and my right bar so it looks really funny...
See here:
http://one.xthost.info/Kurisu/Main2.html
I can get around this by setting the container's background color the same as my bars so it appears the bars are expanding as the main text grows and all I have to due is make sure my main text is longer than either bar. This seems kinda lame though and would require like a bunch of <br />'s in my main content area plus IE has a weird hitch in the transition from my bars to the background behind it?
see here: See here:
http://one.xthost.info/Kurisu/Main.html
<p>
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
This is the main content area. <br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</p>
Also what if I wanted the right bar to be a different color than the left the above scheme wouldn't work? Is there an easy way to do this?
Can someone clarify relative too? It sets up things like they are stacked vertically right? I can't put two relative divs in the same container and have the positioned side by side can i? I have to use absolute to do this right?
Thanx for any help..