Solved

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

Posted on 2008-10-22
2
345 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
2 Comments
 
LVL 1

Accepted Solution

by:
JimDestruct earned 500 total points
Comment Utility
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
Comment Utility
Thanks a lot for answering my first ever question on EE!

Regards

Will
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now