In HTML, it’s not mandatory to close all elements (e.g., the <p> element).
Nevertheless, we highly recommend closing all HTML elements, following this syntax:
<section> <p>This is a paragraph.</p> <p>This is a paragraph.</p> </section> |
<section> <p>This is a paragraph. <p>This is a paragraph. </section> |
While HTML permits mixing uppercase and lowercase letters in attribute names, it’s advisable to opt for lowercase names. Here’s why:
<a href=”https://www.code7school.com/html/”>Visit our HTML tutorial</a> |
<a HREF=”https://www.code7school.com/html/”>Visit our HTML tutorial</a> |
Although HTML permits attribute values without quotes, it’s advisable to use quoted attribute values. Here’s why:
<table class=”striped”> |
<table class=striped> |
This approach won’t function as expected due to the presence of spaces in the value.
<table class=table striped> |
It’s crucial to always include the alt attribute for images. This attribute serves as vital descriptive text if the image fails to display for any reason.
Additionally, it’s advisable to define the width and height of images. Doing so minimizes flickering by allowing the browser to allocate space for the image before loading it.
<img src=”html5.gif” alt=”HTML5″ style=”width:128px;height:128px”> |
<img src=”html5.gif”> |