Click here to get back home

restricting width of div

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
restricting width of div TMan 10-20-2004
Posted by TMan on October 20, 2004, 8:06 am
Please log in for more thread options
I am inserting html into a div tag using the innerHTML property but I
want text to wrap on a certain percentage width. When I setup the div
as follows:

div style="width : 48%"

and then insert html formatted text into it, the text will only break
on br tags. If any particular sentence is really long, it will
actually force the div to expand in width, passed its 48% boundary,
instead of doing a word wrap like I want it to.

Any ideas how to get it to word wrap at 48%?


Posted by Brian on October 20, 2004, 10:10 pm
Please log in for more thread options
TMan wrote:
> I am inserting html into a div tag using the innerHTML property

Why? If you're using DOM stuff, you can use standard DOM methods that
work in Firefox, Opera, and yes, even MSIE!

> I want text to wrap on a certain percentage width. When I setup the
> div as follows:
>
> div style="width : 48%"

This sets the width of the div, not where content inside the div wraps.

> If any particular sentence is really long, it will actually force the
> div to expand in width, passed its 48% boundary,

url?

> instead of doing a word wrap like I want it to.
>
> Any ideas how to get it to word wrap at 48%?

Use padding.

div { padding-right: 48% }

NB: This is rather excessive. You should vigorously test this in
different browsers, with different window sizes and font sizes.

--
Brian (remove "invalid" to email me)


Similar ThreadsPosted
Restricting inline image size March 29, 2005, 6:56 pm
Re: Restricting inline image size March 29, 2005, 9:24 pm
Re: Restricting inline image size March 30, 2005, 2:07 am

tag within a

May 14, 2007, 7:59 am
Re: float with set width forces outer container to width of inner container September 20, 2008, 8:03 pm
Best min-width, max-width hack for IE6 ? March 19, 2007, 12:41 pm
specifying width in tables March 24, 2005, 10:27 am
Big questions about WIDTH June 2, 2005, 12:44 pm
Max-Width property in IE 6 October 14, 2006, 9:49 am
best way to set line width July 28, 2007, 11:10 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap