The 10 HTML Tags Beginners Aren’t Using

The 10 HTML Tags Beginners Aren’t Using

Tutorial Details
  • Difficulty: Beginner
  • Completion Time: 10 Minutes

Let's go back to the basics for this one. Everyone reading this at least knows what HTML is. I believe that, no matter what experience level someone has, reviewing the foundation can help increase knowledge. It also helps to hone skills, especially with the constantly evolving technologies that drives the Internet.

There has also been a lot of talk of change with HTML 5. Every tag that I mention below is supported in both HTML 4.01 and HTML 5. While some of these tags are already widely used; I would like to challenge some of the ways that we use and think about them.


1. <!– –>

Any book you read about programming will tell you that it is good to explain what you are doing. Why are comments a good idea? For that exact reason. It helps those looking at your code know what is going on.

For HTML, commenting can seem like overkill; however, it can be used to define sections, and can help keep your code organized and structured. Labeling the beginning and end of a section really helps with the workflow.

<!-- Beginning of Nav -->
	<ul>
		<li>menu item 1</li>
		<li>menu item 2</li>
	</ul>
<!-- End of Nav -->
<!-- Beginning of Main Content -->
	<p>This is the main content.</p>
	...

2. Table Styles – <thead>, <tbody>, and <tfoot>

When I think back to the earlier days of web development, the first thing that comes to my mind is <table>. I abused this so much. When using <table> correctly, for tabular data only, it is possible to define styles for column headings, footer rows, and the body.

As boring as it is, it really does feel good to create a well-formatted spreadsheet. (This is speaking outside of web development.) Why should we not carry that simple task of formatting into great design? Each tag can then be easily styled within the site's stylesheet.

Just to clarify: these three tags all affect table rows.

ItemQty
Sum7
#13
#24

<thead>

Wrap table rows with <thead></thead>.

<tfoot>

Wrap table rows with <tfoot></tfoot>. The <tfoot> rows must also be above <tbody>. This is so that the footer row is rendered before the remaining data rows.

<tbody>

Wrap table rows with <tbody></tbody>.

<table>
	<thead>
		<tr>
			<td>Item</td>
			<td>Qty</td>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td>Sum</td>
			<td>7</td>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>#1</td>
			<td>3</td>
		</tr>
		<tr>
			<td>#2</td>
			<td>4</td>
		</tr>
	</tbody>
</table>

3. <optgroup>

Dropdowns are a great way to present data to a user for selection. They not only are conscious of screen real estate, but are familiar and easy to use. The great thing is with <optgroup>, it is possible to create categories (or we could call them headings) for your options.

<select>
	<optgroup label="Baseball Teams">
		<option value="Detroit Tigers">Detroit Tigers</option>
		<option value="Chicago Cubs">Chicago Cubs</option>
	</optgroup>
	<optgroup label="Football Teams">
		<option value="Detroit Lions">Detroit Lions</option>
		<option value="Chicago Bears">Chicago Bears</option>
	</optgroup>
</select>

4. Headings – <h1>,<h2>,<h3>,<h4>,<h5>, and <h6>

I know everyone uses heading tags. But, to be honest, I do not remember when the last time was that I used <h3> or lower though. I have no good reasoning aside from I didn't think about it and used something less semantic, like styling text in a <div>.

My point here is: Don't create more work for yourself. Remember to use all of the heading tags.


5. <fieldset> and <legend>

I like sites that have easy to find information with logically separated elements. I think it looks sleek. <fieldset> groups together form elements by drawing a box around them. It is also possible to add a caption to the form by using <legend>.

Fieldset Example
<form>
	<fieldset>
		<legend>General Information: </legend>
		<label>Name: <input type="text" size="30" /></label>
		<label>Email: <input type="text" size="30" /></label>
		<label>Date of birth: <input type="text" size="10" /></label>
	</fieldset>
</form>

6. <label>

This is possibly one of my favorite HTML tags. The label tag does not do anything for styling. It adds functionality.

<label> is used to define a label to an input element. So what's the big deal? When used, the label itself becomes clickable, making the corresponding input field active. This works for text boxes or radio buttons.




<form>
	<label>Name: <input type="text" size="30" /></label>
	<label>Male: <input type="radio" name="sex" /></label>
	<label>Female: <input type="radio" name="sex" /></label>
</form>

7. <blockquote>

If you are looking to create a dramatic effect to draw attention to a statement or sentence, you can use <blockquote>. White space is inserted before and after the element, by default. Margins are also added to offset the contained text from the other content.

