a {
text-decoration: none;
}h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}p.uppercase {
text-transform: uppercase;
}
p.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}p {
text-indent: 50px;
}h1 {
letter-spacing: 3px;
}
h2 {
letter-spacing: -3px;
}h1 {
word-spacing: 10px;
}
h2 {
word-spacing: -5px;
}#div1 {
white-space: nowrap;
width: 12em;
overflow: hidden;
text-overflow: clip;
border: 1px solid #000000;
}
#div2 {
white-space: nowrap;
width: 12em;
overflow: hidden;
text-overflow: ellipsis;
border: 1px solid #000000;
}p {
word-wrap: break-word;
}| Hexadecimal | #RRGGBB | {background-color: #ff0000;} |
| RGB | rgb(red, green, blue) | {background-color: rgb(255, 0, 0);} |
| RGBA | rgba(red, green, blue, alpha) | {background-color: rgba(0, 0, 255, 0.3);} |
| HSL | hsl(hue, saturation, lightness) | {background-color: hsl(120, 100%, 25%);} |
| HSLA | hsla(hue, saturation, lightness, alpha) | {background-color: hsla(120, 100%, 50%, 0.3);} |
img {
opacity: 0.4;
}<div class="background">
<div class="transbox">
<p>This is some text that is placed in the transparent box.</p>
</div>
</div>div.background {
background: url(images/w3css.gif) repeat;
}
div.transbox {
margin: 5px;
background-color: #ffffff;
opacity: 0.8;
}background-position: right top;
background-attachment: fixed;
background-size: cover; font-family: "Times New Roman", Times, serif;div {
border-radius: 25px;
}div {
border-radius: 50%;
width: 200px;
height: 200px;
}selector:pseudo-class {
property:value;
}
p:first-child {
color: blue;
}| :first-child | p:first-child |
|---|---|
| :hover | a:hover |
| :nth-child(n) | p:nth-child(2) |
| :not(selector) | :not(p) |
<div>
<i class="icon-ok"></i>
I am the ok icon!
</div>.icon-ok:before {
content: "\f00c";
}selector::pseudo-element {
property:value;
}
p::first-line {
color: #ff0000;
font-variant: small-caps;
}::selection {
color: red;
background: yellow;
}Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}body {
font: 100% Helvetica, sans-serif;
color: #333;
}nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
}nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
}
nav a {
display: block;
padding: 6px 12px;
text-decoration: none;
}// _reset.scss
html,
body,
ul,
ol {
margin: 0;
padding: 0;
}// base.scss
@import 'reset';
body {
font: 100% Helvetica, sans-serif;
background-color: #efefef;
}html, body, ul, ol {
margin: 0;
padding: 0;
}
body {
font: 100% Helvetica, sans-serif;
background-color: #efefef;
}@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
.box { @include border-radius(10px); }.box {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
border-radius: 10px;
}.message {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.success {
@extend .message;
border-color: green;
}
.error {
@extend .message;
border-color: red;
}
.warning {
@extend .message;
border-color: yellow;
}.message, .success, .error, .warning {
border: 1px solid #cccccc;
padding: 10px;
color: #333;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}@each $animal in puma, sea-slug, egret, salamander {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
}
}.puma-icon {
background-image: url('/images/puma.png'); }
.sea-slug-icon {
background-image: url('/images/sea-slug.png'); }
.egret-icon {
background-image: url('/images/egret.png'); }
.salamander-icon {
background-image: url('/images/salamander.png'); }A simple and lightweight mixin library for Sass.
// Bourbon mixin with Sass
section {
@include linear-gradient(to top, red, orange);
}/* Compiled CSS */
section {
background-color: red;
background-image: -webkit-linear-gradient(bottom, red, orange);
background-image: linear-gradient(to top, red, orange);
}