HTML Coding Tips for Beginners

Congratulations on your decision to learn HyperText Markup Language (HTML). Consisting of elements and tags, it’s the markup language used to create webpages. As a beginner, though, you may feel overwhelmed at the sheer amount of tutorials and information available on HTML. So today we’re going to reveal some simple HTML coding tips that every newcomer should know.

Declare the DOCTYPE

One of the first things you should do when coding a webpage is declare the DOCTYPE. Short for “document type declaration,” it tells the validator which version of HTML or XHTML (or both) the page is using. Declaring the wrong DOCTYPE, or not declaring one at all, prevents web browsers from understanding your code, which can lead to rendering and other problems.

DOCTYPEs are placed at the top of the page, before the <html> tag or any other element. There are three different DOCTYPEs for HTML 4.01, but only one for HTML 5: <!DOCTYPE html>

View Source Codes

Whether you use Firefox, Chrome, Internet Explorer, Microsoft Edge, or any other web browser, you should get into the habit of viewing the source code of webpages on a regular basis. Doing so will reveal the HTML code used to design the webpage. You’ll be able to see first-hand which tags were used, how they were implemented, and what the finished project looks like.

Download (and Use) Firebug

What is Firebug and why should use it? It’s a free-to-download, open-source browser plugin for FireFox that’s used to view, edit and debug HTML, CSS and JavaScript on any webpage. While you can view HTML source codes directly from your web browser, it typically only shows you the original HTML. Firebug’s HTML viewer, on the other hand, shows you what the webpage’s HTML looks like after it has been transformed by JavaScript — and any elements transformed by JavaScript are automatically highlighted for easier reference. Furthermore, the tabs on the right-hand side allow you to see the properties of elements included in the HTML, such as CSS styling rules, DOM properties, and more.

Close Your HTML Tags

Opening HTML tags must be closed with the respective tag at the end. Without a closing tag, the element will not render properly. See below for an example.

<p>This is a sentence without a closing tag
<p>This is a sentence with a closing tag</p>

Validate

When coding a new webpage, run it through an HTML validator to check its markup. As long as you routinely validate your webpages while designing them, you can catch errors early, before they progress into bigger problems. The W3C Validator is an excellent, free-to-use tool, although there are several web browser plugins/extensions which perform this same operation. Regardless, make sure you are validating your webpages on a regular basis.

Thanks for reading, follow your passion by finding the perfect course, just for you over on www.stoneriverelearning.com.

Online Technology Courses Stone River eLearning

GET YOUR FREE HTML5 & CSS3 EBOOK!

Comments