datalist
you can create a text field with auto-completion. Very comfortably! <input name="frameworks" list="frameworks" /> <datalist id="frameworks"> <option value="MooTools"> <option value="Moobile"> <option value="Dojo Toolkit"> <option value="jQuery"> <option value="YUI"> </datalist>
email
, url
and tel
. They allow you to write more beautiful code, do all the work on content validation for you, and also force mobile browsers to display a touch keyboard with special buttons (like @ and. Com) when filling in these fields. <input type="url"> <input type="email"> <input type="tel">
pattern
, you can simply specify a regular expression that the input data must match! <input type="email" pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}"> <input type="password" pattern="(?=.*\d)(?=.*[az])(?=.*[AZ]).{8,}" title=" , "> <input type="tel" pattern="(\+?\d[- .]*){7,13}" title=", ">
ContextMenu
element is only compatible with Firefox, but it can be hoped that other browsers will add its support as soon as possible. <section contextmenu="mymenu"> <p>, .</p> </section> <menu type="context" id="mymenu"> <menuitem label=", " icon="img/forbidden.png"></menuitem> <menu label=" "> <menuitem label=" FaceBook" onclick="window.location.href = 'http://facebook.com/sharer/sharer.php?u=' + window.location.href;"> </menuitem> </menu> </menu>
mp4
and ogv
videos into HTML5, with a backup player for older browsers. <video width="640" height="360" controls> <source src="__VIDEO__.MP4" type="video/mp4"> <source src="__VIDEO__.OGV" type="video/ogg"> <object width="640" height="360" type="application/x-shockwave-flash" data="__FLASH__.SWF"> <param name="movie" value="__FLASH__.SWF"> <param name="flashvars" value="controlbar=over&image=__POSTER__.JPG&file=__VIDEO__.MP4"> <img src="__VIDEO__.JPG" width="640" height="360" alt="__TITLE__" title=" "> </object> </video>
hidden
attribute has appeared, which can be applied to any element. Its action is similar to the CSS property display:none
. <p hidden> </p>
autofocus
allows you to set the focus on a specific item when the page loads. Useful, for example, for search, authorization or registration pages. <input autofocus="autofocus">
<link rel="prefetch" href="http://www.catswhocode.com/wp-content/uploads/my_image.png">
mp3
format. The code below implements a minimalist but functional audio player. <audio id="player" src="sound.mp3"></audio> <div> <button onclick="document.getElementById('player').play()">Play</button> <button onclick="document.getElementById('player').pause()">Pause</button> <button onclick="document.getElementById('player').volume+=0.1">Volume Up</button> <button onclick="document.getElementById('player').volume-=0.1">Volume Down</button> </div>
Source: https://habr.com/ru/post/173195/
All Articles