CSS3

Style your web pages with modern CSS techniques including
Flexbox, Grid, transitions, and responsive design.

Box Model Properties

margin

Definition: Controls the space outside the element's border.

Values: length (px, em), %, auto

Usage: margin: 20px; or margin: 10px 15px 5px 0;

padding

Definition: Controls the space between the content and the element's border.

Values: length (px, em), %

Usage: padding: 15px; or padding: 10px 5px;

Text and Font Properties

font-family

Defines the typeface used. Values: Arial, 'Times New Roman', sans-serif

font-style

Sets italic or normal text. Values: normal, italic, oblique

font-variant

Enables small caps. Values: normal, small-caps

line-height

Defines line spacing. Values: normal, number, length, percentage

letter-spacing

Adjusts space between letters. Values: normal, length

word-spacing

Adjusts space between words. Values: normal, length

text-align

Horizontal alignment. Values: left, right, center, justify

text-decoration

Decorates text. Values: none, underline, overline, line-through

text-transform

Text casing. Values: none, capitalize, uppercase, lowercase

Box and Border Properties

border

Shorthand for border width, style, color

border-radius

Rounds corners. Values: length or percentage

box-shadow

Shadow behind box. Format: h-offset v-offset blur spread color

box-sizing

Box model choice. Values: content-box, border-box

Layout Properties

float

Floats element. Values: left, right, none

clear

Prevents float wrapping. Values: left, right, both

z-index

Stacking order. Values: integer

overflow

Handles overflow. Values: visible, hidden, scroll, auto

visibility

Element visibility. Values: visible, hidden, collapse

Flexbox Properties

flex-direction

Direction of items. Values: row, row-reverse, column, column-reverse

flex-wrap

Wraps items. Values: nowrap, wrap, wrap-reverse

align-content

Aligns multi-line flexbox content. Values: flex-start, flex-end, center, space-between

flex

Shorthand for grow, shrink, basis. Example: flex: 1 1 auto

Grid Properties

grid-template-rows

Defines grid row sizes. Example: 100px auto 1fr

grid-column / grid-row

Item placement. Example: grid-column: 1 / span 2

place-items

Shortcut for align-items and justify-items

Animation & Effects

animation

Shorthand for animation properties like duration, name, delay, etc.

transition

Smooth value change. Example: transition: all 0.5s ease-in-out

opacity

Transparency. Value: 0 to 1

Media Queries

@media

Applies styles based on screen size or conditions.

Examples:

@media screen and (max-width: 600px) {
  body { background-color: lightgray; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .container { padding: 30px; }
}
        

Reference Links

MDN Web Docs: MDN CSS Reference

W3Schools CSS: W3Schools CSS Reference

CSS Tricks Almanac: CSS-Tricks Almanac