
Return
By: a guest on
Aug 10th, 2012 | syntax:
HTML | size: 1.42 KB | hits: 14 | expires: Never
<!DOCTYPE html>
<html>
<body style="background-color:black">
<h1 style="color:white;font:arial;font-size:40px;">Alex Franklin is a <big> beast</big></h1>
<p style="color:white;font:verdana;font-size:15px;"> tom will love this<br /> Do you like it? </p>
<!--
You used HTML5 document type declaration at the top (good)
You need to use double quotes around values of attributes (e.g style="")
Closing tags such as <br /> should be enclosed like so, not like this: <br>
And you've used inline styling. This is not bad at the moment because we're just starting out, but later on you will want to create a .css file to store them styles in (the inline styles is CSS, so you're doing two languages in one page at the moment!)
Here's how you can segregate your HTML code from your CSS styling:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body /*affects the <body> tag only*/
{
background-color: black;
}
h1.property /*the "property" class only affects <h1> tags with "property" as their class value*/
{
color:white;
font:arial;
font-size:40px;
}
p#property /*the "property" ID only affects <p> tags with "property" as their ID value*/
{
color:white;
font:verdana;
font-size:15px;
}
</style>
</head>
<body>
<h1 class="property">Alex Franklin is a <big> beast</big></h1>
<p id="property">Tom will love this<br />Do you like it?</p>
</body>
</html>
-->
</body>
</html>