Solved

word-wrap: break-word; issues with Google Chrome

Posted on 2010-11-10
3
1,318 Views
Last Modified: 2012-05-10
I have a web application which uses a Gridview, the gridview has a column called comments which usually is more than 50 words long .
I am using word-wrap: break-word; in a css class and this works like a charm on IE, but cant make it work with Google Chrome,,, does anybody have a solution for this?
0
Comment
Question by:TonyReba
  • 2
3 Comments
 
LVL 22

Expert Comment

by:remorina
ID: 34107947
word-wrap is a CSS3 selector and as far as I'm aware of, it should be supported by modern browsers including Webkit Google Chrome and Safari.

The example code below has been tested and works well for me on Safari, Chrome, IE and FF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Example</title>
</head>
<body>
    <div style="width:50px;border:solid 1px red;word-wrap:break-word;">
        VeryLongWordThatShouldBreak
    </div>
</body>
</html>

Open in new window

0
 
LVL 9

Author Comment

by:TonyReba
ID: 34109113
so the issue is that is actually being applied to an asp.net gridview row ?
0
 
LVL 22

Accepted Solution

by:
remorina earned 200 total points
ID: 34109259
An asp.net renders html to the browser and the gridview redners a table and css should still work normally regardless of the engine being used to render the markup if it was clean and supported.

I haven't tested the word-wrap on table cells though, in my example it was a single div, but with complex structure sometimes odd behaviour might result in browser compatibility especially with CSS3 selectors since they are still under continual support and enhancement.

I suspect that in your case that the code being rendered produces a situation where webkit doesn't apply the selector, maybe because the table cell or maybe because no width was explicitly specified, there could be numerous reasons.

I would try specifying a width for the table cell having the word-wrap if possible, otherwize it might require another control or some kind of ControlAdapter to render divs instead of tables if there were any.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now