homepage Welcome to WebmasterWorld Guest from 54.234.2.88
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
text overflow outside DIV tags
tr8er8




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

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;

 

SuzyUK




msg:3587841
 8:36 am on Feb 29, 2008 (gmt 0)

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

tr8er8




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

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

SuzyUK




msg:3588439
 11:04 pm on Feb 29, 2008 (gmt 0)

>> 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?

tr8er8




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved