Except where otherwise noted, the contents of this document are Copyright © Marty Stepp, Jessica Miller, and Victoria Kirst. All rights reserved. Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form is prohibited without the author's expressed written permission.
Firebug is a Firefox add-on that lets you dynamically examine or modify the content and styling of web pages. After installing it, right-click an element and choose Inspect Element with Firebug. The Chrome Web Inspector tool behaves in a very similar way. You can launch both by hitting F12 while in your browser.
Use Firebug or Chrome to inspect the course web site:
h2
elementsintro
h2
elements inside intro
h2
elements, except those inside intro
p
elements inside content
p
elements directly inside content
bordered
h2
elements with class bordered
h2
elements: h2
intro
: #intro
h2
elements inside intro
: #intro h2
h2
elements, except those inside intro
: #content h2, #footer h2
p
elements inside content
: #content p
p
elements directly inside content
: #content > p
bordered
: .bordered
h2
elements with class bordered
: h2.bordered
Given the following HTML, what CSS would be necessary to produce the expected output below? (Assume the red line is 3px thick, and the default font is used for the first word. The second word is in Comic Sans MS. The larger letters are 2em and green in color.) Are any HTML changes needed? You can download the html file here.
HTML |
---|
|
First, wrap the text inside the <h1>
in an inline tag. The <em>
tag is one possible choice:
<h1>
<em class="term">
Web Programming
</em>
<h1>
You then need to add span tags to the first letter of each word, as well as the whole second word to be able to target them.
<h1>
<em class="term">
<span class="big">W</span>eb
<span id="font"><span class="big">p</span>rogramming</span>
</em>
<h1>
Then add the following CSS rules:
h1 { text-align: center; background-color: #cccccc; } em.term { border-bottom: dashed 3px red; }
.big { font-size: 2em; color: green; } #font { font-family: "Comic Sans MS", fantasty; }