Conditional comments

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 600
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Conditional comments

Post by RSteinwand » Thu Jan 30, 2014 11:08 am

Hi Albert,

I've been scratching my head for weeks, wondering why the html5 boiler plate conditional comments work for my public site, my secure site, but not for reports, then discovered this:

Code: Select all

<!DOCTYPE html>
<!--[if IE 7]>	<html lang="en-US" class="ie7 lt-ie10 lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>	<html lang="en-US" class="ie8 lt-ie10 lt-ie9"> <![endif]-->
<!--[if IE 9]>	<html lang="en-US" class="ie9 lt-ie10"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en-US">
<head>
Line 5 (the Iine before the <head> tag), had no closing conditional tag and CSE didn't catch it. It should look like this:

Code: Select all

<!DOCTYPE html>
<!--[if IE 7]>	<html lang="en-US" class="ie7 lt-ie10 lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>	<html lang="en-US" class="ie8 lt-ie10 lt-ie9"> <![endif]-->
<!--[if IE 9]>	<html lang="en-US" class="ie9 lt-ie10"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en-US"> <!--<![endif]-->
<head>
If you're not familiar with the advantage of these tags, here's some reading material:

http://www.1stwebdesigner.com/design/sn ... ilerplate/
http://www.paulirish.com/2008/condition ... r-neither/

It lets me do stuff like this in my style sheet:

Code: Select all

.pagetop{color:#fff;background:#001134;background:linear-gradient(to bottom,rgba(63,78,115,1) 0%,rgba(28,43,82,1) 14%,rgba(0,15,55,1) 26%,rgba(0,15,55,1) 100%)}

.lt-ie10 .pagetop{background:#001134 url('/images/horz_gradients_oldIE.png') 0 0 repeat-x}
Rick

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3412
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Conditional comments

Post by Albert Wiersch » Thu Jan 30, 2014 11:21 am

Thanks Rick! CSE HTML Validator doesn't check for this but it would be a good addition. I'll look into it for a future update.
Image
Albert Wiersch

User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 600
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Re: Conditional comments

Post by RSteinwand » Thu Jan 30, 2014 12:03 pm

Thanks Albert.
Rick

Post Reply