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

how to prevent div from resizing

P: n/a
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.

Dec 10 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
wrote on 10 dec 2005 in comp.lang.javascript:
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.


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)

Dec 10 '05 #2

P: n/a
so something i forgot to add - it works in IE but not in Firefox.

Dec 10 '05 #3

P: n/a
wrote on 10 dec 2005 in comp.lang.javascript:
so something i forgot to add - it works in IE but not in Firefox.


Where are you talking about?

please quote and show relevant code.

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

Dec 10 '05 #4

P: n/a
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>

Dec 10 '05 #5

P: n/a
wrote on 10 dec 2005 in comp.lang.javascript:
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


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)

Dec 10 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.