Site navigation below

Your banner ad here

Questions answered

Terms explained

Text ad service

Put your text ad here Down arrow icon

WestNIC provides reliable web hosting services

Free software downloads and drivers download resources

25% off cpanel web hosting and reseller hosting deals. Promo: codestyle25off

This document is a glossary of terms used in relation to CSS and is part of the CSS style guide section of Code Style. If you cannot find the term you are seeking defined here, please use the article feedback form below to request a definition.

class selector

A syntax for specifying a CSS selector by means of a general purpose, repeatable class attribute of an element. The name of class selectors in style rules is preceded by a full stop or period, ., e.g.:

.Condensed{
  letter-spacing:   0.1em;
}
          
contextual selector

A syntax for specifying a CSS selector by means of the context in which an element or attribute occurs in the markup structure of a document. In CSS level 1, the syntax takes the form of the element names in a space separated sequence. For instance, contextual selectors may refer to a strong element within a dt element, or a p element with the class attribute "Classic" enclosing an abbr element:

DT STRONG{
  font-weight:      bold;
  letter-spacing:   0.2em;
}
P.Classic ABBR{
  font-style:       italic;
}
          
declaration

A corresponding pair of property and value parameters which suggests a CSS style for a given selector. Numerous declarations can be made in the same style rule, with a trailing semicolon after each, enclosed by a pair of curly braces. In the following example color: red is a single declaration, background: white; is a second:

EM{
  color:            red;
  background:       white;
}
          

Note that a trailing semicolon is not strictly required after the last declaration, but using them always may help avoid syntax errors when editing stylesheets.

element

An HTML or markup element to which a CSS declaration might be associated. A named element is the simplest form of CSS selector.

grouped selector

A convenient means of specifying a range of selectors in a comma separated list to which the same style declaration applies, e.g.:

H1, H2, H3{
  font-family:      serif;
  font-weight:      bold;
}
        
id selector

A syntax for specifying a CSS selector by means of a unique id attribute of an element. The name of id selectors in style rules is preceded by a hash or pound symbol, #, e.g.:

#Subtitle{
  letter-spacing:   0.1em;
}
          
media, media dependent, media descriptor, @media, at-media, print media, projection media

See CSS2 media stylesheet glossary.

property

A named style attribute or parameter for a markup element specified in a stylesheet declaration, e.g. color, background, font-family, margin etc., which is assigned a specific value. Properties are always followed by a colon to separate them from their value pair.

psuedo class, or psuedo class selector

A syntax for selecting markup elements which have subsidiary or context-sensitive attributes in the context of document navigation or positioning, including hyperlinks. The state of these "false" classes in a elements in particular may help indicate that a hyperlinked document has been visited, but this condition is not specified by an explicit class or id attribute of the element, e.g.:

A:visited{
  color:            purple;
  background:       white;
}
          

Other pseudo class selectors include first-letter and first-line, which are determined by the position of text in p elements for instance.

P:first-letter{
  font-size:        larger;
}
          
rule, or style rule

The complete specification of an individual style including the selector, property and value. The term rule applies whatever form the selector takes and however many declaration pairs are present.

selector, or simple selector

A logical "handle" or identifier by which style declarations are associated with specific elements of a document. Selectors may apply broadly to a named HTML element, such as <h3> or <p>, an HTML element with a named attribute value, particularly a class or id value. A simple selector is one which matches an element name only.

See also: grouped selector and contextual selector.

Shorthand properties

Shorthand property names have the effect of combining several associated properties in a single declaration. The shorthand property name replaces all the individual property names and the values are given in a comma separated list. For instance, the shorthand property font can be used to specify styles for font-style, font-variant, font-size, line-height and family in a single declaration. The border property can be used to set border-width, border-style, color. In this case, the styles are set on all four sides of the relevant box.

.MenuBox {
  font-family:   arial,
                 helvetica,
                 sans-serif;
  font-size:     smaller;
  border-width:  1px;
  border-style:  solid;
  border-color:  #CCC;
}

.MenuBox {
  font:          smaller,
                 arial,
                 helvetica,
                 sans-serif;
  border:        solid 1px #CCC;
}
          

Where shorthand property values are omitted, the default values for the relevant properties are used to keep the declaration syntax concise. For example, the background property is often used as if it only set the background colour of a selector but it is actually a shorthand selector for background-color, background-image, background-repeat, background-attachment and background-position.

style sheet, or stylesheet

A collection of one or more style rules, specified in an HTML style element or external CSS file attached by an HTML link element. CSS stylesheets have the content type text/css, typically have the file extension .css and may specify one or more media types to which the styles should be applied:

<link
  rel="stylesheet"
  type="text/css"
  href="Stylesheet.css"
  media="screen">
<style
  type="text/css"
  media="print">
  H1, H2, H3{
    font-family:    sans-serif;
  }
</style>
        
user agent

A software application which is used to view a document to which styles have been applied. Typically, this would be a Web browser which visually displays HTML, but CSS can be applied to content for a range of media devices which have media specific style properties.

See also CSS2 media stylesheet glossary.

value

A length, quality, type or URL assigned to a style property for an element. CSS properties each have specific ranges of value or token types which may be declared for them. For instance, color properties have values specified by named color tokens (silver, purple, maroon), or RGB colour components in the decimal range 0 to 255 or hexadecimal equivalent. Other style properties take length values, URL values or other tokens such as float, repeat-y and both, which define how an element is rendered in a specific user agent.

Article feedback

Your comments on this article will be appreciated, please use the form below to submit your views. If you would like a reply or article update notification, include your email address.

Information: Your email address will not be mis-used. If you include your address you may be sent a personal reply, you will not be added to any mailing list unless you request update notification. Read the site privacy statement for details.

Add this page to your chosen social bookmarking service

Style warning - please read

Home · CSS · Java · Javascript · HTML · Help · Log