Weird HTML Tags


Here is a weird way to get your head round how HTML code works.
HTML code describes things on a web page.
Imagine if it described things in real life!

Tags


Imagine we want to write a dog in HTML code.

Here's how we could do it:

<dog> </dog>


The dog has an opening tag (<dog>) and a closing tag (</dog>).


Now imagine we want to write a ship in HTML code.

Here's how we could do it:

<ship> </ship>

Tags Inside Tags


Now we want to put the dog inside a ship.
Dog in ship
Here's how we could do it:

<ship><dog> </dog></ship>


You can see the dog's tags are between the opening ship tag and the closing ship tag.


Say we want to put the dog next to a ship.

Here's how we could do it:

<ship> </ship><dog> </dog>


You can see the dog's tags are after the closing ship tag.

Attributes of Tags


Imagine we want to give the dog a name.
We need to use an attribute inside the opening dog tag

Here's how we could do it:

<dog name="Dog"> </dog>


We've named our dog "Dog" (we're not very inventive, but we love him).


Let's give the dog pink fur.
We'll use another attribute inside the opening dog tag

Here's how we could do it:

<dog name="Dog" color="pink"> </dog>


The dog has now been coloured pink.


Oops! Dog doesn't look very happy. Let's make him smile.
We'll use yet another attribute inside the opening dog tag

<dog name="Dog" color="pink" mouth="happy"> </dog>


The dog has now been coloured pink and is happy.


Taking things further


Now, try writing yourself and friends in weird HTML code.
Or try our Weird HTML quiz!

Go Berserk Book

Buy Now to buy for
£11.99 US$17.99 €13.99 (not incl. P&P)
for 1 or 2 books
Buy more and save!
Email sales@go-berserk.com
for 3 books or more.



Go Berserk CSS Book

Buy Now to buy for a special price of
£8.99 US$13.99 €11.99 (not incl. P&P)
for 1 or 2 books
Buy more and save!
Email sales@go-berserk.com
for 3 books or more.