Reputation: 117
I have a popup div
which appears in the center of my screen:
---------------------------
| 15% |
| --------------- |
| 15% | | 15% |
| | | |
| --------------- |
| 15% |
---------------------------
I like the left side, top side and right side. But the bottom I don't like.
What I would like it to do is:
height
of the content ( I think that's height: auto
)15%
gap at the bottom.div
, is a child div
which has overflow-y: auto
, inside this are div
(s) which float
.This was my code:
#toPopup1, #toPopup2, #toPopup3 {
font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
border-radius: 3px 3px 3px 3px;
color: #333333;
display: none;
font-size: 14px;
margin-left: 15%;
margin-right: 15%;
position: fixed;
top: 15%;
bottom: 15%;
width: 70%;
z-index: 222;
text-align: center;
}
Then I removed the bottom:15%;
with max-height:70%;
however the result I got was a much smaller box (almost one line in height
), please advise?
Upvotes: 3
Views: 5779
Reputation: 103760
This is what I am guessing :
When you replace bottom:15%
by max-height:70%
the height of the div is calculated by it's content.
You say the divs inside are floated so they don't extend the height of their parent therefore the popup div has a height of 0 (+ borders, padding and margins if there are any).
Several solutions for this:
height:70%;
)display:inline-block;
instead of floats
to position childrenUpvotes: 1