It’s Friday…

Leave a comment on this post if, in your mind you started singing Friday.  Sorry.  It had to be done. 

So 2 weeks ago I said I would have my website up.  It is! Unfortunately not on my domain joshdance.me.  It is on a random domain that I had registered for a different project.  But I will soon move it here.  

Recently, I have seen certain chunks of code, or patterns pop up in many designers work.  I wanted to know why and happily, today I uncovered the mystery of the Phantom Comments.  

Sometimes in code, programmers want to write something that only the people who look at the code see.  It is not meant to be displayed, or operated on by the computer.  You set these comments off by putting in a comment symbol and then the comment.  In html the comment symbol is this:

<!–"comment goes here"–>

Simple right? But I was confused by a statement that I saw on many webpages.  It went like this. 

<!–if(a string of computer code)–>

The comment had what looked like code in it.  At first I thought that maybe the programmer just wanted the code not to be seen by the computer, but then why would she take the time to write it? I searched google but didn't find much. However, I am happy to report that today, I solved it.  

I was reading this little tutorial and came across a part where the author says, "and then we throw in this html5 shiv", and then he used the confusing code! I thought to myself, "Why it must be called the html5 shiv! So I promptly googled and found this article about the html5 shiv on Wikipedia.  As usual, it is all Microsofts fault.  🙂 Older versions of Internet Explorer doesn't implement CSS very well.  So everyone puts in this little piece of code to fix their website in IE.  Mystery solved! But then I had one more question.  If the code is in the comment, how does IE even see it?  Back to google I went. When I searched for "if statements in html comments", I found this article about CSS conditional comments. Guess what? Code in comments only works in this one instance in IE.  Therefore it is only used to fix rendering problems in IE.

Next week I am going to continue digging into CSS and making it happen.  #LetsDoThis. 

Leave a Reply

Your email address will not be published.