Logically thinking the server sends the CSS data embedded inside the HTML data, both of which are encapsulated in the HTTP response and sent to the browser for rendering. My question is this: How often does the browser process the CSS data? Seems to me it would be parsed only once along with the HTML stream. However I’m reading a JavaScript beginners book where I’ve just created a script that makes changes to the styles (specifically the position property) and moves text across the screen by changing the position property. I’m a little baffled right now in understanding how CSS is processed by the browser. Does the browser continually monitor CSS for updates or does the page have to go through a complete reload using the updated CSS or maybe my lack of understanding is in the JavaScript portion?
<script language=”JavaScript”>
<!–
var paraOneLeft = 100;
var paraTwoLeft = 400;
var switchDirection = false;
function window_onload() {
window.setInterval(“moveParas()”,50)
}
function moveParas() {
if (switchDirection) {
paraOneLeft–;
paraTwoLeft++;
if (paraOneLeft == 100) {
switchDirection = false;
}
}
else {
paraOneLeft++;
paraTwoLeft–;
if (paraOneLeft == 400) {
switchDirection = true;
}
}
para1.style.left = paraOneLeft + “px”;
para2.style.left = paraTwoLeft + “px”;
}
–>
</script>
</head>
<body language=”JavaScript” onload=”window_onload();”>
<p style=”position: relative; left: 100px; top: 30px;” id=”para1″>Para 1</p>
<p style=”position: relative; left: 100px; top: 30px;” id=”para2″>Para 2</p>
</body>
</html>