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
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>
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.
GET YOUR FREE HTML5 & CSS3 EBOOK!