After inspecting the source code for this website, I noticed a cool feature where the page changes based on your scrolling position. It creates a visually appealing effect.
Upon further examination of the source in FireFox, I observed the use of
-webkit-transform:matrix(a, b, c, d, 0, 0);
to manage the movement of the div elements. However, when viewed in IE, it only shows as transform: matrix(a, b, c, d, 0, 0);
. These styles are defined in-line like this:
FireFox:
<div class="card gift" style="z-index: 0; -webkit-transform: matrix(a, b, c, d, 0, 0); right: 198px; top: 323px; opacity: 1;"></div>
IE:
<div class="card gift" style="z-index: 0; transform: matrix(a, b, c, d, 0, 0); right: 198px; top: 323px; opacity: 1;"></div>
In these examples, the variables a
, b
, c
, and d
change dynamically based on scroll position.
I stumbled upon this post on SO about conditional CSS, but it doesn't address in-line styles such as those seen in the code above.
Is it even possible to have conditional CSS properties applied inline? I attempted something like this (check out the fiddle here):
<div class="testing" style="<!--[if IE]>background-color: #321;<!--[if !IE]> -->background-color: #F00;<!-- <![endif]-->"></div>
If inline conditional CSS is not feasible, then how do websites adjust inline styles based on browsers? My assumption is that JavaScript is used to modify properties after the page loads, depending on the scroll position.
Thank you.
EDIT:
Upon reviewing the link provided, they have included
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if IE 9]> <html class="no-js lt-i10 ie9"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js"> <!--<![endif]-->
at the beginning of their webpage, which bears striking resemblance to one of the responses in the SO link I shared earlier. However, I am unclear on the functionality of these lines of code. Could this be part of the solution?
Thanks once more.