Keywords(Auto, Multiple & String)

It is specifies a value and is named like red , green, blue, etc. for colors. They are also called as CSS keywords. Keywords are used on any property that accepts a named value. Similarly text formatting keywords like bold, left, etc. are used .
   .list1 {
margin: 10px 10px;
padding: 20px 20px;
border: 1px solid red;
}
Auto Keyword
A single keyword can also apply different styles on the element on which it is used like the auto keyword which applies default style or behavior.
All elements with a width property have an auto value by default, but not all elements behave the
same way when auto width is applied. The <table> element, for instance, only expands horizontally
to accommodate its data, which is a method called shrink-to-fit. A <div> element, on the other hand, expands horizontally as far as there is space, which is called expand-to-fit.
Multiple Keyword
Multiple keywords can also be given to a property depending whether the property is capable to be assigned multiple values like the CSS border property may take three separate keywords which specifies how it appears when the browser draws it as
        border: thin solid black;
The border property in the example is assigned three keyword values: thin , solid , and black. Each value refer to a different characteristic of the border’s appearance as thin refers to its measurement, solid to its style, and black to its color.
String Keywords
A string is any sequence of characters usually enclosed either in single or double quotation marks. Strings may contain text, numbers, and symbols.
String keyword in CSS are used to include content from a style sheet, or specify a file path, or include a font name having spaces in its name, or referring an HTML element’s attribute value like
       font-family: ‘Times New Roman’, Times, serif;
Font faces with spaces in the name are enclosed with quotations to keep the program that interprets CSS from getting confused. The quotes act as marking posts for where the font face’s name begins and ends.
In the given CSS rule the CSS font-family property is set to Times New Roman if that font is installed browser falls to Times if it is not, and finally to the browser’s default serif font.

Get industry recognized certification – Contact us

Menu