×

HTML5 Attribute

HTML Attribute

  • HTML attributes are special words that provide additional information about the HTML element or attributes.
  • The element or tags have attributes, which define the element's behavior.
  • It also adds attributes with a start tag.
  • The Attribute with its name and meaning pair should always be added.
  • The names and values of the attributes are case sensitive. Hence, W3C recommends that they should be written in Lowercase only.
  • We can add multiple attributes to an HTML element, but we require some space between two attributes.

Syntax

<element attribute_name="value">content</element> 

Example

<!DOCTYPE>
 <html>
 <head>
 </head>
 <body>
 <h1>This is Style Attributed</h1>
 <pstyle="height: 50px; color: blue">It will add style property in element</p>
 <pstyle="color: red">It will change the color of content</p>
 </body>
 </html> 
HTML5 Attribute

The title attribute in HTML

In most browsers the title attribute is used as a text tooltip. As user moves the cursor over a link or any document, it shows the content. To show the information of that connection or document, we can use it for any document or connection. We can take with paragraph tag and heading tag in our example.

Example

With <h1>tag:

<h1 title="This is heading tag">Example of title attribute</h1>

With <p>tag:

<p title="This is paragraph tag">Move the cursor over the heading and paragraph, and you will see a description as a tooltip</p>  

Code:

<!DOCTYPE>
 <html>
 <head>
 </head>
 <body>
 <h1 title="This is heading tag">Example of title attribute</h1> 
 <p title="This is paragraph tag">Move the cursor over the heading and paragraph, and you will see a description as a tooltip</p>
 </body>
 </html> 
HTML5 Attribute

The href attribute in HTML

The main attribute of < a > anchor tag is the href attribute.This attribute detects the link that is specified in the link. The href attribute provides a hyperlink, and if it is blank, it will remain in the same page.

Example

With link address:

<a href="https://https://www.tutorialandexample.com//html-anchor">This is a link</a>

Without link address

<a href="">This is a link</a>  

Code:

<!DOCTYPE html>
 <html>
 <head>
 </head>
 <body>
 <h1>Display of href attribute</h1>
 <p>Below is the link of anchor tag, click the link and see the next page</p>
 <a href="https://www.tutorialandexample.com/html-anchor">This is a link</a>
 </body>
 </html> 
HTML5 Attribute

The src Attribute

The src attribute is one of the important and required attributes for the < img > element.It is the source of the image that needs to be displayed on the browser. The attribute contains image in the same or other directory.The name or source of the image should be right, otherwise the image will not be displayed by the user.

Example:

<img src="whitepeacock.jpg" height="400" width="600">

Code:

<!DOCTYPE html>
 <html>
 <head>
 </head>
 <body>
 <h1>Example of src attribute</h1>
 <p>HTML images can be diplayed with the help of image tag and its attribute src gives the sourc for that image</p>
 <img src="https://static.tutorialandexample.com/htmlpages/images/whitepeacock.jpg" height="400" width="600"> 
 </body>
 </html> 
HTML5 Attribute

Related Topics

HTML <video> Tag

The Video tag in HTML is used to play video on a media player on the web page. We can also insert an audio by the video tag, but audio...

6 minutes read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.

How to Create a Portfolio Gallery using HTML and CSS?

First, before starting this, the user should know some of the basics of HTML and CSS to create a portfolio gallery. To add more functionality to the website, we can also...

7 minutes read.

Html &lt;datalist >Tag

The autocomplete feature in HTML files is provided by the <datalist> tag. It can be used in conjunction with an input tag to enable users to quickly fill out form...

4 minutes read.

HTML Id Attribute

The HTML id attribute represents the unique identifier for an element of the HTML document. Each element has its unique identifier. The id attribute is a global attribute that can be...

12 minutes read.

HTML &lt;blink> Tag

In HTML, the blink tag is used to create the text which flashes. The blink tag is an inline element in HTML. It is observed that the blink tag used...

2 minutes read.

HTML <section> tag

The section element in HTML is used to define sections in a document. Syntax of Section Tag: <body> <h1>……….</h1> <section> <h2>……….</h2> <p> …………………………</p> </section> <section> <h2>………..</h2> <p>…………………………. <p> </section> </body> Examples of Section Tag Example 1: In this example, we use the HTML "section" element...

3 minutes read.

HTML <address> Tag

Hyper Text Markup Language, HTML is the best markup language for creating Web pages. HTML consists of a wide variety of elements. In all of these elements, one element is...

4 minutes read.

Design a tribute page using HTML and CSS

A tribute page is a webpage based on a person who inspired us in our life. In this article, we will create a webpage of Mahatma Gandhi. We are going...

5 minutes read.

HTML <summary> tag

When we simply want to show the primary heading or topic name of hidden detailed material to users, then we can achieved this by using the summary tag. This makes it...

2 minutes read.

HTML 5 Tutorial

What is HTML5? HTML5 is a programming language which stands for the acronym Hyper Text Markup Language 5. It is program that enables the appearance of web pages to be changed, as well as changes...

5 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

What does HTML stand for?

HTML stands for Hyper Text Markup Language. We use this markup language to design a web page. Web browsers use this language to showcase text, videos, images, audio and other...

6 minutes read.

HTML Date

The input element in HTML has several attributes. One of its attributes is the type attribute which creates a calendar in an order that a user can select a date...

5 minutes read.

How to add JavaScript to HTML

JavaScript is one of the most important languages today. It is a high-level, interpreted, lightweight programming language that makes web pages more interactive. It is a language of the web....

5 minutes read.

HTML5 Button Tag

HTML Button Tag The < button > tag is used on the webpage to construct a clickable button inside the HTML. Within the < button>....</button > tag, we can place content...

2 minutes read.

HTML Elements

An HTML element is nothing but a starting tag and then some content and then the closing tag. So we can say HTML elements is everything from the starting tag...

3 minutes read.

HTML5 Attribute

HTML Attribute HTML attributes are special words that provide additional information about the HTML element or attributes.The element or tags have attributes, which define the element's behavior.It also adds attributes with a start...

3 minutes read.

How to create a link with no underline in HTML

In HTML, an anchor tag (<a>) is a Styled Container tag, which means when a hyperlink is created using this, browsers, by default, display the link by applying some styles...

5 minutes read.

HTML Search Box

The HTML search box is also known as the search bar. It is an input text field that is used to search the content. If the users want to explore...

7 minutes read.