TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-20-2011, 04:03 PM   #1 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default Div height

Anybody got any ideas to control the height of a css div area? I dont want to set a specific height but for example the display something like this:

PHP Code:
-----------------------   ----------------------- 
This is the heading |   | This is a short     |
but sometimes it    |   | heading             |
will be this long   |   |                     |
|                     |   |                     |
Other stuff         |   |                     |
|                     |   |                     |
|                     |   -----------------------
----------------------- 
So the header in the div is input from a user and can end up being anything up to about 50 characters but sometimes will only be 10 for example so if each line of detail text underneath is guaranteed to be only one line (which it is) I am left with an annoying difference in div heights. What is the best way to handle this? I want these divs to be of equal height for aethetic reasons.
captainmerton is offline  
Reply With Quote
Old 02-20-2011, 04:49 PM   #2 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

Wondering if i should just use a table with the div to make sure each div retains the same standard format.
captainmerton is offline  
Reply With Quote
Old 02-20-2011, 04:58 PM   #3 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

Please ignore i just created a div for the header within the div and set a height % which has solved the problem.
captainmerton is offline  
Reply With Quote
Old 02-20-2011, 11:23 PM   #4 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

great, that you solved it. I was just going to say to use percentages :P
tony is offline  
Reply With Quote
Old 02-21-2011, 11:42 AM   #5 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

I tried % initially but each browser handles them differently so when i looked at it in on my iphone using safari i assume it looked extreme but looked fine in Firefox. IE seems to be the worst though dead hard to get it to look just right in that. Getting to the stage where i feel maybe i should just start using some browser specific css. Thoughts?
captainmerton is offline  
Reply With Quote
Old 03-01-2011, 12:37 AM   #6 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

Easiest way is to use javascript to calculate the tallest box and then set the heights of everything to match. Here is a jQuery plugin: http://www.cssnewbie.com/equalheights-jquery-plugin/
__________________
Eric
wGEric is offline  
Reply With Quote
Old 03-02-2011, 05:53 PM   #7 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

Many thanks wGEric. I'm still having problems with this, minor but problems nonetheless so i'm going to take a look at this link.
captainmerton is offline  
Reply With Quote
Old 11-28-2012, 11:21 AM   #8 (permalink)
The Wanderer
 
Join Date: Nov 2012
Posts: 15
Thanks: 0
abbot is on a distinguished road
Default

you can adjust of div height or width according your requirement. create a css class.
abbot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Max Image width and height condition ignored by opera? SaintIsaiah General 9 06-12-2010 07:19 AM
DIV side by side 9three XHTML, HTML, CSS 12 02-06-2009 05:26 PM
Can't solve browser error Peuplarchie Absolute Beginners 1 06-09-2008 05:48 AM
Menu Display Problem in IE6+ obolus XHTML, HTML, CSS 14 03-01-2008 07:57 PM
Measure height of page in pixels..? Aaron Advanced PHP Programming 10 01-05-2008 01:14 AM


All times are GMT. The time now is 01:58 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design