Use this code to autoplay embedded video. Modern browsers will only autoplay muted videos. The 'playsinline' property is required for Safari iOS if you don't want it to play in the fullscreen overlay.
Provides data hints for the input fields similarly to autocomplete.
#html#tag
<inputtype="text"placeholder="Select a shape"list="shapes"><datalistid="shapes"><optionvalue="Square"></option><optionvalue="Circle"></option><optionvalue="Oval"></option><optionvalue="Rectangle"></option></datalist>
Provides a native solution to toggle content. You can use 'open' attribute to capture state of the element.
#html#tag
<style>#details-element{padding:1rem;border:1pxsolid;margin:1rem;border-radius:0.4rem;cursor:pointer;}#details-element[open]{border-color:lightgreen!important;}</style><detailsid="details-element"><summary>Show more details</summary><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi tempore rerum possimus. Ipsum temporibus consequuntur saepe aliquid quis deserunt quisquam a odit voluptatum eveniet?</p></details>
Output: Show more details
Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi tempore rerum possimus. Ipsum temporibus consequuntur saepe aliquid quis deserunt quisquam a odit voluptatum eveniet?
This HTML attribute can be added to image or iframe tags and provides native browser support for lazy loading resources. You can set it to one of these modes lazy|eager|auto. Check browser support before using.
#html#attribute#performance
<!-- On the image tag --><imgsrc="./assets/icon-144x144.png"loading="lazy"alt="Some image"/><!-- In the picture element with source sets --><picture><sourcemedia="(min-width: 1024px)"srcset="./assets/icon-512x512.png"><sourcesrcset="./assets/icon-144x144.png 1x, ./assets/icon-512x512.png 2x"><imgsrc="./assets/icon-64x64.png"loading="lazy"></picture>
The content of this tag shows in the search results below the title. Suggested character count is 160. It carries very little value for the search engines.
#tag#meta#seo
<metaname="description"content="Page description, maximum 160 characrers.">
Ordered list example. Use "type" attribute for different list item prefixes; type="1" - numbers; type="A" - uppercase letters; type="a" - lowercase letters; type="I" - uppercase roman numbers; type="i" - lowercase roman numbers.
#html#list
<ol><li>Blue</li><li>Red</li><li>Yellow</li><li>Green</li></ol><oltype="I"><li>Uppercase roman style number list item 1</li><li>Uppercase roman style number list item 2</li><li>Uppercase roman style number list item 3</li></ol>
Responsive image sources. Media attribute accepts standard media queries.
#html#tag#responsive#media
<picture><sourcemedia="(min-width: 1024px)"srcset="desktop-image.jpg"><sourcemedia="(min-width: 768px)"srcset="tablet-image.jpg"><imgsrc="default-image.jpg"alt="Default mobile image"></picture>
Front-end solution for the user input validation. Submitting the form with an empty field will trigger the validation. NOTE. Front-end validate should not be the only way of checking the submitted data. You do need to check and validate all data on the back-end of the application.
Scalable vector graphics, path examples. The capital "L" uses absolute coordinates in the context of the viewBox whereas lowercase "l" uses relative values. For vertical and horizontal path movements use "v" and "h" respectively.
#html#element#svg
<svgwidth="150"height="150"viewBox="0 0 100 100"style="border: 1px solid #CCC"><pathd="M 10 10 L 90 90"stroke="#EB6300"/><!-- Absolute coordinates --></svg><svgwidth="150"height="150"viewBox="0 0 100 100"style="border: 1px solid #CCC"><pathd="M 10 10 l 90 90"stroke="#EB6300"/><!-- Relative coordinates --></svg><svgwidth="150"height="150"viewBox="0 0 100 100"style="border: 1px solid #CCC"><pathd="M 10 10 h 10 v 10 h 10 v 10 h 10 v 10 h 10 v 10 h 10 v 10 h 10 v 10 h 10 v 10 h 10 v 10"stroke="#EB6300"fill="none"/><!-- Horizontal and vertical path movements --></svg>
Template tag lets you create a HTML partial. By default it doesn't get rendered into the page. Instead, you can use Javascript to manipulate it and inject dynamic content.
#html#tag
<style>.arial{font-family:Arial}.arial-black{font-family:ArialBlack}.comic-sans{font-family:ComicSansMS}.impact{font-family:Impact}.lucida-sans{font-family:LucidaSansUnicode}.font{margin-bottom:24px;}.font__title{padding:6px12px;text-transform:capitalize;}</style><!-- Simple template that serves as a base for our dynamic component --><templateid="font-template"><divclass="font"><divclass="font__title">Title</div></div></template><divclass="container"><divid="font-gallery"><!-- Component will be injected here using Javascript --></div></div><script>// Get template elementconstfragment=document.getElementById('font-template');// This array contains the data we will loop throughconstfonts=[{family:'arial'},{family:'arial-black'},{family:'comic-sans'},{family:'impact'},{family:'lucida-sans'}];fonts.forEach(font=>{// Create an instance of the template contentconstinstance=document.importNode(fragment.content,true);// Add relevant content to the templateinstance.querySelector('.font').classList.add(font.family);instance.querySelector('.font__title').innerHTML=font.family+" font family";// Append the instance to the DOMdocument.getElementById('font-gallery').appendChild(instance);});</script>