CSS Cheat Sheet
CSS Cheat Sheet
com
CSS CheatSheet
Basics
Syntax
Selectors
selector{
* all elements property: value;
div all div tags property2: value2;
div,p all divs and paragraphs }
div p paragraphs inside divs
div > p all p tags, one level deep in div Include external css file
div + p p tags immediately after div <link rel="stylesheet" type="text/css" href="/style.css" />
div ~ p p tags preceded by div
.classname all elements with class
Internal styles
#idname element with ID
div.classname divs with certain classname <style type="text/css">
div#idname div with certain ID div { color: #444;}
#idname * all elements inside #idname </style>
https://htmlcheatsheet.com/css/ 1/3
4/17/24, 2:25 PM CSS Cheat Sheet - Interactive, not a PDF | HTMLCheatSheet.com
Change gradient, shadow, font and border in other panels. co
Light background co
co
PREVIEW CSS Button co
co
co
Right: 2 co
co
Down: 2 co
co
.myButton {
Blur: 2 co
color: rgb(255, 255, 255); font-size: 16px; line-height: 16px; padding: 6px;
co
border-radius: 10px; font-family: Georgia, serif; font-weight: normal; text-
Opacity: 1 co
decoration: none; font-style: normal; font-variant: normal; text-transform: none;
cu
b k di li di t(t i ht b(28 110 164) 0% b(35 136
Color: 1C6EA4 di
di
g em
Flaming Ghost Candy fil
Neon Flaming LLuuxx Ghost
Ghost
Ghost Candy Deep
Deep more...
L u x Ghost Deep
Deep Font Generator fle
LLuuxx Deep
Deep
fle
text-shadow: 2px 2px 2px #1C6EA4; fle
Light background
fle
Grumpy wizards make toxic brew for the evil Queen fle
and Jack. fle
fle
flo
fo
Transform @
Font: Georgia fo
fo
Scale: 1 1 x fo
Size: 16
fo
Rotate: 0 0 deg fo
Letter spc: 0
fo
X: 0 0 px fo
Word spc: 0
ha
Y: 0 0 px he
Color: 000000
ju
Skew X: 0 0 deg @
Weight: Normal Bold le
Skew Y: 0 0 deg le
Decoration: None Under Over Through lin
lis
Style: Normal Unset Italic Oblique lis
Preview lis
Variant: Normal Small caps lis
m
Case: m
none UPPER lower Capital
m
m
font-family: Georgia, serif; m
-moz-transform:none;
font-size: 16px; m
-webkit-transform:none;
letter-spacing: 2px; m
-o-transform:none; word-spacing: 2px;
-ms-transform:none; @
color: #000000; m
t f
font-weight: normal; m
text-decoration: none; na
na
na
Border Radius na
na
op
0 0 Media Queries or
All ou
Syntax ou
ou
@media not|only mediatype and (media feature) { ou
0 0 CSS Code } ou
Link external file: ov
<link rel="stylesheet" media=mediatype and|not|only (media feature href="myst ov
ov
Viewport is 480 pixels or smaller pa
Reset CSS pa
@media screen and (max-width: 480px) { }
pa
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a
pa
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section Viewport width smaller OR height smaller pa
body { line-height: 1;} @media screen and (max-width: 600px), (max-height: 500px) { pa
ol,ul { list-style: none;} pa
blockquote,q { quotes: none;} pa
Print style
blockquote:before,blockquote:after,q:before,q:after { content: ''; content: n pe
table { border-collapse: collapse; border-spacing: 0;} @media print { ... } pe
po
Night / dark mode qu
@media (prefers-color-scheme: dark) { ... } re
px - em rig
ta
Media types
Parent: 0 px ta
all, print, screen, speech te
desired px: 0 px te
Media features
te
desired em: 0 em width viewport width te
height viewport height te
orientation orientation of the viewport te
aspect-ratio ratio between width & height te
color number of bits per color to
color-index number of displayable colors tra
monochrome color on greyscale device tra
resolution resolution of the device tra
https://htmlcheatsheet.com/css/ 2/3
4/17/24, 2:25 PM CSS Cheat Sheet - Interactive, not a PDF | HTMLCheatSheet.com
scan scanning process of the device tra
grid device is a grid or bitmap tra
tra
tra
tra
un
us
ve
vi
w
w
w
w
w
z-
HTML Cheat Sheet is using cookies. | PDF | Terms and Conditions, Privacy Policy
© HTMLCheatSheet.com
https://htmlcheatsheet.com/css/ 3/3