CSS hack’inimai
by neworld on Bal.25, 2009, under Programavimas, WEB programavimas
O tiksliau, kaip nurodyti konkretų css stiliu konkrečiai naršyklei, nenaudojant jokių javasriptų ar kelis CSS failus konkrečioms naršyklėms.
[code lang="css"]
/* IE 6 ir žemesnės */
* html #uno { color: red }
/* IE 7 ir žemesnės */
*:first-child+html #dos { color: red }
/* IE 7 ir modernios naršyklės */
html>body #tres { color: red }
/* Modernios naršyklės (IE 7 ne moderni naršyklė) */
html>/**/body #cuatro { color: red }
/* Opera 9.27 ir žemesnės */
html:first-child #cinco { color: red }
/* Safari */
html[xmlns*=""] body:last-child #seis { color: red }
/*safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) #siete { color: red }
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:first-of-type #ocho { color: red }
/* saf3, chrome1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {
#diez { background: #FFDECE; border: 2px solid #ff0000 }
}
/***** Atribūtų hack'ai ******/
/* ie6 ir žemesnės */
#once { _color:blue }
/* ie7 ir žemesnės */
#doce { *color: blue } /* or #color:blue */
[/code]
Aišku šitie hackai padarys jūsų CSS kodą nevalidų. Taigi kam to reikia? Šitas dalykas gali praversti dizaineriams, kai programuotojai nenumatė galimybės konkrečioms naršyklės naudoti skirtingus CSS, ir apties programuotojams, kai reikia ant greitųjų pakeisti vieną – du atributus. Bet geriau iškarto viską daryti gerai
Vyliuosi, jog kadanors tinklapių kurimo standartuose bus numatyta galimybė pačiame CSS nurodyti, kurioms naršyklėms skirta atitinkama taisyklė. Na bent jau, įkraunant CSS nurodyti kuriai naršyklei įkrauti. Kiek žinau, šitas kolkas kuo puikiausiai ant IE veikia.
Šaltinis: http://ajaxian.com/archives/css-browser-hacks
Balandis 30th, 2009 on 15:23:16
ir kur juos reikia deti ?
Balandis 30th, 2009 on 16:02:15
CSS faile
Vasaris 17th, 2011 on 15:20:13
The very core of your writing while sounding reasonable at first, did not work perfectly with me after some time. Someplace within the paragraphs you actually were able to make me a believer unfortunately just for a while. I nevertheless have got a problem with your leaps in logic and one would do nicely to help fill in those gaps. In the event that you can accomplish that, I would surely be amazed.