开发者

Text in <div> different in Firefox

Does anyone know of any fixes/workarounds for Firefox (3 and 4) 开发者_如何学编程handling text slightly differently than other browsers, specifically:

  • Character-spacing (Firefox sometimes slightly wider with positive character-spacing defined in px)

  • Non-splitting of hyphenated words (in, say, Safari, if "co-operate" appears at the end of a line it may be split into "co-" and "operate" ... but in Firefox it is not, and the whole word appears on a new line).

Not sure whether the two are related. Any tips? Thanks in advance.


You can use reset stylesheets (for example Eric Meyer's reset.css)

And for 2nd , you can check CSS's word-wrap attr.

Thereby, you can reset everything for every browser and set again as you want.


If you want to override the default browser setting for word-spacing, you can use the following in your main CSS file:

* { word-spacing:0px; }

Just note that not all browser support the wildcard. If you don't want to use a wildcard, you can use just a normal select:

div { word-spacing:0px; }

Word-spacing on W3Schools contains more information on word-spacing.

About your second problem, I am not getting the same symptom as you are. In Firefox 3.6.13 any word with a hyphen in it at the end of the line is breaking up in my computer.

Doesn't matter what the Word-wrap value is, Firefox in my computer will break the word up if necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