CSS Hack: Modern Alternatives

While hacks work for retro projects, modern web development prefers standard-based solutions over parser tricks.

Feature queries (@supports), autoprefixer, and progressive enhancement are better for maintainable code. Hacks should only be used as a last resort for legacy systems.

I still use hacks for my retro-themed sites — but I recommend modern tools for most projects!

 
/* Modern Feature Queries (IE11+ / Modern Browsers) */
@supports (display: grid) {
  .container { display: grid; gap: 1em; }
}
/* Fallback for non-supporting browsers */
.container { display: flex; flex-wrap: wrap; }

/* IE Conditional Comments (HTML-level hack) */
<!--[if IE 6]>
<link rel="stylesheet" href="ie6-fixes.css" type="text/css" />
<![endif]-->

/* Autoprefixer (automatically adds vendor prefixes) */
.element {
  display: flex;
  transition: transform 0.3s;
} /* Outputs: */
.element {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-transition: -webkit-transform 0.3s;
  transition: transform 0.3s;
}