Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The ABCs of CSS You've Likely Never Used
Search
Alicia Sedlock
August 08, 2017
Technology
0
45
The ABCs of CSS You've Likely Never Used
That Conference 2017
Alicia Sedlock
August 08, 2017
Tweet
Share
More Decks by Alicia Sedlock
See All by Alicia Sedlock
How To Fights and Prevent Burnout
aliciasedlock
2
20k
The State of Front-End Testing
aliciasedlock
2
490
The Landscape of Front-End Testing
aliciasedlock
3
1.2k
You Can Make Games
aliciasedlock
1
120
Jumping Into Front-End Testing
aliciasedlock
3
150
Let's Get Testable: An Introduction to Unit Testing
aliciasedlock
4
800
Other Decks in Technology
See All in Technology
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
1.1k
グローバル展開を見据えたサービスにおける機械翻訳プラクティス / dp-ai-translating
cyberagentdevelopers
PRO
1
150
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
180
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
7
1.5k
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
330
日経電子版におけるリアルタイムレコメンドシステム開発の事例紹介/nikkei-realtime-recommender-system
yng87
1
520
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
220
使えそうで使われないCloudHSM
maikamibayashi
0
170
来年もre:Invent2024 に行きたいあなたへ - “集中”と“つながり”で楽しむ -
ny7760
0
480
[AWS JAPAN 生成AIハッカソン] Dialog の紹介
yoshimi0227
0
150
Autify Company Deck
autifyhq
1
39k
いまさらのStorybook
ikumatadokoro
0
150
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1365
200k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Scaling GitHub
holman
458
140k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
680
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
BBQ
matthewcrist
85
9.3k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Transcript
The ABCs of CSS Properties You’ve Likely Never Used (Well,
Mostly!) Alicia Sedlock | @aliciability
Hi!
None
What’s your favorite CSS property or module?
None
There’s a lot of CSS I don't know.
A additive-symbols “… specify symbols when the value of a
counter system descriptor is additive.”
@counter-style custom-counter { system: additive; additive-symbol: I 1; } .list
{ list-style: custom-counter; }
@counter-style custom-counter { system: additive; additive-symbol: “>” 3; } .list
{ list-style: customer-counter; }
@counter-style custom-counter { system: additive; additive-symbol: “X” 10, “V” 5,
“I” 1; }
B ::backdrop “…is a box rendered immediately below any
element rendered in fullscreen mode.”
dialog { /* some dialog styles */ } dialog::backdrop {
background: black; opacity: .5; }
None
C caret-color “…sets the color of the caret in
an element.”
input.custom { caret-color: red; }
None
D :default “…represents any user interface element that is
the default among a group of similar elements.”
:default { background-color: pink; } <form> <input type=“button” value=“Button” />
<input type=“submit” /> <input type=“reset” /> </form>
None
E :empty “ ..any element that has no children
at all.”
div { background: lightblue; } div:empty {
background: pink; } <div><!— No content —></div> <div>Hello world!</div> <div> <!— No content —> </div>
None
F ::first-letter “…applies styles to the first letter of
the first line of a block-level element…”
p::first-letter { color: red; font-size: 3em; font-weight: bold;
} <p>The quick brown fox</p>
p::first-letter { color: red; font-size: 3em; font-weight: bold;
} <p> <img src=“fox.jpg” /> The quick brown fox </p>
G grayscale()
.fox1 { filter: grayscale(.95); } .fox2 { filter: grayscale(.55); }
.fox3 { filter: grayscale(.15); }
H hyphens “…how words should be hyphenated when text
wraps across multiple lines.”
<p>That Conference is extreme­ly rad!</p> p { hyphens: none; width:
55px; }
<p>That Conference is extreme­ly rad!</p> p { hyphens: manual; width:
55px; }
<p>That Conference is extreme­ly rad!</p> p { hyphens: auto; width:
55px; }
I :in-range “…matches when the value currently contained inside
an <input> element is inside the range limits specified by the min and max attributes.”
None
<label>Enter a number 1-10</label> <input type="number" min="1" max="10" value="12" />
input:in-range { background-color: rgba(0, 255, 0, 0.25); } input:out-of-range { background-color: rgba(255, 0, 0, 0.25); border: 2px solid red; }
None
J justify-content ONLY ENTRY “…defines how the browser distributes
space between and around content items along the main axis of their container.”
.container { display: flex; justify-content: <value>; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
.container { display: flex; justify-content: flex-start; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
.container { display: flex; justify-content: flex-end; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
.container { display: flex; justify-content: center; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
.container { display: flex; justify-content: space-around; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
.container { display: flex; justify-content: space-between; } <div class=“container”> <div><!—
Content! —></div> <div><!— Content! —></div> <div><!— Content! —></div> </div>
K khz “…represents a frequency dimension, such as the
pitch of a speaking voice.”
p.low { pitch: 105Hz; } em.high { pitch: 135Hz; }
L :lang “…matches elements based on the language the
element is determined to be in.”
<html lang=“en”></html>
<div lang=“en”>Hello, world!</div> <div lang=“fr”>Bonjour, le monde!</div> <div lang=“de”>Hallo, Welt!</div>
:lang(en) { border: 1px solid red; } :lang(fr) {
border: 1px solid blue; } :lang(de) { border: 1px solid black; }
M max-zoom “…sets the maximum zoom factor of a
document defined by the @viewport at- rule."
* { max-zoom: 150%; max-zoom: 2.0; }
N negative “…alters the representation of negative counter values,
by providing a way to specify symbols to be appended or prepended to the counter representation when the value is negative.”
<ul class="list" start="-3"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul>
@counter-style negative-counter { system: numeric; symbols: "0" "1" "2" "3"
"4" "5" "6" "7" "8" "9"; negative: "(-" ")"; } .list { list-style: negative-counter; }
None
O object-fit “…how a replaced element, such as an
<img> or <video>, should be resized to fit its container.”
/* Base styles for examples */ img { width: 400px;
height: 500px; border: 5px solid pink; object-fit: <value>; }
None
None
None
None
None
P pointer-events “…specifies under what circumstances a particular graphic
element can become the target of mouse events.”
div { pointer-events: none; }
<div> Lorem ipsum dolor sit amet… </div> <div class="overlay"> I
am an overlay. Try selecting the text behind me. </div>
.overlay { position: absolute; top: 0; left: 40%; background: rgba(0,0,0,.75);
height: 200px; width: 250px; color: white; padding: 1em; pointer-events: auto; }
pointer-events: auto
pointer-events: none
pointer-events: visiblePainted; pointer-events: visibleFill; pointer-events: visibleStroke; pointer-events: visible; pointer-events: painted;
pointer-events: fill; pointer-events: stroke; pointer-events: all;
Q quotes “…indicates how user agents should render quotation
marks.”
<span>According to Groot, <q>I am Groot.</q>.</span> q { quotes:
"**" “**”; } q:before { content: open-quote; } q:after { content: close-quote; }
<span>Peter Quill says <q>I'm pretty sure the answer is <q>I
am Groot</q>.</q></span> q { quotes: ’””’ ‘“”’ “‘’” “‘’”; } q:before { content: open-quote; } q:after { content: close-quote; }
R revert “…rolls back the cascade so that a
property takes on the value it would have had if there were no styles in the current style origin"
None
S suffix “…specifies a symbol that will be appended
to the marker representation.”
<ul class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul>
@counter-style counter-options { system: fixed; symbols: A B C D
E F G; suffix: “) ”; } .list { list-style: counter-options; }
None
T tab-size “…used to customize the width of a
tab (U+0009) character.”
pre { tab-size: 4; /* integer values */ tab-size: 2;
tab-size: 10px; /* length values */ tab-size: 2em; }
<pre class=“default"> 	This is a line in pre! 	CSS is
a lot of fun. :) </pre> pre { border: 1px solid black; width: 500px; }
<pre class=“default"> 	This is a line in pre! 	CSS is
a lot of fun. :) </pre> pre { border: 1px solid black; width: 500px; tab-size: 4; }
<pre class=“default"> 	This is a line in pre! 	CSS is
a lot of fun. :) </pre> pre { border: 1px solid black; width: 500px; tab-size: 100px; }
U unset “…resets a property to its inherited value
if it inherits from its parent, and to its initial value if not.”
<p>I want to be blue text!</p> <div class="foo"> <p>I want
to be orange text :(</p> </div> <div class="bar"> <p>I don't want to be orange.</p> </div> .foo { color: orange; } .bar { color: green; } p { color: blue; } .bar p { color: unset; }
None
V vw/vh “Equal to 1% of the width/height of the
viewport's initial containing block.”
W will-change “…provides a way for authors to hint browsers
about the kind of changes to be expected on an element, so that the browser can set up appropriate optimizations ahead of time…”
div { will-change: transform; will-change: opacity; will-change: contents; /* custom-ident
*/ will-change: scroll-behavior; /* custom-ident */ }
A warning on will-change • Intended as a “last resort”
- don’t prematurely optimize • Meant to be used sparingly
X Y
* { xtreme: ‘heck-yeah’; }
* { yolo: 100; }
Z z-index “… specifies the z-order of a positioned element
and its descendants.”
What the heck do I do with this now?
Depth of CSS
Some of these things are • Experimental technology • In
working draft • In initial definition
Grid Layout Hype
P pointer-events “…specifies under what circumstances a particular graphic
element can become the target of mouse events.”
None
None
A Challenge
None
Thank you.