As we mentioned in Chapter 1, Your First Mapping Application, the Cascading Style Sheet (CSS) tells the browser how to render an HTML page. As the browser scans through the HTML, it scans through all the applicable CSS styles from CSS files, as well as any overriding styling within the HTML, to see how it should render the element. CSS descriptions, such as color and font size, often cascade down from one element to its children unless specifically overridden. For example, the style applied to the div
tag will also apply to the p
tags inside it, as shown in the following code:
<div> <p>I'm not red.</p> <div style="color:red;"> <p>You caught me red-handed.</p> <p>Me too.</p> </div> <p>I'm not red</p> </div>
CSS works a little differently from most programming languages. In JavaScript, when you have a bug in part of your program, you can step through the code in your browser until...