HTML Attributes



HTML attributes are important to used inside the opening tag to control elements Direction.

An HTML Attribute either modifies the default functionality of an element.

All HTML Attributes define Two Parts

  • name
  • value

name: In this HTML Attribute name section name is the property to set what you want.

value: In this HTML Attribute value is the property to set always put with in quotations like " "

<p style="color: yellow">paragraph content </p>  
html attribute

Example

<!DOCTYPE html>
 <html>
 <body>
       
 <h2>The href Attribute</h2>
       
 <p>HTML links are defined with the a tag. The link address is specified in the href attribute:</p>
       
 <a href="https://www.w3schools.com">Visit W3Schools</a>
       
 </body>
 </html>
       
     
     
 


Click on the "Run This Code" button to see how it works.




HTML id Attribute

The id attribute of an HTML tag can be used identify any element with in an HTML Document.

Example

<!DOCTYPE html>
    <html>
      
    <head>
   <title>The title Attribute Example</title>
   </head>
    <body>
    <h1 title = "Hello HTML!">Titled Heading Tag Example</h1>
    </body>
             
   </html>
       
       
   


Click on the "Run This Code" button to see how it works.


HTML Title Attribute

The HTML title Attribute gives you a suggested title for the element.

If the user mouse move over the element the it shows up the title.

Example

<!DOCTYPE html>
<html>

<head>
   <title>The title Attribute Example</title>
</head>
 
<body>
   <h1 title = "Hello HTML!">Titled Heading Tag Example</h1>
</body>
 
</html>


Click on the "Run This Code" button to see how it works.


HTML class Attribute

The HTML clas Attribute is used to create number of classes for an HTML element.

Example

<!DOCTYPE html>
<html>
<head>
	<style>
		.heading{ 
			color: yellow;
		
			background-color: gray; }
	</style>
</head>
<body>
<h1 class="heading">This is first heading</h1>
</body>
</html>

 


Click on the "Run This Code" button to see how it works.





HTML

Welcome HTML Getting Started HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Links HTML Styles HTML Text Formatting HTML Tables HTML Images HTML Forms HTML Lists HTML Iframes HTML Comments HTML CSS HTML Colors HTML Classes HTML Id HTML javascript HTML Filepaths

HTML Advanced

HTML Doctypes HTML Validation HTML Validation HTML URL HTML URL Encode HTML URL Entities HTML Layout HTML Head HTML Meta HTML Scripts HTML Tags

HTML Media

HTML Media HTML Audio HTML Video HTML Plug-ins HTML Youtube

HTML Graphics

HTML Canvas HTML SVG