Saturday, February 7, 2009

Firefox Extensions

There are a ton of Firefox Extensions available to help web developers do their job. Here are the ones I use:

Web Developer: I don't use this one very often, but it has a ton of useful options. I mostly use it to turn off Javascript and CSS, or to resize my browser to a certain width.

Firebug: It would be a bit harder for me to do my job without this extension. Firebug allows you to manipulate the code of a page and see the changes directly on your screen. None of these changes are saved anywhere , they will go away when you refresh the page. I like to use it for testing CSS code before writing it into my CSS file (saves time from writing, saving, uploading, refreshing and fixing). It is also a helpful tool for debugging Javascript or jQuery. One important thing to know about the HTML code it shows you: this is the generated code, which is different from the normal source code. So if you have some Javascript written to change an item on hover, you can see the changes that are made in the code as you hover on and off the element.

ColorZilla: A color picker for your browser. Very helpful when creating images that need to match the colors in your site.

MeasureIt: A tool for measuring width and/or height of areas on a website.

Pixel Perfect: Requires Firebug. Overlays an image (like a design comp) on top of your site so you can check how close you are to the design.

Monday, February 2, 2009

Simple Rounded Corners

CSS3 is still a ways out into the future. Sure, you can use some of its features, but if your sites need to be compatible for all modern browsers, you're stuck with CSS2 for the time being.

My most recent project uses a few rounded corners. Since I am using CSS2 and don't want any complicated code, I am using images for these curvy angles. If you read my previous post, you'll know that I'm trying to make my images as small in size as possible.

One solution is to use the sliding doors method. My problem with this is that in some cases, your one image is unnecessarily large, and in other cases, your image may not be large enough (you never know, especially if you work with dynamic content!)

My current project (immsersive-training.net) has boxes that fall into two categories: set height with unknown width, or set width with unknown height. For the boxes with set height, I made two images:

rounded top rounded bottom

Obviously, the top and bottom of the box. For the middle of the box, I just used CSS. It has a set width and a border on the left and right. Pretty simple. My html code looks like this:
<div>
  <div class="header"></div>
  <div class="middle"></div>
  <div class="footer"></div>
</div>
The images are set as the background for the header and footer, and the CSS for the middle section is pretty simple:
.middle {
  border-right: 1px solid #999999;
  border-left: 1px solid #999999;
  width: 196px;
  padding: 8px 15px;
}
This also easily works for background colors other than white.

If your border is a little bit more complicated, then for the middle part I suggest using just a sliver image, and setting it to repeat-y.

Final Product:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.