Solved

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

Posted on 2010-11-10
3
1,316 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 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

13 Experts available now in Live!

Get 1:1 Help Now