MyInternships.in

CSS References

CSS Default Values

Every CSS property has an initial (default) value that applies when you do not set it and it is not inherited. Browsers also apply their own user-agent stylesheet on top, which is why an <h1> looks big and bold before you touch it. This reference lists the CSS-defined initial values of common properties, plus which properties inherit.


Initial values of common properties

PropertyInitial value
displayinline
positionstatic
floatnone
widthauto
heightauto
margin0
padding0
border-widthmedium
border-stylenone
box-sizingcontent-box
colorcanvastext (usually black)
background-colortransparent
background-imagenone
font-sizemedium (~16px)
font-weightnormal (400)
font-stylenormal
font-familydepends on browser
line-heightnormal
text-alignstart
text-decorationnone
letter-spacingnormal
white-spacenormal
visibilityvisible
opacity1
overflowvisible
z-indexauto
top / right / bottom / leftauto
flex-directionrow
flex-wrapnowrap
justify-contentnormal
align-itemsnormal
gapnormal (0)
list-style-typedisc
cursorauto
transitionall 0s ease 0s
transformnone
ℹ️

The user-agent stylesheet often overrides these. For example the CSS initial value of display is inline, but the browser sets display: block on <div> and <p> via its own stylesheet.

Inherited vs non-inherited properties

Some properties are inherited by default — a child uses its parent's value unless overridden. Most inherited properties relate to text; layout properties are not inherited.

Inherited (text-ish)Not inherited (layout/box)
colormargin / padding
font-family, font-size, font-weightwidth / height
line-height, letter-spacingborder
text-align, text-indentbackground
visibilitydisplay
list-styleposition, float
cursorbox-shadow

Resetting to defaults

You can force a property back to a defined state with the global keywords initial, inherit, unset, revert and all.

KeywordEffect
initialSets the property to its CSS-defined initial value.
inheritTakes the computed value from the parent.
unsetinherit if the property is inherited, else initial.
revertRolls back to the user-agent (browser) stylesheet value.
all: unsetResets every property on the element at once.
💡

all: revert on a component wrapper is a quick way to strip inherited styles and start from the browser defaults.

Related CSS Topics

Keep learning with these closely related tutorials.

Ready to use your CSS skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships