Solved

How do I make an auto height div with a set minimum height?

Posted on 2008-10-22
2
353 Views
Last Modified: 2013-11-19
Hi there,

I have a div as a staff profile box. It has a 100x130px portrait image floated on the left and text on the right alongside the image.

My div auto resizes as I type more text but if I delete text, it shrinks below the size of the floated image.

How can I get the div to be height:auto but with min-height; 130px ?

Or alternatively, how can I make it recognize the floated image as an element it cannot reduce past?

Sorry if this is a stupid question or dodgy syntax, I'm just starting out with CSS.

Thanks

Will




0
Comment
Question by:willsavage
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
JimDestruct earned 500 total points
ID: 22775056
to give your div a minimum height I use the following:

#MyDivID {
       min-height: 130px;
       height: auto !important;
       height: 130px;
}

0
 

Author Closing Comment

by:willsavage
ID: 31508685
Thanks a lot for answering my first ever question on EE!

Regards

Will
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change box shadow 1 42
GET error with Font Awesome 3 48
How to get CSS styled menu to maintain the open selected menu? 13 53
Flex container in CSS 8 42
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question