Please note that you may have been redirected (you might like to make a note of the URL in the address bar of your browser and update accordingly) This is a permanent archvie but is no longer actively maintained. Please visit http://joshuaink.com for the latest updates.
Adjacent sibling selectors hack
Wednesday March 9, 2005
Whilst playing with adjacent sibling selectors today I stumbled across something that appears to hide chunks of CSS from Internet Explorer 5, 5.5 and 6 on PC.
I don't know whether it is of any real use but I quite like the fact that 'adjacent sibling selectors' abbreviates nicely to form the word ass. It will be even more appropriate if I have got this all wrong and it doesn't really work on further testing, so I am covered on all sides!
Anyway here is the example, and here is the CSS:
- #wrap,
- ass + hack{
- /* IE5 Mac commented backslash hack \*/
- width:730px;
- /* Recover from IE5 Mac commented backslash */
- }
For this to work across all versions of IE you must place the 'ass + hack' selectors very last on the list, IE5 will not play along otherwise. It can also be any words you like, for example, foo + foo, but I guess it's best not to use any actual HTML tags. I also added the IE5/Mac commented backslash hack to the code just to finish the job off.
If anyone finds any flaws with any browsers, please let me know and yes, you can call me an ass if you do!




Craig
1578 days ago
Rob Mientjes
1578 days ago
Craig
1578 days ago
Craig
1578 days ago
Craig
1578 days ago
Rob Mientjes
1578 days ago
Craig
1578 days ago
Rob Mientjes
1578 days ago
Anton
1578 days ago
Anton
1578 days ago
Jon Hicks
1578 days ago
Mark J
1578 days ago
Egor Kloos
1576 days ago