Jason Suárez
Jason Suárez

Reputation: 2545

CSS terminology: what's this called in a property value?

In a css property, there are certain value declarations that look like functions, eg

background: rgba(0,0,0,0);

or

background-image: url('bg.png');

The first part is called the property, eg background and background-image. The second part in general is called the value. But what is the part outside of the parentheses called, eg rgba(...) and url(...).

Thanks!

Upvotes: 0

Views: 84

Answers (2)

Ry-
Ry-

Reputation: 224857

Generically, they're just called "<whatever> notations"; see this part of the spec for example:

The image() function allows an author to:

  • use media fragments to clip out a portion of an image
  • specify fallback images in case the preferred image can't be decoded or is a type that > the browser doesn't recognize
  • use a solid color as an image
  • annotate an image with a directionality

The image() notation is defined as:

<image-list> = image( [ <image-decl> , ]* [ <image-decl> | <color> ] )
<image-decl> = [ <url> | <string> | <element-reference> ]

Each <string> or <url> inside image() represents an image, just as if the url() notation had been used. As usual for URLs in CSS, relative URLs are resolved to an absolute URL (as described in Values & Units [CSS3VAL]) when a specified image() value is computed.

So url('bg.png') is the url() notation. However, you can get more specific. Values that represent images, such as:

  • linear-gradient(red, white)
  • url('../images/hello.png')
  • radial-gradient(orange, yellow)
  • cross-fade(image1, image2)

Are called image values. This applies to things like rect(), too, which is a shape value1. As for calc(), that's just generally called an expression, I believe.

1 Note that in the sidebar, rect() is also referred to as a function.

Upvotes: 3

DA.
DA.

Reputation: 40673

It's not called anything in particular. It's all just part of the value.

Upvotes: 0

Related Questions