By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,970 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,970 IT Pros & Developers. It's quick & easy.

How to change the height of one div to use repeatedly within different HTML pages

P: 17
Hi there!

Okay so basically what Iím trying to figure out is how to change the height of one div to use repeatedly within various pages of a website Iím creating.

I have about 10 different web pages and all of them differ in height. The home page has images and text on and Iím using a div called "content" which is 700px in height and this is fine to show the relative content. But I have another page which needs to be longer as more content and videos are placed on this page. In short, I have 10 different web pages that make up my web site and I would like to use the "content" div for each and every single page within the website instead of creating 10 different 'content' divs.

I've researched into the min-height and max-height properties and was wondering would this be the correct way of altering the height of the "content" div so elements can be placed in the div?

So I was thinking of making the "content" div have properties such as:

Expand|Select|Wrap|Line Numbers
  1. #content {
  2. min-height:600px;
  3. max-height:1000px;
  4. }
  5.  
As then I would be able to use the "content" div in each and every web page Iím creating instead of creating 10 different 'content' divs and naming them...#content-home #content-about-us #content-contact-us etc...

I look forward to any feedback.

Thanks,
James
Jun 7 '11 #1

✓ answered by Elisabeth Dietz

Your div will get the needed size automatically if you fill it with content, but if you want to have the max and min set, your idea will work fine (except for Internet Explorer, as usual..)

Share this Question
Share on Google+
2 Replies


drhowarddrfine
Expert 5K+
P: 7,435
Those don't alter the height at all but limit them to that range.

Are you sure you need that at all? The div will expand/shrink with its content.
Jun 8 '11 #2

Elisabeth Dietz
P: 3
Your div will get the needed size automatically if you fill it with content, but if you want to have the max and min set, your idea will work fine (except for Internet Explorer, as usual..)
Jun 8 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.