High SNR, minimum verbiage CSS code recipes.
- Superscripts and subscripts without breaking line spacing
- Ideal line length: 66 characters
- Letterspacing abbreviations
- Consistency between line spacing and paragraph spacing
- Consistency for blockquote margins
- Consistency for heading size
- Paragraph indent (exclusive with block paragraphs)
- Faithful rendering of verses, centered on the longest line
- Italicise foreign words (French and English)
- Force white background when printing
- Closing a float with minimal markup
- Highlight variables
- Highlight input
- Localised quotations (French and English)
- Inline pairs (French and English)
- Post-It™
- Dialogs (French and English)
Superscripts and subscripts without breaking line spacing
sup, sub {line-height:1px}
Ideal line length: 66 characters
max-width:44em
Letterspacing abbreviations
abbr {letter-spacing:0.1em}
Consistency between line spacing and paragraph spacing
p {
line-height:x;
margin-top:xem;
margin-bottom:xem
}
Consistency for blockquote margins
blockquote {margin:xem }
Consistency for heading size
No code yet, sorry! source
Paragraph indent (exclusive with block paragraph)
p+p {text-indent:0}
Faithful rendering of verses, centered on the longest line:
blockquote.verse pre { display:table; font-family:inherit; margin:0 auto; width:auto }
Italicise foreign words (French and English)
html:lang(fr) *:not(:lang(fr)), html:lang(en) *:not(:lang(en)) { font-style: italic }
Force white background when printing
<style type="text/css" media="print"> * { background:#fff !important; color:#000 !important }
Closing a float without extra markup
.bla:after {content:"";display:block;clear:both}
Highlight variables
var {
font-family:Courier,monospace;
font-style:normal
}
var:before {
content:"\003C"
}
var:after {
content:"\003E"
}
Highlight input
kbd { border:1px solid silver; font-size:0.90em; padding:0 0.25em }
Localised quotations (French and English)
q:lang(fr) {quotes : '«\202F' '\202F»' "“" "”" "‘" "’"}
q:lang(en) {quotes : "“" "”" "‘" "’"}
Inline pairs (French and English)
dl.run-in, dl.run-in dd {margin:0}
dl.run-in dt, dl.run-in dt:after {font-weight:bold}
dl.run-in dt {display:run-in}
dl:lang(en).run-in.colon dt:after {content:": "}
dl:lang(fr).run-in.colon dt:after {content:"\00a0: "}
Post-It™
.post-it {
background:#ffffa1;
border:thin solid #ffc700;
font-family:cursive;
margin:0 25% 0 25%;
padding:.5em;
width:30%
}
Dialogs (French and English)
ul {list-style:none}
ul li q:lang(fr) {quotes : '«\202F' '\202F»' "“" "”" "‘" "’"}
ul li q:lang(en) {quotes : "“" "”" "‘" "’"}
ul li:first-child q:before {content:open-quote}
ul li:first-child q:after {content:no-close-quote}
ul li q:before {content:no-open-quote'\2012';padding-right:0.5em}
ul li q:after {content:no-close-quote}
ul li:last-child q:after {content:close-quote}