Tag css

 Like

Liked Terence Eden (@Edent@mastodon.social)
Post details
In today's adventures of finding out weird things you can do with HTML… You should not put a `<style>` element anywhere other than the `<head>` So `<body><style> ...CSS...</style></body>` is an error. (It works, because browsers are tolerant.) But you *can* put a `<link rel="stylesheet">` element in a body. Obviously, that needs an *external* data source for the CSS. So you can cheat by Base64 encoding it! `<body><link rel="stylesheet" type="text/css" href="data:text/css;base64,LyoqCi…">`

 Like

Liked Implementing dark mode in a handful of lines of CSS with CSS filters
Post details
I finally got round to implementing dark mode for this site (the cobbler’s children have no shoes and all that…) Here’s all the CSS I had to add: @media (prefers-color-scheme: dark) { /* Invert all elements on the body while attempting to not alter the hue substantially. */ body { filter: invert(100%) hue-rotate(180deg); } /* Workarounds and optical adjustments. */ /* Firefox workaround: Set the background colour for the html element separately because, unlike other browsers, Firefox doesn’t apply the filter to the root element’s background.

 Like

Liked a post on Twitter
Post details