Solved

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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 …

821 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