Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.