HTML Attributes

By | February 12, 2020

In this, we will learn about the attributes of HTML although we have obtained information about many of HTML attributes before, but in this chapter we will learn about them in some details.

  • Attribute:-<accept>
  • Belongs to:-<input>

Example:-

     <form action="/page.php">
          <input type="file" accept="image/*">
     </form>
  • Attribute:-<action>
  • Belongs to:-<form>

Example:-

    <form action="/page.php">
          <label for="fname">First Name:-</label>
          <input type="text" name="fname" id="fname">
          <label for="lname">Last Name:-</label>
          <input type="text" name="lname" id="lname">
     </form>

Attribute:-<alt>
Belongs to:-<img>,<area>,<input>

Example:-

<img src="flower.php" alt="flower">
<map>
     <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
</map>

<form action="page.php">
     <input type="image" src="submitimg.gif" alt="Submitimg" name="">
</form>

Attribute:-async
Belongs to:-<script>

Example:-

<script src="demo.js" async></script>

Attribute:-autoplay
Belongs to:-<audio>,<video>

Example:-


<audio controls autoplay>
     <source src="audio.mp3" type="audio/mpeg">
</audio>

<video controls autoplay>
     <source src="movie.mp4" type="video/mp4">
</video>

Attribute:-charset
Belongs to:-<script>,<meta>

Example:-


<head>
     <meta charset="utf-8">
</head>

Attribute:-checked
Belongs to:-<input>

Example:-

<form action="page.php">
     <input type="checkbox" name="Michle" value="Michle" checked>
</form>
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *