HTML5 > Structures

Legend in HTML5

How to create a caption using legend in HTML


In previous posts, we learnt how to group elements using fieldset.

Legend

By using <legend> we can create a caption on the field set  

 <form>
        <fieldset>
            <legend>Please Login</legend>
            Email: <input type="text"><br>
            Password:<input type="password"/><br />
            Date of birth: <input type="text">
        </fieldset>
    </form>

In the above code snippet we have created a form, we have legend element to create caption on the fieldset

output

 

 Views: 3725 | Post Order: 85



Write for us






Hosting Recommendations