X
PlanetHoster

Intro to HTML 101

Hypertext Markup Language makes up the ‘skeleton’ of most websites on the internet. Web developers currently use the version known as HTML5. The HTML code tells your web browser what to display when you visit a web page. This article won’t teach you how to build a website. However, it will provide you with the fundamentals of HTML code that you can use to start learning about web development.

 

 

Overview of HTML Tags and Elements

 

 

Tags tell a web browser how to structure content on a web page. Elements are the content (titles, text, images, and videos) that are displayed within tags. Most HTML elements contain opening and closing tags that have text and/or other tags between them. Also, elements can be nested inside other elements. Most tags are used to describe and structure the content that they surround. However, some tags – like for images and videos – have a very specific purpose. Here are a few examples of tags:

  • The <! DOCTYPE html> is a declaration that tells the web browser the version of HTML that you are using. This tag always belongs on the very first line of code.
  • The <html> element will contain all of your HTML code.
  • Information about your web page – like the title and description –  is contained in the <head> of the page.
  • You create a page title using the <title> element within the head section. The page title displays at the top of your web browser.
  • Anchor tags (<a>) are used to link to other sections on your web page, as well as to other web pages – either on your website or an external website.
  • All of the content that is displayed on a web page will be contained within the <body> element.

Leaving whitespace between elements and using indentation will make your code easier to read. Building a website requires dozens of tags and elements. For a complete list, visit the W3 School’s free online web tutorial.

 

 

Creating Tables to Display Data

 

 

Displaying data in a table makes your website easier to read and more user-friendly. Here is an overview of the tags needed to build a table using HTML.

  • The <table> element creates a table.
  • The table’s head is created with the <thead> element.
  • A table’s body is created with the <tbody> tag.
  • The <tr> tag adds rows to a table.
  • You can add data to a table row by using the <td> element.
  • The <th> tag adds a heading to your table. Table headings are important to specify the meaning of data.
  • The <tfoot> element creates a footer at the bottom of the table.

You can find a complete list of table tags and how to structure them from one of many free online resources that you can find by just searching Google for them.

 

 

Creating Forms to Collect Information From Your Website’s Visitors

 

 

The purpose of a form is to allow your site’s visitors to input data and send it. Therefore, if you plan on collecting any data from your site’s visitors, you will need to build a form to collect that data. Of course, you will create a form using several form tags:

  • Similarly to creating a table, you start your form by using the <form> element.
  • Inside the form element, you will use the <input> tag to specify the type of data that your form will collect like text and numbers.
  • You can also set a range of numbers, as well as a checkbox or radio button to submit the form.
  • You can also create a password attribute to censor the text that the user is entering into the password field.
  • The <textarea> element contains a text input field with a customizable area.

The W3 School’s free online web tutorial offers an in-depth explanation on how to build forms using HTML code. You can also find other free online resources by searching on Google.

 

 

Client-Side Validation for Forms

 

 

Client-side validation occurs in the web browser before information is sent to the web server. This is an important step to prevent malicious software from being sent from a hacker to your web server.

  • Adding the “required” attribute to the <input> element in forms will validate that the input field has information in it.
  • You can assign a value to the  “minlength” attribute and a “maxlength” attribute to specify the respective minimum and maximum number of characters allowed.
  • You can also assign attributes that specify the data that the user is allowed to submit.
  • Lastly, you can assign an attribute that gives the user an explanation when the validation fails.

These little checks ensure that the data submitted by users is correct and safe for your web server. They also provide the user with immediate feedback on what data they need to correct if validation fails.

 

 

The Benefits of Semantic HTML

 

 

Semantic HTML offers more meaning to a web page through specific elements that provide context as to what is in between the tags.

  • You can categorize the different elements of your site into respective categories like the heading, navigational links, articles, and footer.
  • Let’s say that you want to embed media files on your site. You can include a caption to describe the media files.
  • Semantic HTML makes websites more accessible for visually impaired persons who use screen readers to translate the content on web pages.

Basically, Semantic HTML makes sites more user-friendly for your visitors and more SEO-friendly for search engines.

 

In short, learning HTML takes time and lots of practice for most beginning web developers. Therefore, you will need to find a good online resource to learn and practice – like the W3 School’s free web tutorial or another free resource that you can find from a Google search. Once you learn the HTML tags, you can start building the main elements of a website. Building tables to display data will make your site more user-friendly. You can also create forms to collect data from users. Enabling client-side validation will protect your web server from a hacker sending malicious software to it through any forms on your site. Semantic HTML will improve the user experience, as well as increase your site’s organic search rankings.