JSFiddle - React, Tailwind, and code Playground
HTML
<div class="action_bar">
</div>
CSS
.action_bar
{
background-color: #000000;
width: 400px;
color: #ffffff;
}
JavaScript
jQuery("body").append("<div id='dpi_test' style='height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;'></div>");
jQuery(document).ready(function(){
dpi_x = document.getElementById('dpi_test').offsetWidth;
dpi_y = document.getElementById('dpi_test').offsetHeight;
dp_to_pixel_x = 1 * (dpi_x / 160);
dp_to_pixel_y = 1 * (dpi_y / 160);
action_bar_height = (dp_to_pixel_y * 48);
jQuery(".action_bar").css("height", Math.round(action_bar_height) + "px");
jQuery(".action_bar").html(dpi_y + "px");
});