This is also a great way to do things such as a traditional block quote. (I know that was horribly obvious.) Most times, when I write a tutorial, I take a direct excerpt from another site or source. I will use <blockquote> to set this apart.

This is what Nettuts+ uses for its blockquote styling.


8. <cite>

I don't want to say that <cite> is related to <blockquote>, but I know that I normally end up using them in conjunction.</p>

Think of <cite> when you need to provide a citation for something. If you are fresh out of college, think of providing the list of your references at the end of your papers. Remember, in MLA format, book and periodical titles are to be italicized.

"We love beautiful typography, and we appreciate the efforts of designers who come up with great typographic techniques and tools or who just share their knowledge with fellow designers."- smashingmagazine.com

<blockquote>
	<p>"...this is some great quote." <cite>- someGreatPerson</cite>
</blockquote>	

9. <dl>

Using lists is a great way to organize information. Everyone is aware of <ul>, but how often are <ol> and <dl> used? Perhaps the reference to “definition list” confuses some beginning coders into thinking that they can only be used when inserting terms and definitions – however, this is not really the case.

Types of Lists

  1. Unordered List (ul)
  2. Ordered List (ol)
  3. Definition List (dl)

What They Do

  • Unordered List (ul): A bulleted list
  • Ordered List (ol): A numbered list
  • Definition List (dl): A list with definitions to the elements

Reasons to Use Lists

  • Consistent styling
  • Easy to create
  • Very versatile

Each list type displays information in a valuable way. I don't think I need to explain <ul> and <ol>, but let's take a closer look at the structure of a definition list.

<dl>
	<dt>This is list item #1</dt>
		<dd>This is the definition of list item #1</dd>
	<dt>This is list item #2</dt>
		<dd>This is the definition of list item #2</dd>

Instead of only declaring a list type (<ul> or <ol>) and each list item (<li>), we use <dt> and <dd>. <dt> defines each list item and <dd> describes the above item.


10. &#39;(and other ASCII characters)

It is proper coding to use HTML ASCII codes when using any symbols. It’s a bit more work, but it will ensure that the characters are rendered properly, and are not confused by the browser as part of a string or other markup. Have you ever come across some text on a webpage that didn't look correct? Maybe something like this: "I didn#%%!t use HTML to render the apostrophe."

The above example is forced, but I think it conveys the idea.

The character-sets used in modern computers, HTML, and Internet are all based on ASCII. –w3schools.com

w3schools.com has a great HTML ASCII reference page for ASCII characters. I encourage everyone to check it out and memorize a few of the most commonly used characters, like the apostrophe, quotes, ampersand, and the "at sign."


Thanks so much for reading!

