De Vrijes website Menu sluitenMenu openenNaar top gaan

Menu opties

CSS - Elementen

Inhoud



CSS box model

Element
Padding
Border
Margin


CSS elementen

/*xxxxxxx*/(voor een commentaar)
…[−zzzzzzz][−…](waarbij zzzzzzz = bottom | left | right | top )
animation:[animation−delay] [animation−direction] [animation−duration] [animation−fill−mode] [animation−iteration−count] [animation−name] [animation−play−state] [animation−timing−function];
animation−delay:inherit | initial | tdx;
animation−direction:alternate | alternate-reverse | inherit | initial | normal | reverse;
animation−duration:tdx;
animation−fill−mode:backwards | both | forwards | inherit | initial | none;
animation−iteration−count:xxxxxxx | infinite | inherit | initial;
(waarbij xxxxxxx = een geheel getal)
animation−name:xxxxxxx;
animation−play−state:inherit | initial | paused | running;
animation−timing−function:tdx;
background:[[background−attachment] [background−color] [background−image] [background−position] [background−repeat] | inherit | linear−gradient(xxxxxxx) | radial−gradient(xxxxxxx) | repeat−linear−gradient(xxxxxxx) | repeating−radial−gradient(xxxxxxx);
(waarbij:
  • xxxxxxx = [yyyyyyy,]klf [nnn%],klf [nnn%] [,klf [nnn%][,…]]
  • yyyyyyy (voor linear) = richting: nnndeg | to zzzzzzz [zzzzzzz] (standaard: to bottom)
    yyyyyyy (voor radial) = vanuit het centrum: circle | ellipse | zzzzzzz at nnn% nnn% (standaard: ellipse)
  • zzzzzzz (voor linear) = bottom | left | right | top
    zzzzzzz (voor radial) = closest−corner | closest−side | ellipse | farthest−corner | farthest−side
)
background−attachment:fixed | inherit | scroll;
background−color:inherit | klf;
background−image:inherit | none | url(urh);
background−position:[[left | center | right | lgt] [top | center | zzzzzzz | lgt]] | inherit;
background−repeat:inherit | no−repeat | repeat | repeat−x | repeat−y;
background−size:auto | contain | cover | inherit | initial | length | percentage; (standaard: auto)
border:[border−color] [border−style] [border−width];
border−collapse:(alleen voor het HTML element table)
collapse | inherit | separate;
border[−zzzzzzz]−color:klf | inherit;
border-image:[border−image−outset] [border−image−repeat] [border−image−slice] [border−image−source] [border−image−width] | inherit | initial;
border−image−outset:xxxxxxx [xxxxxxx [xxxxxxx [xxxxxxx]]] | lgt [lgt [lgt [lgt]]]] | inherit | inital;
(waarbij xxxxxxx = aantal keren van het element border−image−width; standaard: 0)
border−image−repeat:inherit | inital | repeat | round | space | stretch; (standaard: stretch)
border−image−slice:xxxxxxx [xxxxxxx] | yyyyyyy% [yyyyyyy%] | fill | inherit | inital;
(waarbij xxxxxxx = aantal pixels en yyyyyyy = aantal percentage van de hoogte en breedte; standaard: 100%)
border−image−source:url | inherit | inital | none;
border−image−width:lgt | auto | inherit | inital; (standaard: 1)
border[−xxxxxxx][−yyyyyyy]−radius:lgt | inherit | inital
(waarbij xxxxxxx = bottom of top en yyyyyyy = left of right);
border−spacing:(alleen voor het HTML element table)
inherit | lgt (voor de horizontale ruimte) [lgt] (voor de verticale ruimte);
border[−zzzzzzz]−style:dashed | dotted | double | hidden | inset | groove | none | outset | ridge | solid;
border[−zzzzzzz]−width:inherit | medium | thick | thin | lgt;
bottom:auto | inherit | lgt;
box−shadow:xxxxxxx[, xxxxxxx[, …]];
(waarbij xxxxxxx = lgt (voor de X-coördinaat) lgt (voor de Y-coördinaat) [lgt (voor de vervagingswaarde) [lgt (voor de verspreidingswaarde)]] [klf (voor de kleurwaarde)] [inset])
box−sizing:border−box | content−box | inherit | initial;
Opmerking:
  • border−box = breedte en hoogte zijn berekend van de box, d.i. de inhoud plus border en padding, maar zonder margin
  • content−box = breedte en hoogte zijn berekend van de inhoud, d.i. zonder border, padding en margin
