DONATE  
MENU
AJAX
JAVASCRIPT
HTML
JSON

HTML Tutorials

INTRODUCTION

» Introduction to HTML

» PRACTICE IT Editor

» Getting Started

» HTML Example

» HTML Tags

» HTML Elements

» Nesting Tags

» Block & Inline Elements

» HTML Attributes

» HTML Comments

» File Paths

» HTML Entities & Symbols

TAGS/ELEMENTS

» Important Tags

» HTML Headings

» Text Formatting

» HTML Links

» HTML Lists

» HTML Tables

» HTML Images

» HTML Audios

» HTML Videos

» HTML Iframes

» HTML Styles

» HTML Scripts

» Semantic Elements

» HTML Metadata

ATTRIBUTES

» Elements' ID

» Elements' Class

» Elements' Style

» Element's Align

» Element's Height & Width

HTML FORMS

» HTML Forms

» Input Elements

» HTML Textarea

» HTML Select

HTML EXAMPLE

» Login Page

.. » HTML » Introduction » HTML Attributes
Share Tweet WhatsApp

HTML Attributes

An HTML attribute helps extend and give more information about and to HTML elements. Extend because HTML attributes can help us display elements very properly from the way they were supposed to be originally display using CSS and JavaScript. These attributes are contained in the opening tag of an element and are usually in name=value pairs where the attribute value is the value of the attribute contained in either single or double quotes. Nevertheless, there are some attributes that do not have values (For the purpose of this tutorial, we shall call them empty attributes). Non - empty attributes
<h1 id='bighead' style='color:red;'>Welcome to My Page</h1>
Above, we can see examples of HTML attributes extending the <h1> element by assigning a unique id (using id attribute) and some styling (using style attribute) to the element. Empty attributes
<audio controls></audio>
<input type='radio' checked/>
Above, we can see examples of empty attributes (controls and checked). HTML have a lot of predefined attributes. Some are general attributes usable on all HTML elements like the: class id style While some are limited attributes usable on a handful of elements like the: value for form elements href for link elements src for multimedia elements. As you continuously engage in learning and creating HTML pages, you will get familiarized or acquainted with more of HTML attributes. SUMMARY
  1. Attributes gives more information about HTML elements. For example, the id attribute giving a unique id to an element.
  2. They also give information to HTML elements to help them display properly. For example, the style attribute giving styles that should affect an element.
  3. Attributes are contained in the opening tags of elements in name=value pairs. For example,
    <p attributeName="attributeValue">Hello World</p>
  4. An HTML attribute value should be contained in single or double quotes. This helps separate the value from other texts or attributes.
  5. You can have as many attributes as you want on an element.
    <a href='' style="" id="" class="">Go</a>
Take a short quiz on HTML Attributes.
Ask a question or tell us if HTML Attributes is easy or not.
cent?

Join our 1,090 subscribers to receive tutorials' updates!

  We won't spam your mail box. We hate it.





StackBeginner 2021 © Joseph Omamode