<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<link href="style.css" type="text/css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
</head>
<body>
...
</body>
</html>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<p>content</p>
<br>
<hr>
<div class="kind">
content
</div>
<span class="kind">
content
</span>
<article>
<h2>Header</h2>
content
</article>
<section>
<h2>Header</h2>
content
</section>
<figure>
content
<figcaption>Caption</figcaption>
</figure>
<strong>strong</strong>
<em>emphasized</em>
<i>semantic</i>
<s>strikethrough</s>
<abbr title="abbreviation">abbr</abbr>
<mark>mark</mark>
<u>underline</u>
<sup>sup</sup>
<sub>sub</sub>
inline quote
<q>inline quote</q>
<time datetime="2017-05-18T13:30">
May 18
</time>
block quote
<blockquote>block quote</blockquote>
<dfn>term</dfn>
<cite>citation</cite>
<data value="42">data</data>
code()
<code>code()</code>
<samp>sample output</samp>
<kbd>Ctrl</kbd>
<var>variable</var>
<form action="" method="get">
<label for="name">Name:</label>
<input id="name" name="name">
<input type="submit" value="Save">
</form>
<form action="" method="post">
<fieldset>
<legend>Title</legend>
<label for="fid">Label:</label>
<input id="fid" name="field">
<input type="submit" value="Save">
</fieldset>
</form>
<button>button</button>
<meter value="0.6">
<select>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
</select>
<select>
<optgroup label="Group 1">
<option>Value 1</option>
<option>Value 2</option>
</optgroup>
<optgroup label="Group 2">
<option>Value 3</option>
<option>Value 4</option>
</optgroup>
</select>
<progress value="0.6">
<textarea>content</textarea>
The gory details.
<details>
<summary>Summary</summary>
<p>The gory details.</p>
</details>
<label>label <input></label>
<label for="name">label</label>
<input id="name">
<input type="button" value="ok">
<input type="checkbox">
<input type="color">
<input type="date">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="month">
<input type="number">
<input type="password">
<input type="radio">
<input type="range">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="text">
<input type="hidden">
<input type="time">
<input type="url">
<input type="week">
<input type="image">
<a href="URL">open link</a>
<a href="URL" target="_blank" rel="noopener noreferrer">open link in new tab</a>
<img src="URL">
<img src="URL" alt="image description">
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
<dl>
<dt>Term</dt>
<dd>Definition</dd>
</dl>
<!-- comment -->
name | number |
---|---|
Footer | Total |
Andy | 42 |
Kevin | 1024 |
<table>
<caption>caption</caption>
<thead>
<tr>
<th>col-header</th>
<th>col-header</th>
</tr>
</thead>
<tfoot>
<tr>
<td>footer</td>
<td>footer</td>
</tr>
</tfoot>
<tbody>
<tr>
<th>row-header</th>
<td>data</td>
</tr>
</tbody>
</table>
name | number |
---|---|
Andy | 42 |
Kevin |
<td colspan="2">Kevin</td>
name | number |
---|---|
Andy | 42 |
1024 |
<td rowspan="2">Andy</td>
Andy | 42 |
Kevin | 1024 |
<colgroup>
<col style="..."></col>
</colgroup>
Andy | 42 |
Kevin | 1024 |
<colgroup>
<col span="2" style="..."></col>
</colgroup>
Name | Total |
Andy | 42 |
Kevin | 1024 |
<tfoot>
<tr>
<td>Name</td>
<td>Total</td>
</tr>
</tfoot>
<element>
element
<element class="a">
.a
<element id="id">
#id
<element class="a b">
element.a.b
<any>
*
<parent>
⋮
<descendant>
parent descendant
<parent>
<child>
parent > child
<sibling>
<self>
sibling + self
<sibling>
<self>
⋮
<self>
sibling ~ self
<div attr=*>
div[attr]
<div attr="value">
div[attr="value"]
<div attr="v1 v2">
div[attr~="v1"]
<div attr="value">
<div attr="value-*">
div[attr|="value"]
<div attr="value*">
div[attr^="value"]
<div attr="*value">
div[attr$="value"]
<div attr="*value*">
div[attr*="value"]
<div attr="VaLuE">
div[attr="value" i]
:root {
--bg-color: white;
}
.class {
background-color: var(--bg-color);
}
a:link { background-color: yellow }
a:visited { background-color: #ccc }
a:hover { background-color: green }
a:active { background-color: red }
a:active { background-color: red }
a:hover { background-color: green }
a:target { background-color: red }
.underline {
position: relative;
}
.underline::after {
position: absolute;
content: " ";
display: block;
border-top: 1px solid #999;
width: 70%;
}
.overline {
position: relative;
}
.overline::before {
position: absolute;
content: " ";
display: block;
border-bottom: 1px solid #999;
width: 70%;
}
"Times New Roman", serif;
"Arial", sans-serif;
"Courier", monospace;
"Source Sans Pro", sans-serif;
"Source Code Pro", monospace;
xx-large;
x-large;
large;
medium;
small;
x-small;
32px;
24px;
18px;
16px;
13px;
10px;
8px;
2em;
1.5em;
1.125em;
1em;
0.813em;
0.625em;
0.5em;
200%;
150%;
112.5%;
100%;
81.3%;
62.5%;
50%;
lighter;
normal;
bolder;
300;
400;
700;
font-style: italic;
font-variant: small-caps;
font-kerning: none;
font-kerning: normal;
left;
center;
right;
justify;
0.8em;
1em;
1.5em;
2em;
0.1em;
0.3em;
0.5em;
1em;
0.1em;
0.3em;
0.5em;
1em;
none;
capitalize;
lowercase;
uppercase;
baseline;
top;
middle;
bottom;
super;
sub;
50%;
-50%;
none;
circle;
decimal;
disc;
lower-alpha;
lower-roman;
upper-alpha;
upper-roman;
inside lower-roman;
outside lower-roman;
url('...');
none;
block;
inline-block;
inline;
Inline elements have no padding or margin.
margin
border
padding
content
content-box;
margin
border
padding
content
border-box;
100px;
50px;
20px;
8px;
10em;
4em;
1em;
0.5em;
100%;
40%;
20%;
10%;
100px;
50px;
20px;
8px;
10em;
4em;
1em;
0.5em;
4px;
10px;
20px;
4px 0;
10px 0;
20px 0;
0 4px;
0 10px;
0 20px;
padding-top: 20px;
padding-left:
20px;
padding-right:
20px;
padding-bottom: 20px;
4px;
10px;
20px;
4px 0;
10px 0;
20px 0;
0 4px;
0 10px;
0 20px;
margin: 0 auto;
Center block elements
margin-top: 20px;
margin-left:
20px;
margin-right:
20px;
margin-bottom: 20px;
scroll;
hidden;
visible;
top: 10px;
bottom: 10px;
left: 10px;
right: 10px;
(relative | absolute | fixed)
↘
static
position
Absolute
position
static
position
static
position
left:0; top:0;
right:0; top:0;
left:0; bottom:0;
right:0; bottom:0;
left:0; right:0;
top:0; bottom:0;
left:0; right:0;
top:0; bottom:0;
left:10%; right:10%;
top:10%; bottom:10%;
viewport
↘
left;
right;
left;
right;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
clear: left;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
clear: right;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquam leo fringilla hendrerit efficitur.
clear: both;
0;
20;
100;
flex;
inline-flex;
<flex-direction> <flex-wrap>;
row;
row-reverse;
column;
column-reverse;
wrap;
nowrap;
wrap-reverse;
flex-start;
center;
flex-end;
space-between;
space-around;
flex-start;
center;
flex-end;
baseline;
stretch;
flex-start;
center;
flex-end;
space-between;
space-around;
stretch;
<flex-grow> <flex-shrink>? || <flex-basis>;
0;
no grow
1;
10;
99;
0;
no shrink
1;
10;
99;
content;
50px;
50%;
100%;
flex-start;
center;
flex-end;
baseline;
stretch;
<div class="first">1</div>
<div class="second">2</div>
<div class="third">3</div>
.first, .second {
order: 1;
}
grid;
inline-grid;
1fr 1fr;
1fr 2fr;
1fr 2fr 1fr;
50% 1fr 2fr;
repeat(12, 1fr);
auto auto;
1fr 1fr;
1fr 2fr;
1fr 2fr 1fr;
repeat(4, 1fr);
0;
2px;
4px;
8px;
0 2px;
0 4px;
0 8px;
2px 0;
4px 0;
8px 0;
grid-auto-rows: 100px;
grid-auto-columns: 100px;
"nav nav nav" 1fr
"left body right" 3fr
"foot foot foot" 1fr
/ 1fr 2fr 1fr;
"nav nav " 1fr
"side body" 3fr
/ 1fr 2fr;
"d1 d2 d3" 1fr
"d4 d5 d6" 1fr
"d7 d8 d9" 1fr
". d0 ." 1fr
/ 1fr 1fr 1fr;
1fr 2fr
/ 1fr 2fr 1fr;
row;
row;
row dense;
column;
column;
column dense;
grid-column: left / right
1/span 1;
2/span 1;
span 1/-1;
1/span 2;
1/-1;
span 2/-1;
grid-row: top / bottom
1/span 1;
2/span 1;
span 1/-1;
1/span 2;
1/-1;
span 2/-1;
grid-area: top / left / bottom / right;
span 2;
1/span 2;
1/1/span 2/span 2;
1/span 2/span 2/-1;
span 2/1/-1/span 2;
span 2/span 2/-1/-1;
A | B |
C | D |
table;
A1 | B1 |
A2 | B2 |
table-row;
A1 | B1 |
A2 | B2 |
table-cell;
A1 | B1 |
A2 | B2 |
inline-table;
A1 | B1 |
A2 | B2 |
table-caption;
A1 | B1 |
A2 | B2 |
td {
border: 2px solid black;
}
A1 | B1 |
A2 | B2 |
table {
border: 2px solid black;
}
A1 | B1 |
A2 | B2 |
tr {
border: 2px solid black;
}
A1 | B1 |
A2 | B2 |
table td + td {
border-left: 2px solid black;
}
A1 | B1 |
A2 | B2 |
table tr + tr {
border-top: 2px solid black;
}
collapse;
separate;
0px;
2px;
4px;
8px;
abc |
top;
abc |
middle;
bottom |
bottom;
ab cd |
baseline;
none;
2px solid black;
2px dotted black;
2px dashed black;
8px double black;
8px groove lightgray;
8px ridge lightgray;
8px inset lightgray;
8px outset lightgray;
border-top: 3px solid black;
border-right: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
1px;
2px;
3px;
4px;
4px;
8px;
0px 16px;
100%;
-10px -10px gray;
-5px -5px gray;
-5px 5px gray;
-10px 10px gray;
10px -10px gray;
5px -5px gray;
5px 5px gray;
10px 10px gray;
10px 10px gray;
10px 10px 5px gray;
10px 10px 10px gray;
10px 10px 20px gray;
0 0 20px 2px black;
0 0 20px 10px white;
inset 0 0 10px 8px gray;
0 0 20px 5px white,
10px 10px 20px gray;
white;
black;
gray;
red;
green;
blue;
#fff;
#000;
#808080;
#f00;
#008000;
#00f;
rgb(255, 255, 255);
rgb(0, 0, 0);
rgb(128, 128, 128);
rgb(255, 0, 0);
rgb(0, 128, 0);
rgb(0, 0, 255);
hsl(0, 0%, 100%);
hsl(0, 0%, 0%);
hsl(0, 0%, 50%);
hsl(0, 100%, 50%);
hsl(120, 100%, 25%);
hsl(240, 100%, 50%);
#000;
#222;
#555;
#777;
#999;
#bbb;
#ccc;
#eee;
white;
black;
gray;
red;
green;
blue;
#fff;
#000;
#808080;
#f00;
#008000;
#00f;
rgb(255, 255, 255);
rgb(0, 0, 0);
rgb(128, 128, 128);
rgb(255, 0, 0);
rgb(0, 128, 0);
rgb(0, 0, 255);
hsl(0, 0%, 100%);
hsl(0, 0%, 0%);
hsl(0, 0%, 50%);
hsl(0, 0%, 50%);
hsl(120, 100%, 25%);
hsl(240, 100%, 50%);
#000;
#222;
#555;
#777;
#999;
#bbb;
#ccc;
#eee;
rgba(255, 0, 0, 0.1);
rgba(255, 0, 0, 0.2);
rgba(255, 0, 0, 0.3);
rgba(255, 0, 0, 0.5);
rgba(255, 0, 0, 0.7);
rgba(255, 0, 0, 0.9);
hsla(0, 100%, 50%, 0.1);
hsla(0, 100%, 50%, 0.2);
hsla(0, 100%, 50%, 0.3);
hsla(0, 100%, 50%, 0.5);
hsla(0, 100%, 50%, 0.7);
hsla(0, 100%, 50%, 0.9);
url(...);
(to bottom, black, #ccc);
(to bottom, blue, black);
(to bottom, green, black);
(to bottom, red, black);
(to right bottom, red, black);
(to left bottom, red, black);
white;
black;
gray;
red;
green;
blue;
#fff;
#000;
#808080;
#f00;
#008000;
#00f;
rgb(255, 255, 255);
rgb(0, 0, 0);
rgb(128, 128, 128);
rgb(255, 0, 0);
rgb(0, 128, 0);
rgb(0, 0, 255);
hsl(0, 0%, 100%);
hsl(0, 0%, 0%);
hsl(0, 0%, 50%);
hsl(0, 0%, 50%);
hsl(120, 100%, 25%);
hsl(240, 100%, 50%);
↑
(-45deg);
|
↑
(0);
|
↑
(45deg);
|
↑
(-90deg);
|
↑
(90deg);
|
|
↑
(-135deg);
|
↑
(180deg);
|
↑
(135deg);
|
perspective: 100px;
rotateX(45deg);
rotateY(45deg);
rotateZ(45deg);
rotate3d(1, 0, 0, 45deg);
rotate3d(0, 1, 0, 45deg);
rotate3d(0, 0, 1, 45deg);
scaleX(0.5);
scaleY(0.5);
translateZ(20px);
scale(0.5, 1);
scale(1, 0.5);
scaleZ(2)
translateZ(10px);
scale3d(0.5, 1, 1);
scale3d(1, 0.5, 1);
scale3d(1, 1, 2)
translateZ(10px);
(20deg, 0deg);
(-20deg, 0deg);
(0deg, 20deg);
(0deg, -20deg);
translateX(0);
translateX(25px);
translateY(25px);
translateX(25px)
translateY(25px);
translate(0, 0);
translate(25px, 0);
translate(0, 25px);
translate(25px, 25px);
translate3d(0, 0, 0);
translate3d(25px, 0, 0);
translate3d(0, 25px, 0);
translate3d(25px, 25px, 0);
translateZ(-25px);
translateZ(25px);
translate3d(0, 0, -25px);
translate3d(0, 0, 25px);
perspective-origin: 300% -200%;
1000px;
400px;
300px;
200px;
perspective: 400px
50% 50%;
300% 200%;
-300% 200%;
300% -200%;
-300% -200%;
perspective: 100px;
rotateY(60deg);
|
↑
50%;
|
↑
left;
|
↑
right;
|
---|---|---|---|
rotateY(-60deg);
|
↑
50%;
|
↑
left;
|
↑
right;
|
rotateX(60deg);
|
↑
50%;
|
↑
top;
|
↑
bottom;
|
rotateX(-60deg);
|
↑
50%;
|
↑
top;
|
↑
bottom;
|
rotateZ(45deg);
|
↑
50%;
|
↑
top left;
|
↑
bottom right;
|
---|
@media(max-width: 600px) {
element {
display: none;
}
}