473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

restricting width of div

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%?
Jul 23 '05 #1
1 17514
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)
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xenophobe | last post by:
I have a popup window (required by the client) containing a form and would like to prevent users from accessing it directly. They are instead required to access the page via a hyperlink on another...
4
by: no-spam | last post by:
Hello, I have an HTML question that I'm not sure can be solved. I want to restrict the maximum size of an inline image. For example, I can force the image to be 200x200 if I do this: <img...
4
by: Dennis C. Drumm | last post by:
Is there a way with C# to allow one class access to a method or field of another class, without making that method or field visible to all other classes, as would be the case when making the method...
3
by: volume | last post by:
Restricting a windows textbox (edit item) to digits only. Is there a windows option, using .NET C#, to only allow a user to enter digits ONLY? If so, what is the flag or setting? If no, what is...
0
by: CLEAR-RCIC | last post by:
Hi. I'm using web controls in my web application. Using IIS, I am trying to restrict an IP address from viewing one of my contols. When I restrict the IP Address using the Directory Security tab...
1
by: Piper707 | last post by:
Hi, I'd like to know if there are any more ways of restricting an XML document to having only non-empty tags (containing Strings). I can think of 2 ways: 1) <xs:simpleType name="tagName">
1
by: ward | last post by:
Good morning everyone. I'm building a very simple content management site that tracks "tasks." The options available are: 1. Add Task 2. Edit Task 3. View Task 4. Print Task
2
by: Brett Romero | last post by:
I have a CustomDataGrid that inherits DataGrid. I use the filter below via a context menu, which works fine. ( ( DataTable ) this.DataSource ).DefaultView.RowFilter = filterexpress; The...
8
by: sneddo | last post by:
Ok I am trying to do the above, I have got a script that will restrict the length but it requires the user to enter the field and hit a key, before it will work. This would normaly be find, but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.