JSFiddle - React, Tailwind, and code Playground
by David Kyle
HTML
<div class="liner">
<nav class="navigation screen-only flex">
<ul>
<li class="rounded-border"><a href="/" title="Home">Home</a></li>
<li class="rounded-border"><a href="/about" title="About">About</a></li>
<li class="rounded-border"><a href="/contact" title="Contact Us">Contact</a></li>
<li id="print-button" class="rounded-border"><a href="javascript:void(0);" title="Print">Print</a></li>
</ul>
</nav>
<section class="content">
<h1 class="page-heading">
<span class="screen-only">Page Heading</span>
<span class="print-only">Heading</span>
</h1>
</section>
<footer class="footer print-only">
<div class="liner text-muted">
<b>Rendered:</b>
<div class="footer-date">
</div>
</div>
</footer>
</div>
CSS
/* General */
body {
font-size: 12px;
margin: 0;
display: block;
font-family: Verdana, Arial, sans-serif;
}
a {
text-decoration: none;
color: rgba(160, 120, 50);
}
/* Utility */
.liner {
margin: 0;
padding: .1rem;
}
.content {
display: flex;
}
/* Look and Feel */
.rounded-border {
border-radius: .3rem;
padding: .4rem;
}
/* Typography */
.page-heading {
display: block;
margin: 0px auto;
}
.text-muted {
color: rgba(0, 0, 0, .6);
}
/* For Print Only */
@media print {
.screen-only {
display: none !important;
}
.page-heading {
text-align: center;
}
.page-heading::after {
content: '...';
}
.footer {
width: 100%;
margin-bottom: 0px;
position: fixed;
bottom: 0;
}
.footer>* {
display: flex;
}
.footer .liner {
background-color: #dedede;
}
.footer-date {
margin-left: 1rem;
}
}
/* For screen rendering only */
@media screen {
body {
background-color: #efefef;
}
.print-only {
display: none !important;
}
.navigation>ul {
list-style-type: none;
display: grid;
background-color: #dedede;
padding-top: .1rem;
padding-bottom: .1rem;
margin-top: 0;
}
.navigation>ul li {
border: solid 1px #232323;
background-color: #cfcfcf;
cursor: pointer;
text-align: center;
align-self: center;
transition: all 0.8s cubic-bezier(.68, -0.1, .24, 1.07);
}
.navigation>ul li:hover {
background-color: #ababab;
color: rgba(100, 80, 40);
transition: all 0.8s cubic-bezier(.68, -0.1, .24, 1.07);
}
}
/* Breakpoints */
@media screen and (min-width: 768px) {
.navigation>ul {
grid-template-columns: 10% 10% 10%;
grid-column-gap: .3rem;
}
}
@media screen and (min-width: 468px) and (max-width: 767px) {
.navigation>ul {
grid-template-rows: 33% 33% 33%;
justify-content: space-evenly;
}
}
TypeScript
let Page = (function() {
let Utilities = (function() {
let print = function() {
window.print();
};
return {
Print: print
};
})();
return {
Utils: Utilities
}
})();
document.getElementsByClassName('footer-date')[0].innerHTML = new Date();
document.getElementById('print-button').onclick = function(e) {
Page.Utils.Print();
};