<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Unai Mengual</title>
    <description>The latest articles on Forem by Unai Mengual (@owlnai).</description>
    <link>https://forem.com/owlnai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F521963%2Fe229f1ee-6de0-433c-9f0b-c39d64aa73b0.jpg</url>
      <title>Forem: Unai Mengual</title>
      <link>https://forem.com/owlnai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/owlnai"/>
    <language>en</language>
    <item>
      <title>Writing future-proof UnoCSS</title>
      <dc:creator>Unai Mengual</dc:creator>
      <pubDate>Thu, 11 May 2023 17:07:49 +0000</pubDate>
      <link>https://forem.com/owlnai/writing-future-proof-unocss-5b68</link>
      <guid>https://forem.com/owlnai/writing-future-proof-unocss-5b68</guid>
      <description>&lt;p&gt;I've been using &lt;a href="https://unocss.dev"&gt;UnoCSS&lt;/a&gt; since its early days, and I'm quite amazed by its limitless flexibility. However, flexibility comes at a price and can lead you to misuse. &lt;/p&gt;

&lt;p&gt;Note that this post focuses on UnoCSS using the default presets: Uno, Attributify and Tagify.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ways to use UnoCSS
&lt;/h2&gt;

&lt;p&gt;Before we start, let's review the ways we can use UnoCSS with the main presets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classes&lt;/strong&gt; &lt;code&gt;&amp;lt;div class="dark:bg-gray-900"&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attributes&lt;/strong&gt; &lt;code&gt;&amp;lt;div dark="bg-gray-900"&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tags&lt;/strong&gt; &lt;code&gt;&amp;lt;dark-bg-gray-900&amp;gt;&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Attributes
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://unocss.dev/presets/attributify"&gt;attributify preset&lt;/a&gt; allows you to use HTML attributes instead of CSS classes as long as they are within the Unicode ranges supported by the specification.&lt;/p&gt;

&lt;p&gt;However, that doesn't mean it strictly adheres to the HTML standard. For example, the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;dark=&lt;/span&gt;&lt;span class="s"&gt;"bg-gray-950"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It &lt;em&gt;technically&lt;/em&gt; works in modern browsers, but if you run a validator you'll notice that "dark" is not a valid attribute in &lt;code&gt;div&lt;/code&gt; tags.&lt;/p&gt;

&lt;p&gt;Why is this the case? Custom attributes can conflict with future HTML attributes, causing unexpected behavior or rendering issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using data-* attributes
&lt;/h3&gt;

&lt;p&gt;So what do we do? &lt;code&gt;data-*&lt;/code&gt; attributes allow us to extend HTML tags with any non-standard attribute we can think of. Of course, this also applies to the utilities generated by UnoCSS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;data-dark=&lt;/span&gt;&lt;span class="s"&gt;"bg-gray-950"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, the attributify preset doesn't support them, but you can enforce it by using this configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;presetAttributify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// or 'data-un-'&lt;/span&gt;
  &lt;span class="na"&gt;prefixedOnly&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Problem solved!&lt;/p&gt;

&lt;h2&gt;
  
  
  Tags
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://unocss.dev/presets/tagify"&gt;Tags&lt;/a&gt; have a similar problem. Custom HTML elements &lt;a href="https://www.ietf.org/rfc/rfc2119.html#section-3"&gt;&lt;em&gt;should&lt;/em&gt;&lt;/a&gt; follow &lt;a href="https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname"&gt;these rules&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The name of a custom element must contain a hyphen ("-").&lt;/li&gt;
&lt;li&gt;The name must start with a letter (a-z or A-Z).&lt;/li&gt;
&lt;li&gt;The name can contain lowercase letters (a-z), uppercase letters (A-Z), digits (0-9), hyphens ("-"), and must not contain any whitespace or special characters.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hyphens
&lt;/h3&gt;

&lt;p&gt;Most utilities like &lt;code&gt;&amp;lt;text-red-300&amp;gt;&lt;/code&gt; work fine, but prefixed tags like &lt;code&gt;dark:&lt;/code&gt; or &lt;code&gt;print:&lt;/code&gt; may be problematic, as colons are not supported. In fact, tagify won't work at all!&lt;/p&gt;

&lt;p&gt;Let's say we have this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dark:text-red-300&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should replace the colon with a hyphen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dark-text-red-300&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Prefixes
&lt;/h3&gt;

&lt;p&gt;Many utilities, such as &lt;code&gt;&amp;lt;flex&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;hidden&amp;gt;&lt;/code&gt;, do not contain dashes because they consist of single words. Splitting them, for example into , wouldn't make sense.&lt;/p&gt;

