CSS Reference ยท Units and Values
Common value keywords: auto, none and normal
Understand the common CSS value keywords auto, none and normal: what each one means, which properties accept them and how they differ from initial.
Many CSS properties accept a keyword instead of a number. Three keywords appear again and again: auto, none and normal. They look similar, but each one expresses a different idea, and they are not interchangeable: a property accepts only the keywords that make sense for it.
This is a concept page. The meaning of each keyword depends on the property, so the rule of thumb below is a guide, not a guarantee. Always check the property's own page.
.box { width: auto; /* let the browser compute it */ border: none; /* no border at all */ letter-spacing: normal; /* the font's default */ }
Try it
What each keyword means
auto
auto hands the decision to the browser. The value is computed from context: width: auto on a block fills its container, margin-left: auto absorbs free space, z-index: auto does not create a stacking level, height: auto follows the content, overflow: auto shows scrollbars only when needed, and grid-template-columns can use auto tracks sized by content.
none
none means nothing: the feature is switched off. display: none removes the element from layout, border-style: none draws no border, transform: none applies no transform, background-image: none shows no image, and list-style-type: none removes markers. It is a real value, not an absence of one.
normal
normal means the default behavior, with no extra adjustment. line-height: normal lets the font decide, letter-spacing: normal adds nothing, font-style: normal is upright, white-space: normal collapses whitespace and wraps lines, and align-items: normal behaves like stretch or start depending on context.
Usage notes
noneis not0.border: noneandborder-width: 0look alike but differ:nonesets the style, while a zero width keeps a style that could be revived by changing the width.autois not a number. You cannot animate smoothly to or fromautoin most properties, which is why height transitions need other techniques.- They differ from
initial. The initial value of a property is oftenauto,noneornormal, but the keywords themselves are ordinary values that you can set after another rule changed the property. See global values. - Typos fail silently. A property that does not accept the keyword drops the whole declaration.
margin: normalis invalid. - Accessibility.
display: nonealso hides content from assistive technology, whereasvisibility: hiddenand offscreen positioning behave differently.
Browser support
These keywords are supported everywhere; which properties accept them is described on each property page.
Related
displayโ acceptsnonewidthโ acceptsautoline-heightโ acceptsnormal- Lesson: Global Values: initial, inherit, unset, revert