Sachindra
Sachindra

Reputation: 6989

How to find the css version?

How do I find the version of CSS that I am using?

Upvotes: 22

Views: 41111

Answers (5)

Brent Wilson
Brent Wilson

Reputation: 213

As far as I know, there's nothing in CSS code that specifies the version. Browsers are designed to interpret one or more versions of CSS at runtime. Therefore, I would imagine that you would need to get the version of the browser via javascript and then determine what version of CSS is understood by the browser.

Upvotes: 0

Spudley
Spudley

Reputation: 168695

Although the CSS specification is defined in several versions (v2, 2.1, 3), the CSS version isn't really relevant to the developer; you need to be more concerned with which web browsers support a given feature.

It is useful to know that a given feature was defined in CSS2, 2.1 or 3 because that can give you an idea of how old the feature is, and therefore how likely it is that browsers will support it -- for example border-radius is a CSS3 feature, so browsers more than a couple of years old may not support it fully.

You can find out what CSS features are supported in which browsers from the following sites:

Upvotes: 21

Jorge
Jorge

Reputation: 1186

Just an addition of what @Craig said.

In my .net 2.0 framework I have a property to show scroll bars. As I want just the vertical, I've added both properties and, if the browser that user is using support this new CSS 3.0 property (overflow-x), he will see just the vertical one.

enter image description here

Upvotes: 2

Knu
Knu

Reputation: 15134

In my opinion you should use object detection instead - check the MDC to understand the principle.
On Internet Explorer you might find compatMode and documentMode useful.

Upvotes: 0

Craig
Craig

Reputation: 1287

The version is only defined by the CSS selectors, propreties and attributes that you use.

You are free to mix elements of CSS 1, 2 and 3 in any styles that you write.

You can refer to the CSS specifications to see more details. The specifications and drafts at the W3C is available via this index: http://www.w3schools.com/w3c/w3c_css.asp

Upvotes: 4

Related Questions