HTML5 new tags and attributes

Published on 2024-11-23 by Raul

figure & figcaption

Use them together to tie a text from an image. Like:

<figure> 
   <img src="path/to/image" alt="About image" /> 
   <figcaption> This is an image of something interesting. </figcaption> 
</figure> 

This is an image of something interesting.

Text input attributes:


type="email": indicate that you expect an email address.
placeholder="text here": when empty, the input will contain the value of the attribute. As soon as you type something, the hint text will dissapear.
required: indicate that a value is required. In a browser that supports this attribute, the form cannot be submitted until a value is placed in the textbox
autofocus: use this when you want the field to be focused by default
pattern="regex value": a regular expression to validate the field's value against.

More HTML5 tips here.


Keep in touch


About

Hey there, I'm Raul, owner of CreativeCLR, a small consulting company.

Feel free to drop me any question you might have on this post using the comment section or the contact page.