Strange css prob
- Started
- Last post
- 13 Responses
- mg33
This is really strange. In my css there are two comments for two different hacks for opera and IE5.
Each is before actual css code, formatted as a comment.
If I remove the comment but leave the comment tags, and don't touch the css code, it totally throws off the page format.
Any idea why removing a comment would cause this?
- doesnotexist0
is it only fucking up in ie?
- mg330
Yes. It only changes in IE.
I'm confused.
- mg330
there is def a gremlin in my computer today.
- mg330
This is what I have:
/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style declaration. The incorrect IE5/Win value is above, while the correct value is below. See http://glish.com/css/hacks.asp for details. */
voice-family: "\"}\"";
voice-family:inherit;
height:14px; /* the correct height */
}/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
length values to user agents that exhibit the parsing error exploited above yet get
the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */body>#Header {height:14px;}
---
Removing the first comment doesn't change anything, but taking out the second one does. What is causing this?
- junker0
aah I see the problem
- instantok0
the reason the hacks work is because they exploit parsing errors in certain browsers...essentially glitches that turned into workarounds...removing the comment changes the way ie reads the glitch, thereby fucking shit up
- mg330
yep, you're right about that! I'll just leave em. Baffling.
- mg330
I'm testing how much I can remove from the comment.
It seems that it needs the "be nice to Opera 5" part of the comment at a minium.
/* "be nice to Opera 5" */
body>#Header {height:14px;}
- instantok0
yah...its a weird thing to begin with...you can change the text of the comments to something shorter, so long as you remember what is does and for which browser(s)...just don't mess with the asterisks and slashes
- Hym0
why are such hacks still in use ?
CSS support in browsers improved A LOT last years and even if your layout still suffers from issues why not just feed them different CSS with a serverside script ?
- spiralstarez0
Better yet,
if you can learn what actually causes different problems in each browser, and instead find a different way to do it.
For example, if you look in the CSS Zen Garden, you won't find hacks in most people's CSS. But it still works in all browsers.
If you learn to markup in a way that doesn't use hacks it will take some time, but will be so much easier in the future...
- tomkat0
yeah I always was too stupid for those hacks, but the sites work fine xbrowser
- mg330
That's my hope spiral. What I've been building combines several things together in the CSS, so it's been much trial and error, changing one thing at a time and seeing how it changes.
The web dev toolbar's realtime css editing is awesome. Otherwise I'm using FrontPage 2005 to edit pages. After it's all done, FP will mostly take on a CMS aspect.