Skip to Main Content


10 Best CSS Hacks And Tricks

By: Alex Hall
Comments (1)
Feb
20

Here at Ufindus Customer Street we always strive for good clean code in the sites we build. I’m not personally accustomed to using CSS ‘Hacks’ when coding websites so I wouldn’t ever recommend using those dirty hacks to get around Internet Explorer bugs because there are plenty of cleaner ways of doing it. However, this short list compiles some very useful CSS tricks that I now use everyday when building sites with CSS.

For example, did you know that Internet Explorer and every other browser handle heights differently? Shocking I know. Internet Explorer 6 and below do not recognise the CSS property ‘min-height’, which does exactly what it says it should in Mozilla and the other browsers. That is, a section given min-height will never shrink to a height less than that value. This becomes very useful with dynamic sites where you don’t know how much content there is going to be and you would like your page to have some form of height whether there is content to fill it, or not.

Height in every browser other than Internet Explorer will set the maximum height of an element and won’t expand beyond that. We can’t use this in our example because the content might be longer than our set height. Internet Explorer incorrectly adjusts for this stretching the element to fit the contents inside, which should be the functionality of ‘min-height’ not ‘height’. This means that unless we use ‘overflow: hidden’ the element will stretch in Internet Explorer. A real pain that can be.

However, the fix for this can be found in this list and it’s simple to implement as it requires setting a min-height (for browsers that support it), a height (for Internet Explorer), and the middle value with !important resets the min-height for Internet Explorer, whilst not conflicting with the value set for the other browsers.

A very helpful fix and plenty more can be found at Stylized Web.com

If you liked that, then try these...

Shape Your Text
Here's a pretty sweet web application for creating .

Way Way Back
Way back in the days when CSS, Semantic coding and tableless design were but pipe dreams, big businesses were poised to take on the emergent powers of advertising on the internet to reach those web savvy youths who would shun the outside world in order to spend precious time waiting for web pages to download.

CSS Vista: The Tool To Rule
CSS Vista is one of those tools that, once you find, you will wonder how you managed to build a website without it! The major difficulty in developing websites, particularly those based around CSS layouts, is browser inconsistencies.

  • Digg
  • del.icio.us
  • Netvouz
  • ThisNext
  • MisterWong
  • BlinkList
  • blogmarks
  • Netscape
  • NewsVine
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • YahooMyWeb
1 Star2 Stars3 Stars4 Stars5 Stars
4
after 2 Votes

1 Comments

On Mon 25 Feb Matt wrote :

That’s a pretty good tip, nice and simple, not a solution I find myself in need of very often though. The website has some good stuff but could probably be better written imho :)

Leave a comment

Back to Top