Message from discussion
link up css with a d3.js script
Date: Mon, 20 Aug 2012 20:01:11 -0700 (PDT)
From: mrtn <mrtnl...@gmail.com>
To: d3-js@googlegroups.com
Message-Id: <cac4ab20-1c57-4c8e-93d2-a2c5b5f3b782@googlegroups.com>
Subject: link up css with a d3.js script
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_300_8546333.1345518071262"
------=_Part_300_8546333.1345518071262
Content-Type: multipart/alternative;
boundary="----=_Part_301_25252726.1345518071262"
------=_Part_301_25252726.1345518071262
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
I have a HTML document with HTML5 doctype: <!DOCTYPE html>, inside which I
link a dedicated CSS sheet for d3.js graphs as well as a separate .js
script for drawing a graph using d3.js.
e.g. something like:
<head>
...
<link type="text/css" href="./graph.css" rel="stylesheet"/>
</head>
<body>
...
<div class="graph">
<script type="text/javascript" src="./graph1.js"></script>
</div>
...
</body>
Both 'graph.css' and 'graph1.js' are present in the current directory. Now,
if I render the HTML file without the doctype, the graph is drawn with the
styles from 'graph.css'. However, as soon as I add the doctype, it fails to
look up the styles from the .css file.
I wonder what is the cause for this problem and how can I fix it without
moving the styles from .css back to the d3.js code inside 'graph1.js'.
Thanks!
------=_Part_301_25252726.1345518071262
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<div><br></div><div>I have a HTML document with HTML5 doctype: <!DO=
CTYPE html>, inside which I link a dedicated CSS sheet for d3.js graphs =
as well as a separate .js script for drawing a graph using d3.js.</div><div=
><br></div><div>e.g. something like:</div><div><br></div><div><head><=
/div><div> ...</div><div> <link type=3D"text/c=
ss" href=3D"./graph.css" rel=3D"stylesheet"/></div><div></head></d=
iv><div><body></div><div> ...</div><div> &l=
t;div class=3D"graph"></div><div> <sc=
ript type=3D"text/javascript" src=3D"./graph1.js"></script></div><=
div> </div></div><div> ...</div><div></b=
ody></div><div><br></div><div>Both 'graph.css' and 'graph1.js' are prese=
nt in the current directory. Now, if I render the HTML file without the doc=
type, the graph is drawn with the styles from 'graph.css'. However, as soon=
as I add the doctype, it fails to look up the styles from the .css file.</=
div><div><br></div><div>I wonder what is the cause for this problem and how=
can I fix it without moving the styles from .css back to the d3.js code in=
side 'graph1.js'. Thanks!</div><div><br></div><div> </div><div><br></d=
iv><div><br></div>
------=_Part_301_25252726.1345518071262--
------=_Part_300_8546333.1345518071262--