Skip to content

Instantly share code, notes, and snippets.

@sambacha
Last active April 21, 2025 22:05
Show Gist options
  • Save sambacha/7a5b1800a84ad1796958cfc7abc8e024 to your computer and use it in GitHub Desktop.
Save sambacha/7a5b1800a84ad1796958cfc7abc8e024 to your computer and use it in GitHub Desktop.
/* @source {@link https://piccalil.li/blog/a-more-modern-css-reset/}
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Prevent font size inflation */
html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
}
/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
margin-block-end: 0;
}
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
list-style: none;
}
/* Set core body defaults */
body {
min-height: 100vh;
line-height: 1.5;
}
/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4,
button, input, label {
line-height: 1.1;
}
/* Balance text wrapping on headings */
h1, h2,
h3, h4 {
text-wrap: balance;
}
/* A elements that don't have a class get default styles */
a:not([class]) {
text-decoration-skip-ink: auto;
color: currentColor;
}
/* Make images easier to work with */
img,
picture {
max-width: 100%;
display: block;
}
/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
font-family: inherit;
font-size: inherit;
}
/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
min-height: 10em;
}
/* Anything that has been anchored to should have extra scroll margin */
:target {
scroll-margin-block: 5ex;
}
<!-- /* @see {@link https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html} */ -->
<div role="region" aria-labelledby="Caption01" tabindex="0">
<table>[…]</table>
</div>
*[lang="en"] {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
*[lang="zh-Hans"] {
font-family:
"PingFang SC",
-apple-system,
BlinkMacSystemFont,
sans-serif;
}
body {
font-size: 13px;
}
h2 {
border-bottom: 1px solid #575186;
font-size: 1.8rem;
margin: 0.2em 0 0.8em 0;
}
h4 {
font-size: 1.1rem;
margin: 1.5rem 0 0.75rem 0;
}
h5 {
font-size: 1rem;
margin: 0;
}
img {
max-width: 100%;
}
code {
background: rgba(0, 0, 0, 0.05);
}
pre {
padding: 10px;
background: rgba(0, 0, 0, 0.05);
color: #222;
overflow-x: auto;
}
.img-c {
display: block;
margin: 0 auto;
}
.img-c + .img-c {
margin-top: 0.5em;
}
.alert {
border-radius: 4px;
background: #ddd;
margin: 1em 0;
padding: 1em;
}
.alert.alert-important {
font-weight: bold;
background: #c44;
color: #fff;
}
.alert.alert-important a {
color: #fff;
}
ul.fl {
padding: 0;
list-style: none;
}
.fl > li:not(:first-child) {
margin-top: 0.5em;
}
.fl > li:before {
display: inline-block;
text-align: center;
color: #fff;
margin-right: 0.75em;
padding: 0.1em 0;
font-size: 0.8em;
font-weight: bold;
border-radius: 3px;
}
.fl > li.n:before {
content: "NEW";
background: green;
width: 3.5em;
}
.fl > li.f:before {
content: "FIX";
background: orange;
width: 3em;
}
.fl > li.e:before {
content: "IMPROVE";
background: blueviolet;
width: 6em;
}
.fl > li.u:before {
content: "UPDATE";
background: gray;
width: 5.5em;
}
.fl p {
margin: 0.5em 0;
font-size: 12px;
color: #777;
}
.fl p a {
color: #666;
}
.fold-label {
cursor: pointer;
color: #777;
}
.fold-label:before {
content: "▶︎ ";
}
.fold-box {
display: none;
}
.fold-box + .fold {
display: none;
}
.fold-box:checked + .fold {
display: block;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Open Sans', sans-serif;
line-height: 1.5;
}
.wrapper {
overflow: scroll;
}
table {
border-collapse: collapse;
width: max(65rem, 100%);
table-layout: fixed;
}
th,
caption {
text-align: start;
}
caption {
margin-block: 0.75rem;
}
thead th:not(:first-child),
td {
text-align: end;
}
thead {
border-block-end: 2px solid;
background: whitesmoke;
}
tfoot {
border-block: 2px solid;
background: whitesmoke;
}
th,
td {
border: 1px solid lightgrey;
padding: 0.25rem 0.75rem;
vertical-align: baseline;
}
th:first-child {
position: sticky;
inset-inline-start: 0;
border-inline-end: none;
}
tbody th {
background: white;
}
thead th,
tfoot th {
background: whitesmoke;
}
thead th {
vertical-align: bottom;
}
td:first-of-type,
:where(thead, tfoot) th:nth-child(2) {
border-inline-start: none;
}
th:first-of-type {
width: 10rem;
}
th:first-child::after {
content: '';
position: absolute;
inset-block-start: 0;
inset-inline-end: 0;
width: 1px;
height: 100%;
background: lightgrey;
}
/* @see {@link https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html} */
[role="region"][aria-labelledby][tabindex] {
overflow: auto;
}
[role="region"][aria-labelledby][tabindex]:focus {
outline: .1em solid rgba(0,0,0,.1);
}
/* For the shadow: https://adrianroselli.com/2020/01/fixed-table-headers.html */
div[tabindex="0"][aria-labelledby][role="region"] {
background:
linear-gradient(to right, transparent 30%, rgba(255,255,255,0)),
linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,0.2), rgba(0,0,0,0)),
radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.2), rgba(0,0,0,0)) 0 100%;
background-repeat: no-repeat;
background-color: #fff;
background-size: 4em 100%, 4em 100%, 1.4em 100%, 1.4em 100%;
background-position: 0 0, 100%, 0 0, 100%;
background-attachment: local, local, scroll, scroll;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment