Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS content: attr() on HTML5 progress doesn't work
    text
    copied!<p><strong>HTML</strong></p> <pre><code>&lt;progress max="100" value="80" data-value="5"&gt;&lt;/progress&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>progress { margin: 50px; width:250px; border:0; } </code></pre> <p><em>CSS (Attempt 1)</em></p> <pre><code>progress:before, progress:after { content: attr(data-value); } </code></pre> <p><em>CSS (Attempt 2)</em></p> <pre><code>progress::-webkit-progress-bar:before, progress::-webkit-progress-bar:after { content: attr(data-value); } progress::-moz-progress-bar:before, progress::-moz-progress-bar:after { content: attr(data-value); } </code></pre> <p><em>CSS (Attempt 3)</em></p> <pre><code>progress::-webkit-progress-value:before, progress::-webkit-progress-value:after { content: attr(data-value); } progress::-moz-progress-value:before, progress::-moz-progress-value:after { content: attr(data-value); } </code></pre> <p>None of the above attempts succeeded. Also tried each of the above versions with different CSS code blocks, for <code>:before</code> and <code>:after</code>.</p> <p><strong>OBJECTIVE</strong></p> <p>To inject CSS generated content before and after the HTML5 <code>&lt;progress&gt;</code> element. Is this possible?</p> <p><em>JsFiddle Demo</em></p> <p><a href="http://jsfiddle.net/pankajparashar/MNL2C/" rel="noreferrer">http://jsfiddle.net/pankajparashar/MNL2C/</a></p> <p><strong>UPDATE</strong></p> <p>When I use the following CSS it works.</p> <pre><code>progress::-webkit-progress-bar:before, progress::-webkit-progress-bar:after { content: '123'; } </code></pre> <p><strong>CONCLUSION</strong></p> <p>Apparently when we inject static content in the CSS, it works. But if we use the content from <code>data-*</code> it doesn't.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload