Solved

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

Posted on 2010-11-10
3
1,331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

691 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