Abs
Abs

Reputation: 57996

Are there any CSS properties that can not be inlined?

When I say inline, I mean placing CSS properties within the style attribute.

Is there a way to determine with Javascript if a particular property can not be inlined or not?

Upvotes: 3

Views: 147

Answers (3)

Adriano Repetti
Adriano Repetti

Reputation: 67148

You can inline every style you can define in a normal STYLE element or in an external style sheet (see section 14.2.2 of HTML specifications).

You can't use, as pointed by Gaby, any selector. They say:

For example, for [[CSS2]] inline style, use the declaration block syntax described in section 4.1.8 (without curly brace delimiters).

The section 4.1.8 describes declarations and properties, not rules and selectors so the content of the STYLE attribute is limmited to properties only.

Upvotes: 1

Widor
Widor

Reputation: 13285

I can't think of any (standard) CSS that can't be written inline, but you couldn't declare a class or pseudoclass inline for instance.

Inline is a valid place to define CSS, so any CSS will work there else the precedence of CSS (C=cascading) would be broken.

Upvotes: 0

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196306

Css properties can all be used,

but you cannot use pseudoclasses and pseudoelements like :hover, :after :nth-child() etc.

Upvotes: 6

Related Questions