Author |
Topic |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 10 September 2005 : 11:20:57
|
I just can't find the syntax I want to use for a certain div. The content is dynamic, so I want the DIV to resize up to a maximum of 7 lines of text (or 110 pixels if that's easier), but the text could be less than 7 lines as well.
Basically what I need is the syntax for a DIV so that it can change in height up to a maximum of 110 pixels.
Any ideas ? |
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 10 September 2005 : 13:59:55
|
That "can" be done using CSS, but I don't think any browser supports it.
I is the space you want it to expand into going to remain void when the div is collapsed? If so you can accomplish it with two divs. |
Nathan Bales CoreBoard | Active Users Download |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 10 September 2005 : 15:02:47
|
I think this can be done with the max-height property (and a trick for IE). Perhaps something like this ;
mindiv {
border:1px solid red;
max-height:110px;
overflow:hidden;
height:expression(
this.scrollHeight > 110? "110px" : "auto" );
} |
portfolio - linkshrinker - oxle - twitter |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 10 September 2005 : 16:50:17
|
quote: I is the space you want it to expand into going to remain void when the div is collapsed? If so you can accomplish it with two divs.
No, the space should be used for other things - what I'm basically doing is trying to make a sig height limiter. Members can post anything they want, but it will only show the first 110 pixels but some members don't have a sig so I don't want to show 110 pixels of whitespace.
quote: I think this can be done with the max-height property (and a trick for IE). Perhaps something like this ;
OK, I'll try that |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 11 September 2005 : 06:40:38
|
quote: Originally posted by laser what I'm basically doing is trying to make a sig height limiter. Members can post anything they want, but it will only show the first 110 pixels but some members don't have a sig so I don't want to show 110 pixels of whitespace.
Brilliant!!! Why didn't I think of that sooner!!
|
portfolio - linkshrinker - oxle - twitter |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 11 September 2005 : 06:59:57
|
Btw; I've tested it, and it doesn't seem to work when used in a DIV, but it does work when used as a 'span'. FireFox doesn't seem to understand the max-height thing either, so only IE works. |
portfolio - linkshrinker - oxle - twitter |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 11 September 2005 : 09:39:48
|
That's OK, 95% of my users use IE, but what was the syntax you used ? From some reason I have both a span and a div (old code from before), but it always takes 110 pixels regardless |
|
|
Sonic
New Member
Germany
82 Posts |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 11 September 2005 : 16:49:28
|
ah, thanks Sonic, I just need a few translations, but I'll throw them through babelfish and see what I get |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 12 September 2005 : 05:25:17
|
quote: Originally posted by laser
That's OK, 95% of my users use IE, but what was the syntax you used ? From some reason I have both a span and a div (old code from before), but it always takes 110 pixels regardless
I've switched to Sonic's code, and this works perfectly in both IE as in FireFox!!! Great feature!!!!! |
portfolio - linkshrinker - oxle - twitter |
|
|
|
Topic |
|