Conditional comments

For technical support and bug reports for all editions of CSS HTML Validator, including htmlval for Linux and Mac.
User avatar
RSteinwand
Rank VI - Professional
Posts: 596
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND

Conditional comments

Post by RSteinwand »

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
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Conditional comments

Post by Albert Wiersch »

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
RSteinwand
Rank VI - Professional
Posts: 596
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND

Re: Conditional comments

Post by RSteinwand »

Thanks Albert.
Rick