HTML5: HTML Tags

The tags introduced in HTML5 are more descriptive such as:

main, header, footer, nav, video, article, section, audio & many more. 

These tags helps with Search Engine Optimization (SEO) and accessibility. The main tag helps search engine and other developers find the main content of your page. 

Adding an image to your page:

  • Using img element by pointing it to a specific image's URL using the src attribute. This img tag is self-closing. The img tag must come with alt attribute to help screen readers especially when the image is failed to load (might be due to heavy load, internet connection and whatnots). alt attribute should contain a description of the image to help screen readers understand it.

Link to external pages:

  • Using a (anchor) element to link to any external pages
  • The a tag contains href attribute which contains the destination page's URL
  • The tag should also contain anchor text to allow clickable text which will direct user to the destination page
  • </a> is the closing tag
Link to internal sections within the page:
  • Using the same anchor element as explained above
  • However, the assigned link's href attribute need to include a hash symbol # followed by the value of the id attribute for the intended element
To open the link in a new tab:
  • Add the following code: target="_blank" after the href attribute

Comments

Popular posts from this blog

How to: Display Data from SQL Database in HTML Table - Bootstrap 5

How to: Display Data from Database in Pagination