Welcome to WebmasterWorld Guest from 54.157.222.62

Forum Moderators: not2easy

Message Too Old, No Replies

text overflow outside DIV tags

   
4:43 am on Feb 28, 2008 (gmt 0)

5+ Year Member



I have a div tag, and the text wraps well when you have spaces, everything is good, but when I do a long word or something, it will stick outside the div, is there anyway to fix this. I've looked at several things but they aren't all compatible with all browsers.

Right now this is my css that the text is going into:


background: url('images/navBG.gif') repeat-y;
padding: 5px 15px 10px 15px;
font: 70%/1.5em Verdana, Tahoma, arial, sans-serif;
font-size: 11px;
8:36 am on Feb 29, 2008 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I don't think there's really a "coverall" way,

there's

overflow: visible;
which should let the content overflow the side if the div but not break the layout, that means the content might overflow, but not displace into the following div but IIRC that won't work for IE6 and below as they simply stretch the div (expanding box problem) and break the layout

there's

overflow: hidden;
which requires the div to have a width and simply hides the portion of content that overflows

for IE there's {word-wrap: break-word;} which does what it says and breaks the word and not the layout but it's IE proprietary

if it's for keeping comments contained for example you might use

overflow: auto;
which also requires a width but would generate a scrolling div should it get too big,

depending on what you want to happen I think a combination of these is about the only option, but maybe there's more I've missed

-Suzy

10:22 pm on Feb 29, 2008 (gmt 0)

5+ Year Member



Yeh I know all the types, and it doesn't ruin the design, it just overflows over the edges.
11:04 pm on Feb 29, 2008 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



>> I know all the types, and it doesn't ruin the design, it just overflows over the edges.

ahh ok sorry, I just took time to explain some things just in case.. I'm not a mind reader..

as a matter of interest as you "know all the types" what are you expecting CSS to do what with the overflow that is not already being done?

11:13 pm on Feb 29, 2008 (gmt 0)

5+ Year Member



well I just want the text to wrap when it gets to the width I specify the text to be in. Like i want it to wrap at 160px but instead it just keeps going. And again, It only goes outside the DIV if I have a long word right at the end of the 170px, or close to it.