Log in

View Full Version : Div Hover, fit to Text?



zack.eth
09-26-2007, 12:31 AM
Hi everyone,

Does anyone know how to use CSS to make a div's height increase to accommodate for the amount of text? I know that this wouldn't normally take any special coding, but for some reason it isn't working. I might be missing something really simple.

Here's the url:http://www.freewebs.com/wxyzack/test.htm

I just want "#u:hover" to stretch length-wise for the amount of text it has. The text is cut-off with "overflow:hidden" in "#u", but not in "#u:hidden". Why is the text still cutoff in "#u:hover"?

insanemonkey
09-26-2007, 12:37 AM
Do this
<div id="test">
on the page where you have the box or content..

and on the css add this

#test {
width : auto;
height : auto;
}

something like that should work, test it and let me know...

littleEd
09-26-2007, 02:21 AM
yes if you add height:auto or width:auto in there for whichever one you want to change... it works

i looked at your css code and u didnt even have the height property in the hover part so there was no way it would have known to change, and your width property didnt have a unit in there (eg 270px).

zack.eth
09-27-2007, 10:40 PM
yeah, i realized that a few minutes after i posted this. sorry everyone