Connecting Tech Pros Worldwide Forums | Help | Site Map

how to prevent div from resizing

scaredemz@gmail.com
Guest
 
Posts: n/a
#1: Dec 10 '05
i have a div, i set the innerHTML property to a formatted paragraph of
text. however, at times the text exceeds the width (and height) of the
div. how do i create a fixed width div and make it use a scrollbar if
the contents exceed the height and width specified. i'm using microsoft
visual studio, and i have the width explicitly set in the properties
but still on setting the innerHTML it resizes automatically. help pls.
thx.


Evertjan.
Guest
 
Posts: n/a
#2: Dec 10 '05

re: how to prevent div from resizing


wrote on 10 dec 2005 in comp.lang.javascript:
[color=blue]
> i have a div, i set the innerHTML property to a formatted paragraph of
> text. however, at times the text exceeds the width (and height) of the
> div. how do i create a fixed width div and make it use a scrollbar if
> the contents exceed the height and width specified. i'm using microsoft
> visual studio, and i have the width explicitly set in the properties
> but still on setting the innerHTML it resizes automatically. help pls.
> thx.[/color]

use css overflow, overflow-x, overflow-y

Nothing to do with javascript.
Please follow up on a css NG.

example:

<div style='width:200px;overflow-x:scroll;'>
qwertyqwertyqwertyqwertyqwertyqwertyqwertyqwertyqw ertyqwertyqwerty<br>
qwerty
</div>



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

scaredemz@gmail.com
Guest
 
Posts: n/a
#3: Dec 10 '05

re: how to prevent div from resizing


so something i forgot to add - it works in IE but not in Firefox.

Evertjan.
Guest
 
Posts: n/a
#4: Dec 10 '05

re: how to prevent div from resizing


wrote on 10 dec 2005 in comp.lang.javascript:
[color=blue]
> so something i forgot to add - it works in IE but not in Firefox.[/color]

Where are you talking about?

please quote and show relevant code.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

scaredemz@gmail.com
Guest
 
Posts: n/a
#5: Dec 10 '05

re: how to prevent div from resizing


thx for the help. i'll transfer the problem to a css site. just
wondered if you could help me with this. the problem is this - the div
is a fixed height and a fixed width, i attach a paragraph of any length
to it. in IE, the paragraph is line-wrapped according to the width, and
if too long, a scroller appears. Firefox however, tries to put the
whole paragraph in one line and so I always have a horizontal scroller.
I'd like for it to line-wrap according to width and display only a
VERTICAL scroller if necessary. below is my div. thx for the help.


<DIV id="quoteDiv" style="OVERFLOW-X: scroll; FONT-WEIGHT: bold;
FONT-SIZE: 13pt; Z-INDEX: 101; LEFT: 0px; WIDTH: 296px; COLOR: red;
FONT-FAMILY: Arial; POSITION: absolute; TOP: 344px; HEIGHT: 290px"
ms_positioning="GridLayout">
<P id="quoteDivParagraph"></P>
</DIV>

Evertjan.
Guest
 
Posts: n/a
#6: Dec 10 '05

re: how to prevent div from resizing


wrote on 10 dec 2005 in comp.lang.javascript:
[color=blue]
> thx for the help. i'll transfer the problem to a css site. just
> wondered if you could help me with this. the problem is this - the div
> is a fixed height and a fixed width, i attach a paragraph of any length[/color]

not if you do not quote where you are replying on, after all this is
usenet, not email, and if it is an css problem, please ask in a css NG.



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Closed Thread