Development Hackers

Cover image for Simple CSS Hacks

Posted on

Simple CSS Hacks

Funny CSS Meme

There are many "hacks" that can be used in CSS to achieve specific effects or work around browser inconsistencies. Here are a few examples:

  • To hide text from screen readers but still make it visible on the page, you can use the clip property with a value of rect(1px, 1px, 1px, 1px).
  • To target specific versions of Internet Explorer, you can use the * selector followed by the version number. For example, *html targets IE6 and *+html targets IE7.
  • To make an element take up the full width of its parent, you can set its width to 100% and box-sizing to border-box.

  • To vertically center an element, you can use the display: flex and align-items: center properties on the parent element, and margin: auto on the child element.


You can checkout how to use display: flex with an article on AppCode. The webpage "How to Create a Responsive Flexbox Grid" is a tutorial that explains how to create a responsive grid using flexbox. It starts by introducing the basic concepts of flexbox and how it can be used to create a grid layout. The tutorial then goes into detail on how to set up the grid, including how to define the rows and columns, how to make the grid responsive, and how to adjust the layout for different screen sizes. The tutorial also includes examples and code snippets to help the reader understand the concepts being discussed. Overall, the webpage provides a clear and comprehensive guide on how to create a responsive flexbox grid.

Please note that the above hacks may not work in the latest version of the browser or may cause a problem in other browser or devices.

Top comments (0)