Tags: html
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.hyaho.ch hyaho.ch

    oups, i meant the “label” element…
    r.

  • http://www.jc-designs.net/blog Jeremy Carlson

    Nice article. I knew about the dl tag, but I was not aware of the dt and dd. I’ve never had call to use a definition list, but it is good to know. Thanks.

  • http://www.uidesignguide.com uidesignguide

    It’s also important to note that are used to help with screen readers.

  • http://sigurdhsson.org/ Simon Sigurdhsson

    None of these are tags; #2-#9 are elements, #1 is simply a comment, and what’s referred to in #10 are entities. Not that we need entities (if you aren’t already using UTF-8 you should start right now).

    • http://bounteo.us/ Rob

      Agreed, especially about #10. Entities were only necessary for characters that couldn’t be encoded by ASCII. I can’t think of any acceptable excuse for not using UTF-8.

    • Kate M

      Actually these, except #10, are tags. The use of the word tag when referring to html is just anything in markup that delimits an element. Which is basic html syntax. Almost anything that uses start tags, , is considered a html tag. The comment tag is a tag because it directly affects the html code. Either to augment parts of it or to place in documentation. However, is not, because it is used strictly to communicate with the browser to set the version of code used rather than actually directly affecting the code like the comment tag would by not making something visible.

      The comment tag is sometimes disputed as a tag because it uses comment delimiters instead of a element name but I figure there is always one or two oddballs in coding syntax.

  • Matthew

    Accessibility is a HUGE reason to be doing many of these things. Your web forms are INVISIBLE to millions of blind users if you have not defined labels for them. Headings help screen reader users navigate through the page, past all your hundreds of navigation links to the article content. Without table headings, tables become massive blobs of numbers with no context. Option groups let screen reader users drill through the menues, rather than reading possibly dozens of unwanted choices.

    Every web developer should include accessibility as a primary goal, and I hope more accessibility articles start making it into these kinds of developer websites.

  • http://www.zhouqicf.com ZhouQi

    NO.8 : the tag “” has no “”.

  • http://www.flo-s.com Florian Narr

    Everyone use all the new technology but forget the roots of html and how easy it is!

  • nico_nico

    Good article. Though I knew almost every tag in this list, I have to admit I could use them in a better way.

    Also, there is a funny end of paragraph (</p>) in #8

    • Proofreader

      Nearly 7 months later and that funny end of paragraph tag in #8 is still there!

  • http://www.khantony.com khantony

    These tags seems really interesting. I wish I would use these tags in my website. nice tutorial.

  • Dave

    Re: commenting. Semantic (therefore useful) markup can be used to do the same thing. Rather than embed semantic information in a comment, use a class or id attribute. Comments should be reserved for why, not what.

    • Rich

      I completely agree. Comments are useful, but they tend to be over used. I think most good programming books would say the opposite, i.e. code should make sense by itself and not rely on comments to be understood.

      • http://www.twitter.com/imaNORWAL Nicholas

        (I’m well aware that I’m many months late in a response here!)

        Just because code makes sense doesn’t mean you shouldn’t include comments. Often times when I’m working on some Javascript or HTML code, I’m working with a powerful text editor that can hide (or highlight beginning+ending lines) all of the text within an element, set of curly brackets, etc… But I still include comments simply so I can, at a glance, know exactly what section begins and ends where.

        I make it even easier for myself by typing all [short] comments in all caps so it stands out against the rest of my markup.

  • http://superdit.com aditia

    you’re truly right, first I create a website never use all that tag except header

  • http://conecode.com Ryan

    When I read the title of this article I thought for sure doctype was going to make the list. I guess you can’t limit that mistake to just beginners though. I’ve actually seen websites created by experienced developers that don’t have the doctype tag.

  • anon

    good list. These were the things I learned In my first lesson in college. Together with ofcourse the doctype. it’s unbelieveable how many people forget their doctype ….

  • http://www.killervoltage.com Ivan Frantar

    You didn’t close your tag on point “8. Cite”. Should be …..….. ;)

    • http://www.evelt.com/ joel k

      it’s closed alright
      the isn’t

      btw is totally new to me, i never saw it in action.
      thanks

    • http://www.evelt.com/ joel k

      it’s closed alright
      the ‘p’ isn’t

      btw ‘cite’ is totally new to me, i never saw it in action.
      thanks

  • Arun

    This one really helped me realize some very simple things and how things could have been used more efficiently. Thank you for your decent & nice article.. B-)

  • Danny

    I opened this and thought “right, okay lets see, surely theres no need for an article reminding us about the basics of html” – how wrong i was.

    I could plea guilty for not doing a good number of the things above i’m ashamed to admit!

  • Mark de Wit

    I’ve never even seen the tag. Oh well, I guess I always knew I would have a lot to learn.

    Thanks for the reminder of these basic, but important tags.

  • http://www.dodoing.info Mike

    Fine,

    Now we can use another tools, but what about those ?

    Mike.

  • http://forums.doooni.com دنيا الدلع

    thanks a lot’s

  • elephantroom

    Can someone please clarify why exactly it is better to use the entity number (©) than the entity name (©) ?
    They’re both based on the same character set (ISO-8859-1)..

    http://www.w3schools.com/tags/ref_entities.asp

    http://lachy.id.au/log/2005/10/char-refs#charref-entity-ext

    • http://moronicbajebus.com Seamus

      It is fine to use the named entity instead of the number version. The point was to use entities for anything that is not a basic character instead of just copying the character in. Sadly it is an issue with the character encoding being used for the document; particularly with a CMS, it is safer to use entities.

      • Dan Stever
        Author

        Well put. Thanks Seamus.

      • Rui Palmeira

        @Seamus CMS’s have hard times with character encodings because they mostly use PHP, and I know how PHP is archaic with different charsets. I’ve had troubles with a school project because, we, at portugal fluently use chars like ~ , ^ , Ç , ç – just to name a few, and I’ve lost a few hours, trying either, encoding the database that was taking care of data with a different charset or the php files themselves :|

  • http://www.edwardmargallo.com Edward

    I feel cool for actually using all of this, hah, except for the tag

    Good post “reminder” post

    • Edward

      doh, i meant optgroup tag

  • http://swordair.com iifksp

    Nice! I used to forget using label tag.
    But #10 is about entities, not tags.

    • Dan Stever
      Author

      Wow. You guys are relentless about #10 being about entities… I can’t convince you to count a few of the multi-tag entries (like #5) in that “10 HTML tags” eh? ;) Haha!

  • http://www.s3psis.net/ Sepp

    Hm, well. If you introduce you also should mention .
    And with UTF8 you don’t have the issue #10. But it’s good if you write an & as &.

    • http://www.s3psis.net Sepp

      Sorry, it filters out my HTML Elements.
      It should be: “If you introduce {thead} you also should mention {th}.”

  • http://www.facebook.com/rabitula Rabi

    than you for this information, it’s quite useful for beginner..

  • http://engineercreativity.com/ Amit

    I definitely agree with your

    and terms. In addition, why use and ? I don’t quite see the point, as we can just make the a …Plus, it looks all weird in the markup, when the table footer is at the top.

    If it’s styling that the issue, you can always give the first row a class of “tHeader” or something, to give it separate styling..no?

  • http://engineercreativity.com/ Amit

    My apologies, I forgot HTML catches in comments, it’s been awhile. Here’s what I meant to say:

    I definitely agree with your <blockquote> and <cite>. In addition, why use and <thead> I don’t quite see the point, as we can just make the a $lt;tr$gt; …Plus, it looks all weird in the markup, when the table footer is at the top.

    If it’s styling that the issue, you can always give the first row a class of “tHeader” or something, to give it separate styling..no?

  • http://uxfront.com Thomas

    Nice summary but you missed some key info in the TABLE section. It’s not accessible as is.

    TH tags should be used inside the THEAD instead of TD. They’re “Headers” not just regular table cells. The first TD in each TBODY row should be a TH as well as they’re defining the content of the row.

    From there you need to use the SCOPE attribute to define column and row for the TH elements.

    <table>
    <thead>
    <tr>
    <th scope="col">Item</th>
    <th scope="col">Qty</th>
    </tr>
    </thead>
    <tfoot>
    <tr\>
    <th scope="row">Sum</th>
    <td>7</td>
    </tr>
    </tfoot>
    <tbody>
    <tr>
    <th scope="row">#1</th>
    <td>3</td>
    </tr>
    <tr>
    <th scope="row">#2</th>
    <td>4</td>
    </tr>
    </tbody>
    </table>

  • Jose

    On #6… Is the input tag within the label preferred over separating the two? When I started using labels I always thought they had to be separate. Would they need to be separate in order to use the for attribute? Does nesting the input inside the label allow you to not have to use the for?

    • http://www.uxfront.com Thomas

      @Jose I generally use them separate. There’s no requirement to enclose. I mainly depends on your layout and code structure. I find keeping them separate allows for more flexibility.

      You’re spot on about the ‘for’ attribute. If you enclose you don’t need the ‘for’. If they’re separate, you do.

  • oat

    thank for article. very useful :)

  • http://www abrilo

    I’ve never even seen the tag. Oh well, I guess I always knew I would have a lot to learn

  • Raghav

    Nice information provided.

  • Mohit

    Thanks for the article:)

  • http://www.ali-akbar.com john

    Thanks, but it’s not common

  • http://www.ali-akbar.com john

    Thanks, but I think it’s not common,
    Just like handwriting, every developer has an idea and own method

  • http://- ivan dobrashin

    hi guys
    i want to make a table using dl dt and dd tags. it must be border, padding and others.
    for example 10 rows and 6 colunms.

    how can i make it

    pls help.

    regards
    ivan

  • http://www.abhijit.biz The CSS Coder

    Great list! Same happens with me as I also don’t make use of few of these tags. I guess using them will indeed save a great deal of time and make a web page look more consistent. I have bookmarked you. Thanks!

  • http://www.glatelier.org/ PaBLoX

    My 2 cents:

    AFAIK, headings, blockquotes and such are html elements; not tags. Obviously every human being understand what it is, but anyway =P.

    Also, the cite element is supposed to “cite” works not persons, so the example would be incorrect according to the working draft of the WhatWG.

    Nice article! =)

  • http://techtubbie.com/ piyush

    thanks for the wonderful information… i am using google to find HTML tags information and then i find you thats again for posting a great information,…:)