css3 Cheatsheet 2017 Emezeta PDF
css3 Cheatsheet 2017 Emezeta PDF
tag [attributes] #id .class :pseudoclass ::pseudoelement { color: color RGB 237 + 63 + 0 = RGB(237, 63, 0)
HSL 11 + 255 + 119 = HSL(11, 255, 119)
selector : value ; opacity: 1 alpha
} COMMENTS (ANNOTATIONS)
COLOR MODELS
/* comment */ KEYWORDS
S CSS Selectors EXAMPLE /* IE sucks */
SELECTORS & COMBINATORS
colorkey transparent currentColor
NUMERIC FORMAT
# element with id="unique" #unique EXAMPLES
. elements with class="c1" .c1 RGB( red , green , blue ) RGB(65, 106, 225)
* all elements inside of div (universal) div * # red_hex green_hex blue_hex #416AE1 short form: #46E
inner div elements inside of div (descendant) div div HSL( hue , saturation , lightness ) HSL(159, 185, 145)
> direct childs of div (child) div > div WITH ALPHA CHANNEL EXAMPLES
+ adjacents elements (adjacent sibling) div + div RGBA( red , green , blue , alpha ) RGBA(65, 106, 225, 0.5)
~ siblings elements at same level (general sibling) div ~ div HSLA( hue , saturation , lightness , alpha ) HSLA(159, 185, 145, 1)
ATTRIBUTES IGNORE CASE SENSITIVE [attr="..." i] COLOR COMPONENTS
[attr] elements with attr attribute present red green blue numeric value between [0 ... 255]
[attr="val"] elements with attr= attribute with value val "val" red_hex green_hex blue_hex hexadecimal value [00 ... FF]
[attr~="val"] elements with attr~= that contains val "abc val xyz" hue numeric value (degrees) between [0 ... 360deg]
[attr|="es"] elements with attr|= that contains es-* "en-US es-ES" saturation lightness percentage values [0%...100%]
[attr*="val"] elements with attr*= that includes val "equivalent-is-" alpha number value between [0.0 ... 1.0]
[attr^="val"] elements with attr^= that begins with val "value-is-..."
[attr$="val"] elements with attr$= that ends with val "in-interval" V CSS Values & Units IMPORTANT
:checked elements toggled "on" by user em computed value on current vw viewport width %
:indeterminate input on indeterminate state ex x-height of lowercase "x" vh viewport height %
:read-only :read-write readonly input or modiable ch advance measure of "0" glyph vmin smaller (vw or vh)
:placeholder-shown inputs that shows placeholder at now rem computed value on root elem vmax larger (vw or vh)
:default default elements for form (input, option, ...) ABSOLUTE SIZES ANGLES DURATIONS
:valid :invalid userdata pass/not pass check validation px pixels deg degrees [0..360] s seconds
:in-range :out-of-range userdata in range/out of range cm centimeters grad gradians [0..400] ms millisecs
:required :optional elements required/optional for submit mm millimeters rad radians [0..6.28] PERCENTAGES
:rst-child rst child of group of elements ~ :nth-child(1) Q quarter-mm rad turns [0.0..1.0] value %
STRUCTURAL
CHILD ELEMENTS
:last-child last child of group of elements ~ :nth-last-child(1) in inches CUSTOM PROPERTIES (CSS VARIABLES) EXAMPLE 75%
th
:nth-last-child(n) last n child of group of elements expr pt points -- varname : value ; var( -- varname , fallback ... )
EXAMPLE --size: 100px; EXAMPLE calc(var(--size, 50px) * 2);
:only-child unique child ~ :rst-child:last-child
:rst-of-type rst child of same type M CSS Media Features
CHILD OF SAME TYPE
:nth-of-type(n) nth child of same type MIN MAX width size MIN MAX device-width size
:nth-last-of-type(n) last nthchild (same type) MIN MAX height size MIN MAX device-height size
:only-of-type unique child (same type)
legend ASPECT RATIO
:root root element of the document
OTHERS
optional keyword MIN MAX aspect-ratio ratio MIN MAX device-aspect-ratio ratio
:empty element without contents
:not(x) not match by x selector keyword COLORS
OTHERS
:target is the target of anchor URL wide unsupport MIN MAX color number MIN MAX color-index number
:lang(x) elements in x language shorthand value OTHERS
EXAMPLES
PSEUDOELEMENTS userdata value MIN MAX monochrome number device-min-width: 640px
::rst-line rst line of text element detailed value MIN MAX resolution dpi/dpcm device-aspect-ratio: 16/9
::rst-letter rst letter of text element default value orientation portrait landscape max-color-index:256
pseudoclass min-resolution:300dpi
scan progressive interlace min-monochrome:2
pseudoelement grid number grid:1
CSS3 WEB DESIGN CHEAT SHEET FONTS, TEXT, SPEECH & RULES
Created by @Manz ( http://twitter.com/Manz ) https://lenguajecss.com/
GENERIC FONT
T CSS Text L3
serif sans-serif cursive fantasy monospace
F Fonts TRANSFORMING TEXT
EXAMPLE font-family: Verdana, Arial, sans-serif;
FONTS (TYPOGRAPHY) text-transform: none capitalize uppercase lowercase full-width
font-family: font1 , font2 , font3 ..., genericfont WHITE SPACES
font-size: size % ,
white-space: normal pre nowrap pre-wrap pre-line
smaller larger tab-size: 8 number size
REL
play-during: auto none url( snd.mp3 ) mix repeat text-decoration: none underline overline line-through
URI
LEVEL 3
azimuth: angle center left-side far-left left center-left
LFT
right-side far-right right center-right text-decoration-line: none underline overline line-through blink
RGT
REL
VOICE CHARACTERISTICS
text-decoration-skip: none objects spaces ink edges
box-decoration
speech-rate: number x-slow slow medium fast x-fast
ABS
STATUS
voice-family: voice1 , voice2 , voice3 ..., genericvoice text-underline-position: auto under left right
EMPHASIS MARKS
lled open
pitch: frequency x-low low medium high x-high EXAMPLE open circle;
pitch-range: 50 number text-emphasis-style: none string
GENERIC VOICE
richness: 50 number status dot circle double-circle triangle sesame
male female child
stress: 50 number text-emphasis-color: currentColor color
EXAMPLE voice-family: Romeo, male;
SPEECH text-emphasis-position: over under left right
speak-punctuation: none code text-emphasis: style color
speak-numeral: continuous digits TEXT SHADOW
@ CSS Rules
serif font monospaced font
FONT LOADING MEDIA QUERIES (RESPONSIVE DESIGN)
4P
ridge
top left right bottom top left right bottom
3P
3P
2P
SPECIFIC CORNERS
top right bottom left top right bottom left outset
1P
1P
border-top-left-radius: 0 size %
OVERFLOW/VISIBILITY
border-top-right-radius: 0 size % 2-PARAMETER FORMAT
overow-x: visible hidden scroll auto no-display no-content
border-bottom-right-radius: 0 size % size-h size-v
overow-y: visible hidden scroll auto no-display no-content size-v
border-bottom-left-radius: 0 size % 1-PARAMETER
size-h
overow: overow-x overow-y size-h = size-v
MAIN SHORTHAND
inline-block block
BLK
number %
B CSS Border Image bottom
I CSS Images IMAGE OUTSET
START SIZE BORDER IMAGE
GRADIENTS number size
size % border-image-source: none url( img.png )
URI
LINEAR GRADIENTS
repeating-linear-*
background-image: border-image-slice: 100% top right bottom left ll
linear-gradient( direction color1 start , color2 start , ... ) border-image-width: 1 top right bottom left
RADIAL GRADIENTS border-image-outset: 0 top right bottom left
repeating-radial-*
background-image: border-image-repeat: stretch repeat round space
radial-gradient( shape rsize at pos color1 start , color2 ... ) border-image: source slice /width outset repeat
GRADIENT OPTIONS DIRECTION
REPEAT-STYLE PARAMETERS
shape rsize to top
to top to top repeat space round no-repeat
circle radius at pos ... left 360deg right B Backgrounds
EXAMPLE repeat no-repeat (or repeat-x)
ellipse rh rv at pos ... 325deg 35deg LEVEL 2
EXAMPLE (ellipse 55px 45px at top, red, blue) to to background-color: transparent color
270deg 90deg
left right background-image: none url( image.png ) , url( image.jpg ) , ...
URI
URI
REFERENCE BOX
A, a
shape-box = box margin-box
upper-roman lower-roman decimal decimal-leading-zero
OTH III, iii
1, 01
box = content-box padding-box border-box
lower-greek armenian georgian none
S CSS Shapes list-style: type position image
FLOAT AREA SHAPE GENERATED CONTENT
shape-outside: none url( img.png )
URI
content: normal none url( img.jpg ) attr( attr ) ' string '
STR
ATT
URI
basic-shape geometry-box open-quote close-quote no-open-quote no-close-quote
shape-image-threshold: 0.0 number counter( name , list-style-type )
CNT
PSEUDOCLASSES
shape-margin: 0 size % content-increment: none name
BASIC SHAPES
::before before element
content-reset: none name ::after after element
RECTANGLE
quotes: ' open-str ' ' close-str ' none EXAMPLE p::before { content: "-"; }
inset( top right bottom left round border-radius ) MARKERS
CIRCLE/ELLIPSE
::marker item's marker generated by list item (bullet, number...)
circle( shape-radius at position
) ) marker-side: list-item list-container
ellipse( radius_x radius_y at position
) )
U User Interface
POLYGON
SHAPE RADIUS BOX MODEL
polygon( x0 y0 , ... , xi yi )
size % farthest-side closest-side box-sizing: content-box border-box
M CSS Masks OUTLINE
mask-composite: add subtract intersect exclude cursor: auto default none url( img.png ) x y
URI
mask: image mode position / size repeat clip composite context-menu help pointer progress wait
BORDER-BOX MASK cell crosshair text vertical-text zoom-in zoom-out
mask-border-source: none url( img.svg#mask ) alias copy move no-drop not-allowed grab grabbing
URI
transition-property: all none property1 , property2 , ... transform: none transform1 transform2 ...
transition-duration: 0s time 2D TRANSFORMS
TRACKS
ITEM PROPERTIES
auto size % fr automatic size or specic size/fraction unit
FLEXIBILITY
ex-grow: 0 number [ linename ] auto size % fr named grid lines + specic size
ex-shrink: 0 number minmax( min , max ) min <= size range <= max
ex-basis: auto content size % repeat( number , tracks ) repeat fragments n times
order: 0 number
AREA GRID
A CSS Align grid-template-areas: " area1 area2 " ... " areaY areaZ "
CONTAINER PROPERTIES
AREAS EXAMPLE
CONTENT DISTRIBUTION
area grid area name (grid-area) #grid { display:grid;
OVERFLOW POSITION
grid-template: none
SELF-POSITION
safe unsafe template-rows / template-columns
start center end (self, content)
IMPLICIT GRID
self-start self-end (self)
ITEM PROPERTIES
PRIMARY AXIS ITEM GRIDS
justify-self: auto normal stretch baseline-position LINE-BASED PLACEMENT
LINES
TABLES
number name refer to a numbered or named grid line
grid-area: template-area