An Interest In:
Web News this Week
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
3 Uncommon but useful HTML elements
1) <abbr>
The abbreviation <abbr>
element is used to represent an acronym or abbreviation. If you include a title
attribute, the text will be display as a tooltip on hover!
<p> The <abbr title="Product Detail Page">PDP</abbr> provides information on a specific product.</p>
2) <progress>
The <progress>
element will display a progress bar indicator that can be easily controlled with it's value
attribute. The JavaScript in this example will incrementally fill our progress bar every 100ms as shown here:
<label for="progress">Progress:</label><progress id="progress" max="100" value="0"></progress><script> const progress = document.querySelector('#progress'); let val = 0; setProgress(); function setProgress() { if (val > 100) val = 0; progress.value = ++val; setTimeout(setProgress, 100); }</script>
3) <wbr>
The word break opportunity <wbr>
element will allow you to specify exactly where a line of text should break when there is overflow. For example, if we have a super long line of text like this URL, we can tell the browser where the text should break if it doesn't fit on one line:
<p>http://is.this.just.real.life.com/is<wbr>/this/just/fantasy/caught/in/a/landslide/no/espace/from/reality</p>
Yo! I post byte-sized tips like these often. Follow me if you crave more!
I'm on TikTok, Twitter and I have a new debugging course dropping soon!
Original Link: https://dev.to/js_bits_bill/3-uncommon-but-useful-html-elements-jdi
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To