Sunteți pe pagina 1din 9

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

Advertise Here

The10HTMLTagsBeginners ArentUsing
Dan Stever on Jun 21st 2010 with 120 comments

TutorialDetails
Technology: HTML Difficulty: Beginner 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.

1 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

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. view plaincopy to clipboardprint? 1. 2. 3. 4. 5. 6. 7. 8. 9. <ul> <li>menu item 1</li> <li>menu item 2</li> </ul>

<p>This is the main content.</p> ...

2.TableStyles<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. Item Qty #1 3 #2 4 Sum 7

<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.

2 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

<tbody>
Wrap table rows with <tbody></tbody>. view plaincopy to clipboardprint? 1. <table> 2. <thead> 3. <tr> 4. <td>Item</td> 5. <td>Qty</td> 6. </tr> 7. </thead> 8. <tfoot> 9. <tr> 10. <td>Sum</td> 11. <td>7</td> 12. </tr> 13. </tfoot> 14. <tbody> 15. <tr> 16. <td>#1</td> 17. <td>3</td> 18. </tr> 19. <tr> 20. <td>#2</td> 21. <td>4</td> 22. </tr> 23. </tbody> 24. </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.

Detroit Tigers
view plaincopy to clipboardprint? 1. <select> 2. <optgroup label="Baseball Teams"> 3. <option value="Detroit Tigers">Detroit Tigers</option>

3 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

4. <option value="Chicago Cubs">Chicago Cubs</option> 5. </optgroup> 6. <optgroup label="Football Teams"> 7. <option value="Detroit Lions">Detroit Lions</option> 8. <option value="Chicago Bears">Chicago Bears</option> 9. </optgroup> 10. </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>. view plaincopy to clipboardprint? 1. <form> 2. <fieldset> 3. <legend>General Information: </legend> 4. <label>Name: <input type="text" size="30" /></label> 5. <label>Email: <input type="text" size="30" /></label> 6. <label>Date of birth: <input type="text" size="10" /></label> 7. </fieldset> 8. </form>

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

4 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

<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. Name: Male: Female: view plaincopy to clipboardprint? 1. <form> 2. <label>Name: <input type="text" size="30" /></label> 3. <label>Male: <input type="radio" name="sex" /></label> 4. <label>Female: <input type="radio" name="sex" /></label> 5. </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.

5 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

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 view plaincopy to clipboardprint? 1. <blockquote> 2. <p>"...this is some great quote." <cite>- someGreatPerson</cite> 3. </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 denition list confuses some beginning coders into thinking that they can only be used when inserting terms and denitions however, this is not really the case.

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

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

ReasonstoUseLists
6 de 9 16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

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. view plaincopy to clipboardprint? 1. <dl> 2. <dt>This is list item #1</dt> 3. <dd>This is the definition of list item #1</dd> 4. <dt>This is list item #2</dt> 5. <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;(andotherASCIIcharacters)
It is proper coding to use HTML ASCII codes when using any symbols. Its 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!

7 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

PeixeUrbano.com.br/Cadastre-se

Ads by Google

Find more web development tutorials on Tutsmarketplace

ByDanStever
This author has yet to write their bio.

8 de 9

16-01-2011 01:30

T he 10 HT ML Tags Beginners Arent Using | Nettuts+

http://net.tutsplus.com/tutorials/html-css-techniques...

9 de 9

16-01-2011 01:30

S-ar putea să vă placă și