By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 1,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

CSS - Position and autosize of a div-tag

P: 2
Hi,
I have a problem with a rather simple design. Inside a container div I want a rather slim collored box attached to right side inside the container div and I want it to be 100% height of the container div. This was no problem before - I just used position:absolute right:0px and height:100%. But now I have to set the container height to auto to be relative to the content and because of that the 100% height of the child div have stoped working.

Does any one know how to fix this without make the colored stripe as a background?
Can I make a parent div "sence" the height of an child div that is absolute positioned?

Grateful for any help
//S
Oct 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: 6
Make it a border! ;) if the only purpose of the thin DIV is to draw a colored line to the right from the content, using the BORDER-RIGHT would be the most logic solution.
Oct 19 '06 #2

jaymanson
P: 29
What's happening here is that your browser does not know what height to set!

You have told it that you want the child div to be height: 100%, so it looks to the container div to work out 100% of what? The container div is set to be height: 100%, but 100% of what? You have to go even further back with your height specifications.

This will satisfy IE6..
Expand|Select|Wrap|Line Numbers
  1. body {
  2.     height: 100%;
  3. }
...but you will also need this to keep FF happy...
Expand|Select|Wrap|Line Numbers
  1. html {
  2.     height: 100%;
  3. }
Hope that helps :-)
Oct 19 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.