Author Archive

How to line wrap text in legend elements, even in IE

Back in 2009 I wrote about a way of Line wrapping text in legend elements. It involved using CSS hacks or conditional comments to target Internet Explorer, which was the most problematic browser in this regard.

Well, it still is. All other browsers cooperate and let the text in legend elements line wrap by default. But Internet Explorer refuses, even the brand new IE10. But there is a fix.

Read full post

Posted in .

Copyright © Roger Johansson


Removing whitespace around text fields

Trying to be pixel perfect on the Web is like begging to be frustrated. I try to not worry so much about a pixel here or there, but sometimes you just have to get complete control to make things look right.

Until recently I had never paid any special attention to the exact amount of whitespace some browsers create around textarea and input[type="text"] elements, but then I started implementing a design that required there to be exactly no whitespace around them. And I noticed that browser behaviour differs a bit here, so I needed to find a fix.

Read full post

Posted in .

Copyright © Roger Johansson


Use inherit to reduce repetition of CSS property values

Every now and then you will find yourself having to repeat the same value for a particular property in several CSS rules. Sometimes doing so is necessary, but there are some situations when you can use the “inherit� value to avoid repeating yourself.

In my experience, the properties I use inherit for most often are color plus properties related to background and font (both shorthand and the individual properties like background-color, font-size and font-family).

A few examples, then.

Read full post

Posted in .

Copyright © Roger Johansson


Tell CSS that JavaScript is available ASAP

When you’re styling parts of a web page that will look and work differently depending on whether JavaScript is available or not, it can be very useful to use JavaScript to change or add a class name to the html element.

By doing this you can create CSS rules that will only be applied when JS is available and vice versa. The trick is to make sure the class names are switched as early as possible during page load.

Read full post

Posted in , .

Copyright © Roger Johansson


IP address-independent access to Mac virtual hosts from Parallels virtual machines

Like many other Mac-using web developers I use Parallels Desktop for testing in various versions of Internet Explorer. It works well, including accessing local development sites set up as virtual hosts in Apache on my Mac.

One thing that’s been bothering me for a long time, though, was that whenever my Mac got a new IP address I had to open the hosts file in all my virtual machines and enter that address to access my sites. Pretty tedious. Well, I recently found out that this can be avoided. In case there are others who didn’t know this and wasted their time editing hosts files, here’s how.

Read full post

Posted in , .

Copyright © Roger Johansson


  •   
  • Copyright © 1996-2010 BlogmyQuery - BMQ. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress