shadedecho
Programmer
I know there are a million and one posts and websites about people trying to achieve various layout things and setting html/body to height:100% and bottom floating footers and all that jazz.
My CSS problem is similar to all that, but has nothing to do with the out-and-out size of the page/viewport/window. So, all those pages and posts unfortunately don't really afford me a solution that I've found to work.
I have a parent div ("A") that I want to put an iframe (or another div) inside of ("b").
I want "b" to be 100% of the width and height of "A", except minus some area on either side and top and bottom (say 5px all the way around).
I've got the width-sizing (left/right area) of "b" working, by saying "width:100%;margin-left:5px;margin-right:5px;". It seems to pull in the sides of "b" appropriately inside of "A".
However, "height:100%;margin-top:5px;margin-bottom:5px;" for "b" doesn't work the same. It doesn't subtract the 10px from the 100% height like it does with the width. It just respects the top-margin and moves it down 5px inside of "A", but then pushes the bottom of "b" 5px outside the bottom of "A".
So, technically that takes care of the top area. But what to do about the bottom, as now "b" sticks out 5px BELOW the bottom of "A"?
So, the crux of all this is, I really need some clever CSS way of actually forcing the height:100% to SUBTRACT some value (by way of borders, padding, margins, something!).
I have been successful at this following hack, but as you'll see further down, it doesn't accomplish really what I need, it just looks visually like it does.
------------------------
I can instead move "A" up with a negative margin-top, and push "b" down with respect to the top of "A" -- by "b" having a positive margin-top (or padding). Combined with an "overflow:hidden" on parent "A", I do get a clipping of "b" that's fully constrained visually to the area I want -- that is a 5px gutter around "b" inside of "A".
BUT -- here's the catch -- "b" is not really the height desired... it's actually 10px taller than desired, which means that if any content inside of "b" were to stretch larger than the height of "b", and it were to have "overflow:auto" on it to force scrollbar(s) to appear, then the bottom 10px of the scrollbar controls would be hidden by the "overflow:hidden" of the parent "A".
so, again, the height of "b" is the real problem... not just making "b" visually look a certain height.
--------------------
Anyone have any thoughts or clever tricks?
My CSS problem is similar to all that, but has nothing to do with the out-and-out size of the page/viewport/window. So, all those pages and posts unfortunately don't really afford me a solution that I've found to work.
I have a parent div ("A") that I want to put an iframe (or another div) inside of ("b").
I want "b" to be 100% of the width and height of "A", except minus some area on either side and top and bottom (say 5px all the way around).
I've got the width-sizing (left/right area) of "b" working, by saying "width:100%;margin-left:5px;margin-right:5px;". It seems to pull in the sides of "b" appropriately inside of "A".
However, "height:100%;margin-top:5px;margin-bottom:5px;" for "b" doesn't work the same. It doesn't subtract the 10px from the 100% height like it does with the width. It just respects the top-margin and moves it down 5px inside of "A", but then pushes the bottom of "b" 5px outside the bottom of "A".
So, technically that takes care of the top area. But what to do about the bottom, as now "b" sticks out 5px BELOW the bottom of "A"?
So, the crux of all this is, I really need some clever CSS way of actually forcing the height:100% to SUBTRACT some value (by way of borders, padding, margins, something!).
I have been successful at this following hack, but as you'll see further down, it doesn't accomplish really what I need, it just looks visually like it does.
------------------------
I can instead move "A" up with a negative margin-top, and push "b" down with respect to the top of "A" -- by "b" having a positive margin-top (or padding). Combined with an "overflow:hidden" on parent "A", I do get a clipping of "b" that's fully constrained visually to the area I want -- that is a 5px gutter around "b" inside of "A".
BUT -- here's the catch -- "b" is not really the height desired... it's actually 10px taller than desired, which means that if any content inside of "b" were to stretch larger than the height of "b", and it were to have "overflow:auto" on it to force scrollbar(s) to appear, then the bottom 10px of the scrollbar controls would be hidden by the "overflow:hidden" of the parent "A".
so, again, the height of "b" is the real problem... not just making "b" visually look a certain height.
--------------------
Anyone have any thoughts or clever tricks?