?
Solved

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

Posted on 2008-10-22
2
Medium Priority
?
359 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

764 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