css - Alternate stylesheets not working in Chrome -
i need diagnosing css problem in chrome. i'm not sure how diagnose issue. i'm wondering next steps should be.
as far solutions go, have checked this question it's not clear. have tried this solution (disabling styles , enabling one) it's not working. don't think this question applies because we're not pulling external domains it's not cross-domain issue.
the problem:
it appears chrome ignoring our alternate stylesheet definitions. in our application use alternate stylesheets , javascript routine change background color. code was working, , still working in firefox , ie, @ point stopped working in chrome. stylesheets defined this:
<link type="text/css" rel="stylesheet" title="white" property="stylesheet" href="/myapp/css/layer.css" /> <link type="text/css" rel="alternate stylesheet" title="silver" property="stylesheet" href="/myapp/css/medium.css" /> <link type="text/css" rel="alternate stylesheet" title="grey" property="stylesheet" href="/myapp/css/dark.css" /> <link type="text/css" rel="alternate stylesheet" title="beige" property="stylesheet" href="/myapp/css/beige.css" /> <link type="text/css" rel="alternate stylesheet" title="green" property="stylesheet" href="/myapp/css/green.css" /> the original body definition here:
body { font-family: arial, helvetica, sans-serif; font-size: 12px; color: #282828; height: 100%; background: #fff url(../images/header-bg.jpg) center top no-repeat; min-width: 1024px; } is supposed overridden (for example) this, in 1 of alternate stylesheets:
body { background: url("../images/header-bg-dark.jpg") no-repeat center top #919194; } but not working in chrome. i've tried following:
1) traced through js code , verified css sheets getting enabled/disabled correctly:
if (document.stylesheets.item(i).href.indexof("medium") > -1) { document.stylesheets.item(i).disabled = false; } else if (document.stylesheets.item(i).href.indexof("dark") > -1 || document.stylesheets.item(i).href.indexof("beige") > -1 || document.stylesheets.item(i).href.indexof("green") > -1) { document.stylesheets.item(i).disabled = true; } 2) looked @ computed styles, , base style showing - it's chrome ignoring other styles.
3) tried removing alternate rel="alternate stylesheet" part of definitions.
4) tried removing title base definition (layer.css).
anyone have other ideas? if find solution i'll post it.
the answer turned out removing "title" attribute , removing "alternate" part of stylesheet definition. stylesheets linked this:
<link type="text/css" rel="stylesheet" property="stylesheet" href="<c:url value="/css/medium.css"/>" /> <link type="text/css" rel="stylesheet" property="stylesheet" href="<c:url value="/css/dark.css"/>" /> <link type="text/css" rel="stylesheet" property="stylesheet" href="<c:url value="/css/beige.css"/>" /> <link type="text/css" rel="stylesheet" property="stylesheet" href="<c:url value="/css/green.css"/>" /> no idea why original definitions didn't work new ones work , can turned on , off js, needed.
Comments
Post a Comment