JSFiddle - React, Tailwind, and code Playground

HTML

<button>Generate random px</button>
<div id="wrapper">Test</div>

CSS

div

JavaScript

var $style = $('<style>');

$style.appendTo('head');

function updateStyle(px){
    var base = "#wrapper:after{display:block;content:'hello';padding-top:" + px + '%}';
    $style.html(base);  
}

$('button').on('click', function(){
   updateStyle(Math.floor(Math.random() * 100 ));
});