HTML is a coding language composed of various types of tags, also known as elements. These are what are used to build web pages. They are the Lincoln Logs of the Internet.
<!DOCTYPE html>
<html>
<head>
<title>My House</title>
</head>
<body>
<p>My house is a very very very fine
house, with two cats in the yard.</p>
<p>Life used to be <strong>so
hard</strong>; now everything is
easy cause of you.</p>
</body>
</html>
Lets break down the page structure above. You can see above, all HTML tags are surrounded by angle brackets. You can also see that every tag has what is known as a closing tag. These are the tags that have a preceeding forward slash. For the most part, every HTML tag needs to have a closing tag.
tag | meaning |
---|---|
<head> | head (contains metadata) |
<body> | page body |
<div> | division |
<h1> | Heading (level 1) |
<p> | Paragraph containing text |
<span> | Text without a line break |
<img> | Image tag |
<link> | Link tag |
<style> | Style tag |
tag | example |
---|---|
<b> | bold |
<i> | italic |
<strong> | strong |
<em> | emphasis |
<br> | Line break |
<hr> | Horizontal rule (dividing line) |
<blockquote> | "call-out" quotation |
etc. |
Attributes further define HTML elements and their purpose. For example, an image tag may have the following attributes:
<img src="/images/cat-pic.jpg" title="Cat Picture" alt="Picture of a fuzzy cat">
src
defines where the image file is located.alt
is alternative text to be displayed if the image cannot be.style
(for inline CSS), title
(for hover-over tooltips), href
(hyperlink reference)This war has raged inside HTML since the beginning of the WWW.
Some tags exclusively describe how it's contents should be displayed (ex. <b>
), where as some describe it's contents (ex. <strong>
). Web content isn't just about appearence. It matters how it is intepreted.
div
).<strong>
and a <b>
tag?/