Forum Moderators: not2easy
I knew there was something about the universal selector but never bothered looking, however I stumbled upon it in travels this weekend.
the Universal Selector {*} is truly Universal in IE
All versions inc IE7 are affected, as far as I can tell, The universal selector is usually used to select all children of a specific element but in IE it also selects <!-- HTML Comments --> as well some others, which might be unexpected
sample:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>IE Universal Selector Oddity</title>
<style type="text/css">
body div * {
display: block; /*this makes it visible for proof demo */
border: 3px double #008;
padding: 20px 10px;
background: #ffe;
height: 80px;
}
p {margin: 0;}
</style>
</head>
<body>
<h1>IE Universal Selector Oddity</h1>
<div>
<p>The Universal Selector '*' selects HTML Comments and some other unexpected elements - it is possible to apply some styles to it.
-- In IE you should see 3 main boxes, the second one - which is an HTML comment - is empty. --
The box around the text in the bottom box is generated by it selecting the <br> element
</p>
<!-- This is an HTML comment -->
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.<br></p>
</div>
</body>
</html>
Not major perhaps but just filing for posterity ;)
Suzy