Monday 13 June 2011

HTML: Tags

HTML stands for HyperText Markup Language, and it's primarily used for building websites. It's composed of tags and attributes.

A tag is noted by being inside angle brackets, such as <a> or </p>, most of these need to be opened and closed around what they're affecting. For instance, if I wanted to started a paragraph that simply contained "This is a paragraph", I would type:

<p> This is a paragraph </p>

which shows up as:

This is a paragraph

Simple, right? Some tags don't need ending tags coupled with the starting one, such as the break tag, <br>, which simply inputs a new line, so a beginning and end doesn't make sense.


To start an html document, you can simply use notepad, but make sure your document starts with <html> and ends with </html>, and is saved as a .html so you can run it in a browser. Try playing around with your own page, testing various tags on text, here's what I was playing around with.


bold:    <b>
italics:    <i>
underline:    <u>
strikethrough <strike>


Don't forget to end your tags. Next up is attributes. These are parts of a tag, to give substance to the tag itself. For instance, there's the <font> tag, which is pretty boring on it's own. But you can add an attribute for size and color to it,

<font color="red" size="+1"></font>

Note that the attributes do not affect the closing tag. The +1 in the size tag just means 1 size up from the default, and for specific shades of red, or some other color, you can replace "red" with the 6 digit hexadecimal (base 16) value, starting with #.

For example,

color="#000000"
color="#FFFFFF"
color="#AA55CC"




The numbers denote values above 9, going to a maximum of F, with each set of 2 characters referring to the color values Red, Green, Blue.

So, have fun playing with this stuff, and I'll see you next time.

No comments:

Post a Comment