HTML: Headings, Lists and Comments.

Comments

Sometimes when creating code we’re going to want to leave notes for ourselves as reminders when we come back to edit it later. In order to make these notes visible only when looking at the code you’re going to want to use the comment tag <!– –>, which allows you to leave a comment that’s invisible outside of html view anywhere in the <body></body> of the text.

Your tags should look like this:

<body>
<p>
<!–this is where you write your comment –>
</p>
</body>

Headings

Headings allow you to add structure to the text by placing headings

Like This

at various points in the <body></body> of your page. They can go within paragraphs or be placed independently of them.

Headings come in six sizes, <h1> is the largest and <h6> is the smallest. When you add them to your code the tags should look like this:

<body>
<h1>
This is your heading.
</h1>
</body>

Lists

Lists are another way to add order to your text. There are two types, unordered and ordered – ordered lists are numerical while unordered produce bullet points. As with headings they can go anywhere in the <body> of the text, either between paragraph tags or independent of them, though its a good idea to put a list under a header giving its title.

To produce an ordered list your tags should look like this:

<body>
<h3> List of my favorite colours</h3>
<ol>
<li>Red</li>
<li>Teal</li>
<li>Purple</li>
</ol>
</body>

Which will then look like this:

List of my favorite colours

  1. Red
  2. Teal
  3. Purple

For an unordered list its almost the same, only you replace <ol></ol> with <ul></ul>:

<h3> List of my favorite colours</h3>
<ul>
<li>Red</li>
<li>Teal</li>
<li>Purple</li>
</ul>

Which will then look like this:

List of my favorite colours

  • Red
  • Teal
  • Purple

Important Note

You may have noticed that when I give examples of how to write the tags for each new piece of code we learn I open and close with body every time. The reason for this is to contextualise for you where in the page structure each type of tag belongs. You only need to use the body tags once on each document, not after each individual content tag (those are things like <p> and <h1>) is used. So far example, between the <body></body> tags on an individual document you could have multiple sets of the <p></p> tags, <h1></h1> and list tags all one after the other.

Advertisements
About

I'm an archivist living in Edinburgh. I have an undergraduate degree in medieval history and a special interest in early Christian and pre-Christian religion so I'll be talking about that quite a bit. I also cook, so I'll be posting recipes on here when I think of them.

Tagged with: , , ,
Posted in Learn to Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Hours & Info
07736364859
ball.information.management@gmail.com
9am-7pm
%d bloggers like this: