<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.knodel.net/oops/index.php?action=history&amp;feed=atom&amp;title=CSS_hack</id>
		<title>CSS hack - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.knodel.net/oops/index.php?action=history&amp;feed=atom&amp;title=CSS_hack"/>
		<link rel="alternate" type="text/html" href="http://www.knodel.net/oops/index.php?title=CSS_hack&amp;action=history"/>
		<updated>2026-05-08T09:22:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>http://www.knodel.net/oops/index.php?title=CSS_hack&amp;diff=314&amp;oldid=prev</id>
		<title>Eogen: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://www.knodel.net/oops/index.php?title=CSS_hack&amp;diff=314&amp;oldid=prev"/>
				<updated>2018-09-19T08:19:00Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&#039;diff diff-contentalign-left&#039;&gt;
				&lt;tr style=&#039;vertical-align: top;&#039; lang=&#039;en&#039;&gt;
				&lt;td colspan=&#039;1&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&#039;1&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 08:19, 19 September 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&#039;2&#039; style=&#039;text-align: center;&#039; lang=&#039;en&#039;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Eogen</name></author>	</entry>

	<entry>
		<id>http://www.knodel.net/oops/index.php?title=CSS_hack&amp;diff=313&amp;oldid=prev</id>
		<title>Josvebot: Fixing WP:CHECKWIKI #16: unicode contol character (and other minor general edits caused by AWB), replaced: →</title>
		<link rel="alternate" type="text/html" href="http://www.knodel.net/oops/index.php?title=CSS_hack&amp;diff=313&amp;oldid=prev"/>
				<updated>2018-07-27T05:41:54Z</updated>
		
		<summary type="html">&lt;p&gt;Fixing &lt;a href=&quot;/oops/index.php?title=WP:CHECKWIKI&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:CHECKWIKI (page does not exist)&quot;&gt;WP:CHECKWIKI&lt;/a&gt; #16: unicode contol character (and other minor general edits caused by AWB), replaced: →&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{hatnote|This article is about a CSS technique. Not to be confused with the proprietary Microsoft-specific CSS property.}}&lt;br /&gt;
