Skip to content

Instantly share code, notes, and snippets.

@h4
Created February 29, 2012 21:43
Show Gist options
  • Save h4/1944653 to your computer and use it in GitHub Desktop.
Save h4/1944653 to your computer and use it in GitHub Desktop.
CSS-фильтры
/*
Css-фильтры являются абсолютно валидными, но подчас абсурдными селекторами
+ Это быстрое решение проблемы. Прописали дополнительных строчек и все отлично, верстаем дальше.
- Нет уверенности как поведет себя сайт с выходом новых версий браузеров.
Например, написали код с хаком для Firefox, через месяц выходит новая версия Safari
и оказывается она тоже понимает этот селектор!
*/
/*-----------------------
Фильтры для IE
*/
/*
* html
IE 6
*/
div {
background: #ff0000;
}
* html div {
background: #000;
}
/*
!important
IE 6
*/
div {
background: #ff0000 !important; /* для всех браузеров */
background: #000; /* для IE6 */
}
/*
*:first-child+html
IE7
*/
div {
background: #ff0000;
}
*:first-child+html div {
background: #000;
}
/*
* + html
IE7+
*/
div {
background: #ff0000;
}
* + html div {
background: #000;
}
/*
html>body
поймут все кроме IE6
*/
div {
background: #ff0000;
}
html>body div {
background: #000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment