<!DOCTYPE HTML>
<!DOCTYPE html>
<html lang="en">
<head>
<title>A tiny document</title>
</head>
<body>
<h1>Main heading in my document</h1>
<!-- Note that it is "h" + "1", not "h" + the letters "one" -->
<p>Look Ma, I am coding <abbr title="Hyper Text Markup Language">HTML</abbr>.</p>
</body>
</html>
autocomplete, autofocus, checked, contenteditable, data-*, href, id, maxlength...
<a>, <abbr>, <acronym>, <address>, <applet>, <area>, <article>, <aside>
<audio>, <table>, <tbody>, <td>, <template>, <textarea>, <tfoot>, <th>, <thead>
.a {
font-size: 12px;
}
SELECT a FROM dom WHERE classname = 'a'
:active
animation
animation-delay
animation-fill-mode
animation-iteration-count
animation-name
animation-play-state
animation-timing-function
attr()
autotop
touch-action
transform
transform-origin
height
width
transition-delay
transition-duration
transition-property
transition-timing-function
* {
margin: 0;
padding: 0;
}
#container * {
border: 1px solid black;
}
x {
background-color: blue;
}
#container {
border: 1px solid black;
}
.error {
color: red;
}
li a {
text-decoration: none;
}
":<param>" - pseudo class elements
a:visited {
color: red;
}
a:link {
color: purple;
}
select first `y` adjacent to `x`
ul + p {
color: red;
}
select all `y` which are direct children to `x`
div#container > ul {
border: 1px solid black;
}
<div id="container">
<ul>
<li> List Item
<ul>
<li> Child </li>
</ul>
</li>
<li> List Item </li>
<li> List Item </li>
<li> List Item </li>
</ul>
</div>
select all `y` adjacent to `x`
ul ~ p {
color: red;
}
attribute selector: select all x which have attribute `title`
a[title] {
color: green;
}
attribute selector: select all x which have attribute `attr` whose value is equal = z
a[href="www.google.com"] {
color: green;
}
// multiple attributes
a[href="www.google.com"][title="google"] {
color: green;
}
attribute selector: select all anchor tags which have attribute `href` whose value contains the word `tuts`
a[href*="tuts"] {
color: green;
}
attribute selector: select all anchor tags which have attribute `href` whose value start with the word `http`
a[href^="http"] {
color: green;
}
attribute selector: select all anchor tags which have attribute `href` whose value end with the word `.jpg`
a[href$=".jpg"] {
color: green;
}
Used of radio buttons and checkboxes.
input[type=radio]:checked {
border: 1px solid black;
}
A special pseudo class which can add content
.clearfix:after {
content: "";
display: block;
clear: both;
visibility: hidden;
height: 0;
}
.clearfix {
display: inline-block;
}
A special pseudo class which can add content
.clearfix:before {
content: "";
display: block;
clear: both;
visibility: hidden;
height: 0;
}
.clearfix {
display: inline-block;
}
1 based indexing
li:nth-child(3) {
color: red;
}
li:nth-child(4n) {
color: red;
}
1 based indexing. begins at end of the collection
li:nth-last-child(3) {
color: red;
}
li:nth-child(4n) {
color: red;
}
ul li:first-child {
border-top: none;
}
ul > li:last-child {
border-top: none;
}