&lt;p&gt;Instead, we can use a &lt;a href="https://www.webcomponents.org/community/articles/web-components-best-practices"&gt;namespace prefix&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;presetTagify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;un-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that you can write utilities like &lt;code&gt;&amp;lt;un-flex&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;un-dark-flex&amp;gt;&lt;/code&gt; and be at ease since no new elements containing hyphens will be added to the HTML specification.&lt;/p&gt;

</description>
      <category>unocss</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Experimenting with a CSS pure inspect element</title>
      <dc:creator>Unai Mengual</dc:creator>
      <pubDate>Sun, 24 Oct 2021 18:41:02 +0000</pubDate>
      <link>https://forem.com/owlnai/experimenting-with-a-css-pure-inspect-element-39jg</link>
      <guid>https://forem.com/owlnai/experimenting-with-a-css-pure-inspect-element-39jg</guid>
      <description>&lt;p&gt;CSS, a language that defines style and design, has many interesting functions. Some of them are the &lt;code&gt;attr()&lt;/code&gt; and &lt;code&gt;counter()&lt;/code&gt; functions. Today we'll use them to create very simple element inspector with pure CSS.&lt;/p&gt;

&lt;p&gt;Note that while JS would be the sane solution here, we're experimenting with CSS and HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are these functions?
&lt;/h2&gt;

&lt;p&gt;Both return values when used with the &lt;code&gt;content&lt;/code&gt; property. attr returns the value of a given HTML attribute while counter can be used to count a number of elements (e.g you want to prepend a number before every h2).&lt;/p&gt;

&lt;p&gt;You can read more about them at MDN.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Idea
&lt;/h2&gt;

&lt;p&gt;If attr() returns an attribute, we can use it to get the class and id from the element, which is one of the main usecases of Inspect Element.&lt;/p&gt;

&lt;p&gt;As for counter(), we'll use it to show the number of the list item in an unordered list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing the HTML
&lt;/h2&gt;

&lt;p&gt;A simple HTML snippet that works to demo our idea:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"css-pure-inspect"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"hello"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"devto"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    This is a test
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Test&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Foo&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Bar&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that I wrapped it in a div to avoid clashing with other elements and create a visual hell.&lt;/p&gt;

&lt;h2&gt;
  
  
  The CSS
&lt;/h2&gt;

&lt;p&gt;First thing we are going to do is styling the box that will show on hover. For this demo, I used this styling&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;13px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ccc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pre&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;For a real project, &lt;code&gt;*&lt;/code&gt; is generally discouraged for performance reasons.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;white-space: pre;&lt;/code&gt; is a trick to be used with the &lt;code&gt;\a&lt;/code&gt; character escape to create line breaks in CSS content.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;absolute&lt;/code&gt; is mandatory to prevent the box to mess with the flow of the document. Depending on the site you might need a z-index.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that we styled the box, we're going to show the actual content - CSS classes and IDs, but data attributes or even alt texts could work if you added them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="o"&gt;*[&lt;/span&gt;&lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Classes: "&lt;/span&gt; &lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="o"&gt;*[&lt;/span&gt;&lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"ID: "&lt;/span&gt; &lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="o"&gt;*[&lt;/span&gt;&lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;][&lt;/span&gt;&lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Classes: "&lt;/span&gt; &lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="s1"&gt;"\a ID: "&lt;/span&gt;&lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="o"&gt;*[&lt;/span&gt;&lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;][&lt;/span&gt;&lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Classes: "&lt;/span&gt; &lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="s1"&gt;"\a ID: "&lt;/span&gt;&lt;span class="n"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Yes, you can concatenate plaintext and attributes in &lt;code&gt;content&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\a&lt;/code&gt; is the line break trick explained above.&lt;/li&gt;
&lt;li&gt;Some elements have a class, others just have a div. The attributes in the selector were added to check it. And thanks to CSS order and specifity rules, we override the previous style.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's it for most elements. But we haven't used the counter() function. Remember the HTML ul list we created earlier?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="nt"&gt;ul&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;counter-reset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;list-inspect&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="nt"&gt;li&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;counter-increment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;list-inspect&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.css-pure-inspect&lt;/span&gt; &lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="nd"&gt;:hover::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"List item #"&lt;/span&gt;&lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list-inspect&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The counter resets at every ul&lt;/li&gt;
&lt;li&gt;It increments every li and we show it in the hover box&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo result
&lt;/h2&gt;

&lt;p&gt;&lt;iframe src="https://jsfiddle.net/owlnai/q61ebdL4/1//embedded/result,html,css//dark" width="100%" height="600"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;p&gt;This could be more robust. Maybe you could manually add every tag and their attributes defined in the W3C spec, but you'd probably lose your sanity. Thanks for reading!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>todayilearned</category>
    </item>
  </channel>
</rss>
