Solved

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

Posted on 2008-10-22
2
357 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

717 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