Jump to content

div size and blank space


chiprivers

Recommended Posts

I am relatively new to using CSS for layout purposes, but I have read several tutorials and understand the basic concept.  I having trouble getting to grips with the dimension of elements.  If I want to specify a specific size for an element, for example a <div>, why does it not adopt the size height I have specified?

I have a div with the following css code:

#frame { /* main page frame */
width: 800px;
min-height: 100px;
margin-left: auto;
margin-right: auto;
background-color: #ffffff
}

I expected the div to display at the minimum height of 100px but it doesn't!  When there is no content in the div it only displays at a height equal to one row of text.  If I add some content it expands to the height of the content I have added.  How do I get an elemenet to display at an exact height whether there is or is not any content within it?  Unless I can get my head around this bit of CSS I think I am going to become unstuck trying to use CSS for positioning so any assistance would be appreciated.
Link to comment
https://forums.phpfreaks.com/topic/27789-div-size-and-blank-space/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.