CSS stands for Cascading Style Sheets. It is used to change the look of HTML by adding colors, fonts, borders, spacing, backgrounds, and layout. CSS can be written in a separate CSS file, inside a style tag, or directly inside an HTML tag as an inline style.
Each box has dropdowns for a reusable CSS class and a simpler inline HTML style.
Color
The color property changes the color of text. You can use color names, hex codes, RGB, or HSL.
pink text
blue text
yellow text
CSS ClassInline HTML Style
Background color
The background-color property changes the color behind text or inside a box.
Hey I don't like the color green!
CSS ClassInline HTML Style
Font family
The font-family property changes the font used for text. These examples use common web safe fonts.
Arial text
Courier New text
Georgia text
CSS ClassInline HTML Style
Font size
The font-size property changes how big or small text is. Pixels are the easiest way to change text size.
small text
medium text
big text
CSS ClassInline HTML Style
Line height
The line-height property changes the space between lines of text.
This text is squished together.
It is hard to read.
Large line height.
Easier to read.
CSS ClassInline HTML Style
Letter spacing
The letter-spacing property changes the space between letters. You can have spaced out text without manually spacing it out.
normal letters
spaced letters
very spaced letters
CSS ClassInline HTML Style
Text align
The text-align property changes the alignment of text. You can make text go left, right, center, or justified.
left text
center text
right text
CSS ClassInline HTML Style
Text decoration
The text-decoration property adds or removes lines on text.
underlined text
crossed out text
overline text
CSS ClassInline HTML Style
Text transform
The text-transform property changes how letters appear. Text can be uppercase, lowercase, capitalized, or normal. You can add it to a title or section so you do not have to manually capitalize the letters.
this text becomes uppercase
THIS TEXT BECOMES LOWERCASE
this text becomes capitalized
CSS ClassInline HTML Style
Width + Height
The width and height properties control how wide and tall something is.
300px wide and 80px tall
CSS ClassInline HTML Style
Display
The display property changes how an element acts on the page. It can make text sit in a box, inside the same line, be hidden, or be flexible and move when the screen changes.
The padding property adds space inside an element.
Look at how much room I have!
CSS ClassInline HTML Style
Margin
The margin property adds space outside an element. If you want your elements to social distance, here is how.
Don't come too close!
CSS ClassInline HTML Style
Border
The border property adds an outline around something. You define the size, style, and color.
solid border
dotted border
CSS ClassInline HTML Style
Border radius
The border-radius property rounds the corners of a box, image, or button.
rounded corners
At which point am I considered a oval?
CSS ClassInline HTML Style
Overflow
The overflow property controls what happens when content is too big for its box. It can make it into a scroll box, have it flow off the edge, or be hidden.
This is a small scroll box. Add lots of text here and the box will scroll instead of getting taller and taller. This is useful for bios, terms of service boxes, updates, or long notes.
CSS ClassInline HTML Style
Position
The position property changes how and where an element is placed on the screen. You can make something overlap on top of everything else with this.
What a lovely box I have, I sure hope nothing else encroaches on my space and blocks my text!
Bad news
CSS ClassInline HTML Style
Color gradient
A color gradient blends two or more colors together. The degree number controls the angle.
You can also put text on it.
CSS ClassInline HTML Style
Text shadow
The text-shadow property adds a shadow or glow behind text. Just like box-shadow, you can change the color, blur radius, and offset.
glowing text
shadow text
CSS ClassInline HTML Style
Box shadow
The box-shadow property adds a shadow or glow around a box, image, or button. You can change the offset, blur radius, and color of the shadow.
I'm an edgy box and I have a dark shadow.
I'm a happy glowing box with pink aura!
CSS ClassInline HTML Style
Opacity
The opacity property makes something transparent. Lower numbers are more transparent.
opacity 1
opacity 0.6
opacity 0.3
CSS ClassInline HTML Style
2D transform
The transform property can rotate, move, stretch, or resize an element.
I'm all wobbly...
CSS ClassInline HTML Style
Button style
CSS can change how buttons and links look, including background color, border, padding, text color, and hover effects.
CSS ClassInline HTML Style
Cursor
The cursor property changes what the mouse looks like when hovering over something. You can use a preselected cursor icon or import an image to use as a cursor. The smaller the image the better. The browser may reject big images.