HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

attr

Description

The attr function for CSS substitutes the value of an attribute on an element into a property.

Syntax

CSS

attr()

Values

<attr()> =
    attr(
        <q-name>
        <attr-type>? ,
        <declaration-value>?
    )
<q-name>

The name of the attribute being referenced.

<attr-type> =
    string |
    url |
    ident |
    color |
    number |
    percentage |
    length |
    angle |
    time |
    frequency |
    flex |
    <dimension-unit>
string

A string value.

url

A URL value.

ident

A custom identifier value.

color

A color value.

number

A number value.

percentage

A percentage value.

length

A length value.

angle

An angle value.

time

A time value.

frequency

A frequency value.

flex

A flex value.

<dimension-unit>

A literal "%" character or an ident whose value is any of the CSS units for <length>, <angle>, <time>, <frequency>, or <flex> values (such as px or ms).

<declaration-value>

Any sequence of one or more tokens, so long as the sequence does not contain <bad-string-token>, <bad-url-token>, unmatched <)-token>, <]-token>, or <}-token>, or top-level <semicolon-token> tokens or <delim-token> tokens with a value of "!". It represents the entirety of what a valid declaration can have as its value.

Examples

1 · q-name

2 · JS