HTML Basics Part 8: HTML Attributes
In this part of the HTML Basics series, I will continue with talking about HTML attributes in detail.
In the previous part of this tutorial, we mentioned that HTML Elements can have attributes. The reason why we need attributes is to better define the elements on a web page. Let's take a look at the following example first and then we will continue with the important points of HTML attributes.
<a href="http://www.example.com/">My Site</a>
<img src="logo.jpg" width="200" height="120" title="My Site">
<p class="tutorial">This is a paragraph.</p>
In the above example, a link, an image and a paragraph element are given with attributes. The below table shows each element, its attributes and the attribute values.
Important Points About HTML Attributes
- HTML elements take attributes to provide information about web page elements.
- All HTML elements can take attributes.
- An HTML element can take multiple attributes, e.g. <img>.
- The start tag holds the attributes.
- Attributes store the information in their value which is given inside quotes.
You can use lowercase or uppercase letters for attributes and attribute values in your HTML code, but you should know that using lowercase letters is a recommendation of World Wide Web Consortium (W3C) for HTML 4 and a requirement in XHTML.
For a detailed list of attributes and their descriptions, please check the HTML Reference section.
Up to now, we talked about the sytax and general use of tags and elements in HTML. We will start going into details with the main elements of an HTML page in the next part.
More HTML Tips
HTML Basics Part 9: HTML Main Elements HTML Basics Part 7: HTML Elements HTML Basics Part 6: HTML Tags HTML Basics Part 5: HTML Syntax HTML Basics Part 4: Getting Started with HTML HTML Basics Part 3: What is HTML (in Detail)? HTML Basics Part 2: The Structure of a Basic Web Page HTML Basics Part 1: Introduction to HTML Publish Your First HTML Website Online Today How to Change HTML Code in Multiple Files at OnceHTML Tips