caption−side:(alleen voor het HTML element table)
bottom | inherit | top;
clear:both | inherit | left | none | right;
clip:auto | inherit | rect(lgt (vanaf de top) lgt (vanaf de linkerkant) lgt (voor de top) lgt (vanaf de linkerkant));
color:klf;
column−count:xxxxxxx;
column−gap:lgt;
column−rule:[column−rule−color] [column−rule−style] [column−rule−width];
column−rule−color:klf;
column−rule−style:dashed | dotted | double | hidden | inset | groove | none | outset | ridge | solid;
column−rule−width:lgt;
column−width:normal | lgt;
columns:[column−count] [column−width];
content:attr(xxxxxxx) | close−quote | counter(xxxxxxx,xxxxxxx)| inherit | no−close−quote | no−open−quote | none | normal | open−quote | "xxxxxxx" | urh;
counter−increment:inherit | none | "xxxxxxx";
counter−reset:inherit | none | "xxxxxxx";
cursor:[auto | crosshair | default | e−resize | help | move | ne−resize | n−resize | nw−resize | pointer | progress | s−resize | se−resize | sw−resize | text | w−resize | wait | urh] | inherit;
direction:inherit | ltr | rtl;
display:block | flex | inherit | inline | inline−block | inline−table | list−item | none | table | table−caption | table−cell | table−column | table−column−group | table−footer−group | table−header−group | table−row |+ table−row−group;
empty−cells:(alleen voor het HTML element table)
hide | inherit | show;
flex:(alleen bij het CSS element display: flex)
xxxxxxx | auto | initial | inherit | none;
(waarbij xxxxxxx = flex−grow flex−shrink flex−basis)
flex−basis:(alleen bij het CSS element display: flex)
lgt | auto | initial | inherit;
flex−direction:(alleen bij het CSS element display: flex)
column | column-reverse | initial | inherit | row | row-reverse; (standaard: row)
flex−flow:(alleen bij het CSS element display: flex)
xxxxxxx | initial | inherit;
(waarbij xxxxxxx = flex−direction flex−wrap)
flex−grow:(alleen bij het CSS element display: flex)
xxxxxxx | initial | inherit;
(waarbij xxxxxxx = verhoudingsgetal; standaard: 0)
flex−shrink:(alleen bij het CSS element display: flex)
xxxxxxx | initial | inherit;
(waarbij xxxxxxx = verhoudingsgetal indien er een ruimte voor is; standaard: 1)
flex−wrap:(alleen bij het CSS element display: flex)
initial | inherit | nowrap | wrap | wrap-reverse; (standaard: nowrap)
float:inherit | left | none | right;
font:[font−family] [font−size] [font−style] [font−variant] [font−weight] | caption | icon | inherit | menu | message−box | small−caption | status−bar;
font−family:[Arial, "Arial Black", "Bitstream Vera Sans", …] | inherit;
font−size:inherit | large | larger | medium | small | smaller | x−large | x−small | xx−large | xx−small | lgt;
font−style:inherit | italic | normal | oblique;
font−variant:inherit | normal | small−caps;
font−weight:100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | bold | bolder | inherit | lighter | normal;
height:auto | inherit | lgt;
left:auto | inherit | lgt;
letter−spacing:inherit | normal | lgt;
line−height:inherit | normal | lgt;
list−style:[list−style−image] [list−style−position] [list−style−type] | inherit;
list−style−image:inherit | none | urh;
list−style−position:inherit | inside | outside;
list−style−type:armenian | circle | decimal | decimal−leading−zero | disc | georgian | inherit | lower−alpha | lower−greek | lower−latin | lower−roman | none | square | upper−alpha | upper−latin | upper−roman;
margin[−zzzzzzz]:auto | inherit | lgt [lgt [lgt [lgt]]];
max−height:inherit | none | lgt;
max−width:inherit | none | lgt;
min−height:inherit | lgt;
min−width:inherit | lgt;
order:(alleen bij het CSS element display: flex)
xxxxxxx | inherit | initial;
(waarbij xxxxxxx = een volgnummer)
opacity:inherit | xxxxxxx;
(waarbij xxxxxxx = een getal tussen 0 en 1)
orphans:inherit | xxxxxxx;
(waarbij xxxxxxx = een geheel getal)
outline:[outline−color] [outline−style] [outline−width] | inherit;
outline−color:inherit | invert | klf;
outline−style:border−style | inherit;
outline−width:border−width | inherit;
overflow:auto | hidden | inherit | scroll | visible;
padding[-zzzzzzz]:inherit | lgt;
page−break−after:always | auto | avoid | inherit | left | right;
page−break−before:always | auto | avoid | inherit | left | right;
page−break−inside:auto | avoid | inherit;
position:absolute | fixed | inherit | relative | static;
quotes:"xxxxxxx" "xxxxxxx" ["xxxxxxx" "xxxxxxx"] ["…" "…"]| inherit | none;
(waar het tweede paar voor de volgende level bestemd is, enzovoort)
right:auto | inherit | lgt;
table−layout:(alleen voor het HTML element table)
auto | fixed | inherit;
text−align:center | inherit | left | justify | right;
text−decoration:blink | inherit | line−through | none | overline | underline;
text−indent:inherit | lgt;
text−overflow:clip | ellipsis | inherit | initial;
text−shadow:xxxxxxx[, xxxxxxx[, …]];
(waarbij xxxxxxx = lgt (voor de X-coördinaat) lgt (voor de Y-coördinaat) [lgt (voor de vervagingswaarde)] [klf (voor de kleurwaarde)])
text−transform:captialize | inherit | lowercase | none | uppercase;
top:inherit | auto | lgt;
transform:inherit | initial | matrix(n,n,n,n,n,n) | matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n) | none | perspective(n) | rotate(hkx) | rotate3d(x,y,z,hkx) | rotateX(hkx) | rotateY(hkx) | rotateZ(hkx) | scale(x,y) | scale3d(x,y,z) | scaleX(x) | scaleY(y) | scaleZ(z) | skew(x-hkx, y-hkx) | skewX(hkx) | skewY(hkx) | translate(x,y) | translate3d(x,y,z) | +translateX(x) | translateY(y) | translateZ(z);
transform−origin:xxxxxxx yyyyyyy zzzzzzz | initial | inherit;
(waarbij:
  • xxxxxxx = center | left | right | lgt voor de x-as (standaard: 50%)
  • yyyyyyy = bottom | center | top | lgt voor de y-as (standaard: 50%)
  • zzzzzzz = lgt voor de z-as (alleen bij 3D-transformaties; standaard: 0)
)
transition:[transition−delay] [transition−duration] [transition−property] [transition−time−function];
transition−delay:tdx;
transition−duration:tdx;
transition−property:all | xxxxxxx[, xxxxxxx[,…]];
(waarbij xxxxxxx = CSS element)
transition−time−function:cubic−bezier(xxxxxxx,xxxxxxx,xxxxxxx,xxxxxxx) | ease | ease−in | ease−out | ease−in−out | lineair; (standaard: lineair)
unicode_bidi:bidi−override | embed | inherit | normal;
vertical−align:baseline | bottom | inherit | middle | percentage | sub | super | text−bottom | text−top | top | lgt;
visibility:collapse | hidden | inherit | visible; (standaard: visible)
white−space:inherit | initial | normal | nowrap | pre | pre−line | pre−wrap;
widows:inherit | xxxxxxx;
(waarbij xxxxxxx = een geheel getal)
width:auto | inherit | lgt;
word−spacing:inherit | normal | lgt;
z−index:auto | inherit | xxxxxxx;
(waarbij xxxxxxx = een positief niveau getal)


