469,904 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

Dynamic stylesheet loading and tag overlap

I'm using the following to dynamically add a style sheet with larger
font sizes:

if (document.createStyleSheet) {
} else {
var oStyle = document.createElement("STYLE");
oStyle.type = "text/css";
var txt = document.createTextNode("@import

This works fine in IE and FF 1.5 except that FF causes text with nested
tags to overlap. For example,

<p>This is some <span style="font-weight:bold;">sample</span> text.</p>

causes the words "some" and "text" to overlap the word "sample" (as
though the default kerning has been ignored). This does not happen if I
load the new style sheet normally (i.e. in the HEAD).

Is this a limitation of dynamically loaded style sheets in FF, an error
in the way I'm loading the style sheet, or a question for the CSS NG?

Andrew Poulos
Feb 6 '06 #1
1 1508

Andrew Poulos wrote:
var oStyle = document.createElement("STYLE");

var oStyle = document.createElement('LINK');
oStyle.id = 'foo';
oStyle.rel = 'stylesheet';
oStyle.href = '...';
document.documentElement.firstChild.appendChild(oS tyle);

Feb 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by JWL | last post: by
5 posts views Thread by Daniel Frey | last post: by
9 posts views Thread by pbd22 | last post: by
3 posts views Thread by =?Utf-8?B?U3ViYQ==?= | last post: by
8 posts views Thread by Mark Shroyer | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.