JSFiddle - React, Tailwind, and code Playground

HTML

<!doctype html>
<html>
    <head>
        <title>BGColor</title>
    </head>
    <body>
        <div class="blue print-color">I should have a blue background<br />And My Width is set.</div>
        <div class="red print-color">Mine should be red, but my width is auto.<br /></div>
        <div class="UA"></div>
    </body>
</html>

CSS

.blue
{
    background-color: #00F;
    width: 200px;
}
.red
{
    background-color: #F00;
}
.print-color
{
    -webkit-print-color-adjust: exact;
}

JavaScript

document.querySelector('.UA').appendChild(document.createTextNode(navigator.userAgent));