CSS pseudo−klassen

:active
:checked
:content
:default
:disabled
:empty
:enabled
:first−child
:first−of−type
:focus
:hover
:in−range
:invalid
:lang(xxxxxxx) 1)
:last−child
:last−of−type
:link
:not(xxxxxxx) 2)
:nth−child(xxxxxxx) 3)
:nth−last−child(xxxxxxx) 3)
:nth−last−of−type(xxxxxxx) 3)
:nth−of−type(xxxxxxx) 3)
:only−child
:only−of−type
:optional
:out−of−range
:read−only
:read−write
:required
:root
:target
:valid
:visited

1) waarbij xxxxxxx = taalcode
2) waarbij xxxxxxx = CSS selector
3) waarbij xxxxxxx = een geheel getal, een expressie 'an+b', 'even' of 'odd'



CSS pseudo−elementen

::after
::before
::first−letter
::first−line
::selection



CSS regel-elementen

@charset"xxxxxxx"
(waarbij xxxxxxx = charset code)
@font−face{
font-family: "xxxxxxx" (waarbij xxxxxxx = nieuwe naam)
font-size: all;
font-style: italic | normal | oblique;
font-weight: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | bold | bolder | lighter | normal;
src: [local("urh"), local(…), …,] url("urh") [format(xxxxxxx), url(…) format(…), …;
(waarbij xxxxxxx = formattype:
  • embedded-opentype (voor eot-bestanden en voor IE)
  • opentype (voor otf- en ttf-bestanden)
  • svg (voor svg- en svgz-bestanden)
  • truetype (voor tff-bestanden)
  • woff (voor woff-bestanden)
)
@importurl(urh) mdc [AND mdw] { … }
@keyframesxxxxxxx {yyyyyyy}
(waarbij:
  • xxxxxxx = animatienaam
  • yyyyyyy kan een van de volgende zijn:
    • from {zzzzzzz} to {zzzzzzz}
    • 0% {zzzzzzz} nn% {zzzzzzz} … 100% {zzzzzzz}
  • zzzzzzz = een of meer CSS elementen
)
@mediamdc [AND mdw] { … }
@supports(xxxxxxx [and xxxxxxx [and …]])
{yyyyyyy [yyyyyyy […]]}}
(waarbij:
  • xxxxxxx = een CSS element [: attribuut]
  • yyyyyyy = een CSS selector
)


CSS selectors

Basisselectors

Combinatie van elementen in een selectorgroep worden aaneengesloten:
[HTML-element][#id−naam][.class−naam1][.class−naam2][…] [.pseudo−class−naam1][.pseudo−class−naam2][…] {…}

Relationele selectors:



Voorrangslijst van CSS verschillende opmaakfuncties

  1. style
  2. :pseudo-klasse
  3. #identifier
  4. .class
  5. selector


Verwijzingsnamen

hkxHoekeenheden:
xxxxxxx[deg (in graden) | grad (in grads) | rad (in radialen) | turn (in slagen)]
Opmerking:
  • één grad = één decimale graad, d.i. 1/400ste van een cirkel
  • 90 graden = 100 grads = 1,571 radiaal
klfKleurformaat:
#yyy | #yyyyyy | currentColor | hsl(xxx,xxx,xxx) | hsla(xxx,xxx,xxx, zzz) |kln | rgb(xxx,xxx,xxx) | rgba(xxx,xxx,xxx, zzz) | transparent
(waarbij:
  • xxx = een geheel getal tussen 0 en 255 of een percentage tussen 0% en 100%
  • y = een hexadecimaal getal
  • zzz = een doorzichtigheid getal tussen 0.0 en 1.0
)
klnKleurnaam:
aqua | back | blue | fuchsia | gray | green | lime | maroon | navy | olive | purple | red | silver | teal | white | yellow
lgtLengteformaat:
xxxxxxx[% | em | px | rem]
Opmerking:
  • Liever geen absolute lengte codes gebruiken: cm | in | mm | pc | pt
  • 1pc = 1/12 pt
  • 1pt = 1/72 inch
mdcMediacodes:
all | braille | embossed | handheld | print | projection | screen | screen | speech | tty | tv
(waarbij twee of meer media codes door een komma gescheiden moeten worden)
mdwMediawaarden:
[[[max | min]-][device-]aspect-ratio: xxxxxxx] |
[[[max | min]-][device-]height: xxxxxxx |
[(orientation: landscape | portrait)] |
[[[max | min]-][device-]width: xxxxxxx
(waarbij drie verschillende operators gebruikt mogen worden: AND | NOT | , (= of))
tdxTijdseenheden:
xxxxxxx[ms | s]
urhURI in de formaat 'http://ttttttt[[[hhhhhhh/]ppppppp/][bbbbbbb][#mmmmmmm]'
(waarbij:
  • bbbbbbb = bestandnaam 'xxxxxxx.zzz'
  • ddddddd = domein naam '[[xxxxxxx/]yyyyyyy/]…'
  • hhhhhhh = hostnaam '[sssssss]ddddddd'
  • mmmmmmm = markeringsnaam
  • ppppppp = padnaam '[[xxxxxxx.]yyyyyyy.]…'
  • sssssss = server naam '[[xxxxxxx.]yyyyyyy.]…'
)