formanceoptimizationmethods,theSitePointbookLeanWebsites^7 isausefulre-
source.
Managing Styles for Legacy Browsers
Cross-browsercompatibilityisthebestit’severbeen.Thespeedwithwhichusers
upgradetheirbrowsersisalsothebestit’severbeen.Unfortunately,notallweb
usersareusingthelatestandgreatestversionoftheirbrowser,sowe’llstillneed
tomanageCSSforthosebrowsers.Thereareacoupleofwaystodothis.
Using Conditional Comments (IE9 and Earlier)
InternetExplorer 9 andearlierversionssupportconditionalcomments,whichenable
ustoserveCSS,JavaScript,orportionsofHTMLonlytoIEusers:
<!--[if IE]>
CSS, JavaScript, or HTML goes here.
<![endif]-->
Conditionalcommentsuseacollectionofoperatorstospecifytheconditionunder
whichthecodecontainedwithinitshouldbeapplied,asshowninTable2.1.^8
Table 2.1. Commonly used conditional comments operators
Operator Purpose
! NOT operator; negates the condition
lt Less-than operator
lte Less-than or equal-to operator
gt Greater-than operator
gte Greater-than or equal-to operator
ToserveCSStoInternetExplorer 9 alone,youcouldusethefollowing:
(^7) https://www.sitepoint.com/premium/books/lean-websites
(^8) TheMicrosoftDeveloperNetworkdocumentationfeaturesacompletelistofconditionalcomment
operators.[https://msdn.microsoft.com/en-us/library/ms537512%28v%3Dvs.85%29.aspx]
CSS Architecture and Organization 75