CSS Selectors

Selectors

* {}

selects all elements

p {}

selects all <p> elements

*.c {}

selects all elements where

p.c {}

selects all <p> elements where

#main {}

selects one element where id =”main”

a:link {}

selects all unvisited links

a:visited{}

selects all […]

Layout CSS properties and values

Layout

Inherited

Default value

Possible values

Float

 

Applies to all except cells and rows

float:

 

none

left, right

Clear

 

Applies to all except inlines, inline-blocks, cells, & rows.

clear:

 

none

left, right, both

Positioned

 

Applies […]

Content CSS properties and values

Content

Inherited

Applies to all except for rows

default value

possible values

padding:

0
LENGTH

padding-left:

0
LENGTH

padding-right:

0
LENGTH

padding-top:

0
LENGTH

padding-bottom:

0
LENGTH

font:
yes
caption
Icon, menu, message-box, small-caption, status-bar

font-family:
yes
serif
FONTLIST, sans-serif, monospace, fantasy, cursive

font-size:
yes
medium
LENGTH,%ParentElementFontSize, xx-small,x-small, smaller, small, large, larger, x-large,  xx-large

font-style:
yes
normal
italic, oblique

font-variant:
yes
normal
small-caps

font-weight:
yes
normal
Lighter, bold, bolder, 100, 200, 300, 400, 500, 600, 700, 800, 900

text-decoration:
yes
none
underline, […]

Common CSS properties and values

The next list includes only those CSS properties and values that work in all the major browsers.

Commom

Inherited

Applies to all elements and box models

default value

possible values

display:

inline
none, block, inline-block, list-itme, table-cell, table, table-row

visibility:
yes
visible
hidden

background-color:

transparent
COLOR

background-image:

none
url(“file.jpg”)

background-attachment:

scroll
fixed

background-position:

0% 0%
H% V%, H V, left top, left […]

Typical font-size values at 96 dpi

[…]

Ratios between units of measure at 96 dpi

Value
Pixel
Point
Pica
Inch
Millimeter

1 pixel
=1 px
=0.75pt(3/4)
=0.063pc(1/16)
=0.0104in(1/96)
=0.265mm

1 point
=1.333px(4/3)
=1pt
=0.083pc(1/12)
=0.0138in(1/72)
=0.353mm

1 pica
=16px
=12pt
=1pc
=0.1667in(1/6)
=4.233mm

1 […]

Recommended ASP.NET Examples