×

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 <colgroup> Tag

A HTML table's column group is specified by the "colgroup" tag. If you want to apply various properties to one or more <col> elements in an HTML table, then you...

4 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.

Caption Tag in HTML

Caption Tag in HTML: The < caption > tag in HTML describes the heading of a table in the HTML text. Browsers typically make the text found above the table...

4 minutes read.

HTML5 Tags

HTML5 Tags A list of newly included tags is provided in HTML5. These HTML 5 tags (elements) provide a better structure for the document. This list shows description of all HTML...

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 Video

HTML VIDEO: HTML5 has introduced the <video> tag to embed video into the webpage directly without using the plug-ins.   Syntax: <video attributes >     <source src="address" type="video/mp4">     Your browser does not support the video tag.   </video> <video width="320" height="240" controls>     <source src="mountain.mp4" type="video/mp4">     Your browser does not support the video tag.   </video> Output: ← Prev ...

1 minute read.

HTML Tutorial

Introduction This HTML tutorial helps beginners and professionals to learn HTML easily. HTML is a widely used web technology for website development. It stands for Hyper Text Markup Language. It is mainly used to...

7 minutes read.

HTML Code

Before jumping into the topic, let’s understand a common scenario where we have a code snippet in our HTML file. By code snippet, we mean computer code, which is written...

5 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.

HTML Images

HTML has <img> tag to display image on the web pages or web application. This tag is an empty tag i.e. we don't have to close this tag while using. SYNTAX: <img src="source address" attributes="alt, height, width"> Example: <html>   <body>   <center>Image tag Example</center>   <img src="https://www.tutorialandexample.com/resources/images/favicon.png"    alt="tutorialandexample"/>   </body>   </html> Output: Image...

1 minute read.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 minutes read.

CSS Clearfix

CSS Clearfix: A clearfix (or clear float) in CSS is for a component to clear or fix the child component, so we don’t need to insert additional markup. The clear...

4 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 Youtube

<object> element: It embed the object within the HTML documents and embed plug-ins such as Java applets, PDF readers, Flash Players etc in web pages. Example: <object width="100" height="100" data="bookmark.swf"></object> <embed> element: It defines an embedded...

1 minute read.

HTML Charsets

In this tutorial, we are going to discuss about the charsets in the HTML. The letters, numbers, and several other symbols are shown correctly by the web browser. All of this...

2 minutes read.

How to change text color in HTML

Changing the text colour of a web page is essential because it enhances readability. There are several ways to change the colour of the text in HTML, which are as follows: Text...

7 minutes read.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 minutes read.

HTML Form Action

The <form> tag has an attribute named action that contains a URL. The HTML action attribute defines the webpage URL on which you want to send the data after submitting...

4 minutes read.

HTML <body> tag

HTML means Hyper Text Markup Language, which is most preferred for making Web pages. It explains how a Web page is put together. There are many different elements in HTML,...

3 minutes read.

HTML Font Size

The HTML <font> tag uses the size attribute to specify the size of the text. We can set the size attribute’s value from 1 to 7. The default size of...

4 minutes read.