HTML Coding Tips

Read these 6 HTML Coding Tips tips to make your life smarter, better, faster and wiser. Each tip is approved by our Editors and created by expert writers so great we call them Gurus. LifeTips is the place to go when you need to know about Html tips and hundreds of other topics.

HTML Coding Tips has been rated 3.1 out of 5 based on 369 ratings and 20 user reviews.
What are some of the new tags and functions in HTML 5?

What's New in HTML 5?

One of the major differences between HTML 5 and HTML 4.1 is the doctype. It's much shorter and easier to remember. To instruct the browser that you're using HTML 5, all you need to do it include this tag at the beginning of your document:

<!DOCTYPE html>

Like previous versions of HTML, you must have an opening head, title and body with appropriately-nested closing tags. However, you can now use container tags such as "<article>", "<aside"> and "<footer>" to better organize the content of the websites that you develop. Previously, you might have used divs with classes and IDs for the same function. In this way, HTML 5 is much more semantic.

The way HTML 5 handles forms is much improved, too. You can use tags to define key generators, marks and meters and even progress bars. Previously, you might have manually used tables or images to show the user progress while completing a survey, but you don't need to do this when using HTML 5.

Tags for using and show Ruby code have been implemented in the newest specification. Furthermore, you can more easily embed audio and video content with the new HTML 5 tags. A final change allows you to easily create detail and summary blocks that minimize and maximize when the user clicks them.

   
How can I display special characters using HTML?

Entities

Have you ever wanted to place special characters in a web page? HTML allows us to view special characters and other symbols that would otherwise be interpreted as markup by the browser through the use of character and numerical entities. All characters in the ISO8859-1 character set have a numerical and/or character entity. Here's a quick example:
type: & e grave (without extra spaces)
to produce this: è

   
Do all HTML tags need a closing tag?

Don't Forget to Close Your Tags!

Since the introduction of the 4.0 browser and HTML 4.0, it's become increasingly important to ensure that all tags within your HTML code have a closing tag. By doing this you greatly increase your page's compatibility with the Netscape browser, and equally important, you reduce the time it takes for your page to load because the browser doesn't have to do time-consuming guesswork when interpreting your code.

   
How do I place comments within my HTML code?

Placing Comments

When you write your HTML documents, insert comment tags to remind yourself what you're doing, when things need to be updated, and anything else you think might be useful in the future. Comment tags begin with !-- and end with -- (inside brackets < > )

It's generally a good idea to follow these 2 rules when using comments; first, place comments on a line apart from other HTML text. Secondly, don't use special characters (<, >, !, &) within your comment tag.

   
How do I create a table?

So you want to add a table..

Tables, when used properly, allow webmasters an easy way to attractively organize the content of web pages. Don't be intimidated by tables, they're your friends.

The most important thing for beginners to remember is to make sure that all rows have the same number of columns (that's not to say they have to, but that's a little more advanced topic). Even if the columns are left empty in some rows, they must be included. Now I'll show you 2 things; a very basic table, and the code that produced it. From this basic example you should be able to expand it to meet whatever needs you have. Try varying the number of rows and columns until you are comfortable working with tables. Once you master the table, the possibilities are endless.
Tr = table row td = table column








The 3 Stooges
MoeLarryCurly

Now, the code.

<table>
<caption>The 3 Stooges</caption>
<tr>
<td>Moe</td>
<td>Larry</td>
<td>Curly</td>
</tr>
</table>

Good Luck!

   
How do I know if my HTML code is valid HTML?

Validate

Ensuring that your HTML code complies with the latest specs allows you to be seen by the largest number of people, regardless of browser. All browsers can interpret valid HTML, the problems arise from new versions of both the browser, and HTML. Many tricks are browser specific, meaning they work fine in one browser or browser version, but not in another. These enhancements are generally written by the browser maker (ie Microsoft or Netscape) and don't fully comply with HTML Standards.
If you are not knowlegeable in HTML code, it is worth the expense to find someone to validate your code. It's much cheaper than having someone completely design your site, but will identify to you any errors and potential problems with the code. Having valid code will usually make your pages load faster also.

   
Not finding the advice and tips you need on this Html Tip Site? Request a Tip Now!


Guru Spotlight
Lynda Moultry