View Full Version : HTML Formatting question

08-13-2011, 10:04 PM
I'm fairly new to HTML, and this site for that matter, and I'm having trouble formatting a test web page with the .style. tag in the header of the document.
Here's the markup:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/transitional.dtd">
<meta charset="UTF-8"/>
<style type="text/html">
h1.heade {color:purple;}
p1.par1 {color:Ivory;}
p2.par2 {color: green;}
a.link {color:green;}
<!-- It took me forever to figure out how to format the style of the page and now it's all screwy -->
<body style="font-family:verdana;color:ivory;background-color:black;">

I'm posting the complete header because I don't know if it's formatted right, or if it could be cleaned up a bit, so any help would be appreciated.

The class attributes of each paragraph are set as in the style tag, and I'm not sure how to change the colour of the links on my page. The formatting showed up when the .style. tag was incorrectly placed in the body of the document, but when I moved it to the header, the formatting was erased.:confused:

Attached is the entire file...

08-13-2011, 10:13 PM

<style type="text/css">

there's no p1, p2, p3, or p4 either

08-13-2011, 10:30 PM
Is that it? Woow now i feel dumb. And as for the p1, p2, etc. I learned from w3schools, and their pages are formatted that way. How can I id each paragraph without doing that?

08-13-2011, 10:44 PM

you should set a class to each one. id can only be used once. classes can be used multiple times

p.green { color: green; }
p.green-back { background-color: green; }

<p class="green"></p>
<p class="green-back"></p>
<p class="green-back"></p>

08-13-2011, 11:01 PM
Thanks for the help!