Skip to content

Instantly share code, notes, and snippets.

View tomhodgins's full-sized avatar
😍
Writing CSS

Tommy Hodgins tomhodgins

😍
Writing CSS
View GitHub Profile
<xsl:stylesheet
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
>
<xsl:output
method="xml"
encoding="utf-8"
indent="yes"
<script type=module>
import html from 'https://crocdn.com/_plugins/html.js'
customElements.define(
'scroll-container',
class ScrollContainer extends HTMLElement {
constructor() {
super()
this.updateOverflowAttribute = this.updateOverflowAttribute.bind(this)
@tomhodgins
tomhodgins / innovati.xml
Created April 22, 2020 03:30
The entity known as &innovati;
<!DOCTYPE webdev [
<!ENTITY innovati "<person>innovati</person>">
]>
<?xml-stylesheet href="data:text/css,
person::before,
person::after {
content: '💙';
}
" ?>
const flags = {
bold: false,
italic: false,
underline: false,
strikethrough: false,
highlight: false,
code: false,
uppercase: false,
lowercase: false
}
<!-><!-- - normal-->
<!&><!-- & bold-->
<!/><!-- / italic-->
<!_><!-- _ underline-->
<!~><!-- ~ strikethrough-->

CSS explained for programmers:

  • CSS is a stylesheet language, it's built around rules which contain 'declarations' of properties
selector {
  property: value;
}
<script type=module>
import {Remarkable} from 'https://unpkg.com/[email protected]/dist/esm/index.js'
customElements.define(
'mark-down',
class MarkDown extends HTMLElement {
constructor() {
super()
this.innerHTML = new Remarkable().render(this.innerHTML)
}
<style>
body {
display: flex;
}
/* Hide all non-active tabs by default */
main div:not(.active) {
display: none;
}
</style>
@tomhodgins
tomhodgins / dom-processor-examples.html
Last active April 14, 2020 20:38
Examples of the domProcessor() function showing how it can use functions to transform DOM objects
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DOM Processor examples</title>
<script type=module>
// The DOM Processor function
function domProcessor(object = new DocumentFragment, transforms = {}) {
if (object instanceof Element) {
Object.keys(transforms)
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML templating examples</title>
<script type=module>
// The html tagged template function
function html(strings = [''], ...expressions) {
const elements = []
const functions = {}