A &amp;#039;&amp;#039;&amp;#039;CSS hack&amp;#039;&amp;#039;&amp;#039; is a [[Computer programming|coding]] technique used to hide or show [[Cascading Style Sheets|CSS]] [[Markup language|markup]] depending on the [[Web browser|browser]], version number, or capabilities. Browsers have different interpretations of CSS behavior and different levels of support for the [[W3C]] [[World Wide Web Consortium#Standards|standards]]. CSS hacks are sometimes used to achieve consistent layout appearance in multiple browsers that do not have compatible rendering. Most of these hacks do not work in modern versions of the browsers, and other techniques, such as feature support detection, have become more prevalent.&lt;br /&gt;
&lt;br /&gt;
== Types of hacks ==&lt;br /&gt;
&lt;br /&gt;
=== Invalid or non-compliant CSS ===&lt;br /&gt;
Due to quirks in the interpretation of CSS by various browsers, most CSS hacks involve writing invalid CSS rules that are interpreted only by specific browsers, or relying on bugs in specific browsers. An example of this is prefixing rules with an underscore (as in &amp;lt;code&amp;gt;_width&amp;lt;/code&amp;gt;) to target Internet Explorer 6—other browsers will ignore the line, allowing it to be used to write code specific to one browser.&lt;br /&gt;
&lt;br /&gt;
=== Conditional comments ===&lt;br /&gt;
{{Main|Conditional comment}}&lt;br /&gt;
Prior to version 10, [[Internet Explorer]] supported a special comment syntax that would allow blocks of HTML to be read only by specific versions of the browser. These comments are mostly used to provide specific CSS and JavaScript workarounds to older versions of the browser. No other browsers interpreted these comments or offered similar functionality.&lt;br /&gt;
&lt;br /&gt;
The following are examples of the different syntax for these comments.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt;&lt;br /&gt;
  &amp;lt;link href=&amp;quot;all_browsers.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;!--[if IE]&amp;gt; &amp;lt;link href=&amp;quot;ie_only.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&lt;br /&gt;
  &amp;lt;!--[if lt IE 7]&amp;gt; &amp;lt;link href=&amp;quot;ie_6_and_below.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt; &amp;lt;![endif]--&amp;gt;&lt;br /&gt;
  &amp;lt;!--[if !lt IE 7]&amp;gt; &amp;lt;![IGNORE[--&amp;gt;&amp;lt;![IGNORE[]]&amp;gt; &amp;lt;link href=&amp;quot;recent.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;&lt;br /&gt;
  &amp;lt;!--[if !IE]--&amp;gt; &amp;lt;link href=&amp;quot;not_ie.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Criticism ==&lt;br /&gt;
Hiding code using hacks often leads to pages being incorrectly displayed when browsers are updated. These hacks can lead to unexpected behavior in newer browsers that may interpret them differently than their predecessors. Since Internet Explorer 6 and 7 have fallen out of use, CSS hacks have declined as well. Modern methods of feature targeting are less fragile and error-prone.&lt;br /&gt;
&lt;br /&gt;
== Alternatives ==&lt;br /&gt;
&lt;br /&gt;
===Browser prefixes===&lt;br /&gt;
Each of the most popular browser rendering engines has its own vendor-specific prefix for experimental properties. However, due to the proliferation of these properties in live code, the browser vendors have begun to move away from this in favor of user-controlled feature flags.&amp;lt;ref&amp;gt;{{Cite web|url=https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix|title=Vendor Prefix|website=Mozilla Developer Network|access-date=2016-10-12}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== List of prefixes ====&lt;br /&gt;
The following is a list of prefixes from various layout engines:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Vendor Prefix !! In Use    !! Layout Engine    !! Created by            !! Used by&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-ah-&amp;lt;/code&amp;gt;          || yes       || Formatter        || Antenna House         || Antenna House Formatter&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-apple-&amp;lt;/code&amp;gt;       || yes       || [[WebKit]]           || [[Apple Inc.]]            || [[Safari (web browser)|Apple Safari 2.0]], Opera Widgets, [[Acid3#Presto and WebKit based browsers|WebKit-Based Browsers (as legacy prefix)]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-atsc-&amp;lt;/code&amp;gt;        ||           ||                  || [[Advanced Television Systems Committee standards]] || &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-epub-&amp;lt;/code&amp;gt;        || yes       || WebKit           || [[EPUB|EPUB Working Group]]    || [[Chromium (web browser)|Chromium]] / [[Google Chrome]], WebKit-Based Browsers&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-fx-&amp;lt;/code&amp;gt;          || yes       ||                  || [[Sun Microsystems]] (now acquired by [[Oracle Corporation]]) || [[JavaFX]] applications&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-hp-&amp;lt;/code&amp;gt;          ||           ||                  || [[Hewlett-Packard]]  (now [[HP Inc.]] and [[Hewlett Packard Enterprise]])     || &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-khtml-&amp;lt;/code&amp;gt;      || yes / yes || [[KHTML]] / WebKit   || [[KDE]]                   || KDE [[Konqueror]] / Apple Safari 1.1 through Safari 2.0, WebKit-Based Browsers (as a legacy prefix)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-moz-&amp;lt;/code&amp;gt;         || yes       || [[Gecko (software)|Gecko]]            || [[Mozilla Foundation]]    || Gecko-Based Browsers[?], Mozilla Firefox&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-ms-&amp;lt;/code&amp;gt;          || yes       || [[Trident (layout engine)|Trident]] / MSHTML || [[Microsoft Corporation]] || [[Internet Explorer|Microsoft Internet Explorer]]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mso-&amp;lt;/code&amp;gt;          ||           || Office           || Microsoft Corporation || Microsoft Office[?]&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-o-&amp;lt;/code&amp;gt;           || yes       || [[Presto (layout engine)|Presto]]           || [[Opera Software]]        || [[Opera (web browser)|Opera desktop Browser up to version 12.16]], [[Opera Mini]], and [[Opera Mobile|Opera Mobile up to version 12.1]], [[Nintendo DS]] &amp;amp; [[Nintendo DSi]] Browser, Nintendo Wii Internet Channel&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;prince-&amp;lt;/code&amp;gt;       || yes       || Prince           || [[YesLogic]]              || YesLogic Prince&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-rim-&amp;lt;/code&amp;gt;         ||           || WebKit        || [[BlackBerry Limited]]    || RIM Blackberry Browser&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-ro-&amp;lt;/code&amp;gt;          || yes       || MARTHA           || Real Objects          || Real Objects PDFreactor&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-tc-&amp;lt;/code&amp;gt;          ||           ||                  || TallComponents        || TallComponents&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-wap-&amp;lt;/code&amp;gt;         || yes       || Presto           || [[Open Mobile Alliance|The WAP Forum]]         || Opera Desktop Browser and Opera Mobile, The WAP Forum&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code class=nowrap&amp;gt;-webkit-&amp;lt;/code&amp;gt;      || yes       || WebKit/Blink || Apple Inc. (WebKit)/Google Inc. (Blink)         || Apple Safari &amp;amp; Safari for iOS (WebKit), Chromium / Google Chrome desktop and mobile (Blink), Opera desktop and mobile from version 14 (Blink), Android browser (Blink), [[Nokia]] MeeGo Browser 8.5, Nokia [[Symbian]] Browser 7.0 and later (WebKit), Blackberry Browser 6.0 and later (WebKit).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;-xv-&amp;lt;/code&amp;gt;          || no        || Presto           || Opera Software        || Opera Desktop Browser for Windows 2000/XP&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Cross-browser css3 linear-gradient */&lt;br /&gt;
.linear-gradient {&lt;br /&gt;
&lt;br /&gt;
  /* Gecko browser (Firefox) */&lt;br /&gt;
  background-image: -moz-linear-gradient(top, #D7D 0%, #068 100%);&lt;br /&gt;
&lt;br /&gt;
  /* Opera */&lt;br /&gt;
  background-image: -o-linear-gradient(top, #D7D 0%, #068 100%);&lt;br /&gt;
&lt;br /&gt;
  /* older Webkit syntax */&lt;br /&gt;
  background-image: -webkit-gradient(linear, left top, left bottom,&lt;br /&gt;
    color-stop(0, #D7D), color-stop(1, #068));&lt;br /&gt;
&lt;br /&gt;
  /* Webkit (Safari, Chrome, iOS, Android) */&lt;br /&gt;
  background-image: -webkit-linear-gradient(top, #D7D 0%, #068 100%);&lt;br /&gt;
&lt;br /&gt;
  /* W3C */&lt;br /&gt;
  background-image: linear-gradient(to bottom, #D7D 0%, #068 100%);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ====&lt;br /&gt;
Vendor prefixes were designed for features that were under development, meaning that the syntax may not even be final. Also, adding a rule for each browser&amp;#039;s implementation of a function does not scale well when you want to support many browsers. Consequently, the major browser vendors are moving away from vendor prefixes in favor of other methods such as &amp;lt;code&amp;gt;@supports&amp;lt;/code&amp;gt; feature queries.&lt;br /&gt;
&lt;br /&gt;
=== Feature detection ===&lt;br /&gt;
&lt;br /&gt;
==== JavaScript feature detection ====&lt;br /&gt;
Multiple JavaScript libraries exist to detect what features are available in a particular browser so that CSS rules can be written to target them. Libraries such as Modernizr add classes to the &amp;lt;code&amp;gt;html&amp;lt;/code&amp;gt; element, allowing for CSS rules such as &amp;lt;code&amp;gt;.cssgradients .header&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;code&amp;gt;@supports&amp;lt;/code&amp;gt; ====&lt;br /&gt;
A new feature known as feature queries was introduced in CSS3, allowing the detection of specific functionality within the CSS (without requiring the use of a JavaScript library for feature detection). This new directive can be used to check for the support or lack of support for a specific feature, and checks can be combined with &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;not&amp;lt;/code&amp;gt;. Obviously, &amp;lt;code&amp;gt;@supports&amp;lt;/code&amp;gt; rules will only work on browsers that support &amp;lt;code&amp;gt;@supports&amp;lt;/code&amp;gt;. &amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
header {&lt;br /&gt;
    display: block;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@supports (display:flexbox) {&lt;br /&gt;
    header {&lt;br /&gt;
        display: flexbox;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== JavaScript polyfills ===&lt;br /&gt;
While JavaScript feature detection and &amp;lt;code&amp;gt;@supports&amp;lt;/code&amp;gt; rules can help to target browsers that require fallback functionality, they will not address bugs in specific browsers or enable that advanced functionality. [[Polyfill (programming)|Polyfills]], scripts that make behavior consistent across all browsers, can be used to add support for new CSS rules (for example, [[media queries]] in IE 8) as well as fix bugs in specific browsers (for example, [https://github.com/rodneyrehm/viewport-units-buggyfill fixing the implementation of viewport units in mobile Safari]). Since polyfills add or fix functionality in browsers that don&amp;#039;t have it, they serve a different purpose than feature queries, but can be used in combination with them.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Comparison of web browser engines (CSS support)]]&lt;br /&gt;
* [[Conditional comment]]s&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://browserstrangeness.bitbucket.org/css_hacks.html Browser Strangeness] - Jeff Clayton&amp;#039;s Live CSS hacks and tests to filter for mainstream browsers, including the only known CSS Hacks for Safari 7 and 8&lt;br /&gt;
* [http://browserhacks.com browserhacks.com] - Multiple browser filter methods and tests (Hugo Giraudel, Joshua Hibbert, Tim Pietrusky, Fabrice Weinberg, Jeff Clayton)&lt;br /&gt;
* [http://qooxdoo.org/documentation/general/webkit_css_styles Safari/Webkit (webkit) prefix filters] refix filters]&lt;br /&gt;
* [https://developer.mozilla.org/Special:Tags?tag=CSS:Mozilla+Extensions Mozilla (moz) prefix filters]&lt;br /&gt;
* [http://www.opera.com/docs/specs/opera9/css/index.dml Opera (wap) prefix filters] - This page has all of Opera&amp;#039;s CSS selectors.&lt;br /&gt;
* [https://web.archive.org/web/20060804012032/http://centricle.com/ref/css/filters/ CSS Filters] – A fairly complete table of CSS hacks which show and hide rules from specific browsers.&lt;br /&gt;
* [ CSS Filters – CSS-only Filters Summary] – More CSS filters.&lt;br /&gt;
* [https://web.archive.org/web/20070715175654/http://www.lipfert-malik.de/webdesign/tutorial/bsp/css-weiche-filter.html Filters and Cross-Over] – CSS filters. Parsing errors marked red.&lt;br /&gt;
* [http://rafael.adm.br/css_browser_selector - CSS Browser Selector] - Allows to combine browser specific CSS in single stylesheet (using JavaScript).&lt;br /&gt;
* [http://www.positioniseverything.net/articles/cc-plus.html - #IEroot] - Targeting IE with a single stylesheet containing all CSS (without using JavaScript, but using conditional comments to assign browser-specific tag to arbitrary content root [div])&lt;br /&gt;
{{Use dmy dates|date=September 2011}}&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Css Filter}}&lt;br /&gt;
[[Category:Cascading Style Sheets]]&lt;/div&gt;</summary>
		<author><name>Josvebot</name></author>	</entry>

	</feed>