Download ColourMod - Dashboard Widget

Download ColourMod - Dashboard Widget

Download ColourMod - Konfabulator Widget

Download ColourMod Konfabulator - Konfabulator Widget

Download ColourMod - Dashboard Widget

Download ColourMod - Plug And Play

Download ColourMod - Unbranded

Download ColourMod Unbranded

Download ColourMod - Personalized

Download ColourMod Personalized




An Interesting CSS Dilemma

I’ve run across a perplexing problem with creating borders around input textfields and the way Safari and Firefox display them. Maybe someone can help.

The end product that I’d like to achieve is similar to the contact form on Mint or the input field on CalFeed.com. So essentially, I want to create a custom border around the input field, a little space and then another border. But before you blow me off as stupid the catch is that you cannot use a table to wrap around it. Yes, that is correct, no tables.

Here is a screenshot comparison between Firefox and Safari:

Safari Firefox quirk

Notice the two pixel difference on the right edge of the input field? That is what I’m trying to eliminate.

I’ve tried a couple different approaches so far, the code for the one that is represented in the image above looks like this:

<div class="inputWrap">
  <input type="text" value="" />
</div>

The style looks like this:

input {
  font-size: 10px;
  width: 150px;
  border: solid 1px #D7D0B4;
  background-color: #FFFFFF;
  margin: 2px;
}
.inputWrap {
  border: solid 1px #ECE8DA;
  width: 156px;
  margin-left: 20px;
}

Unfortunately, all the methods I’ve tried would look fine in Firefox but would be off by only a couple pixels in Safari, and vice versa. I’ve used this technique with images before with great results, but when it comes to input fields it doesn’t work right. Anyone have any clues or solutions?

In the process of working through some other projects I figured out the solution to this whole mess. Based on the following code above the styles should look like this:
input {
  font-size: 10px;
  width: 150px;
  border: solid 1px #D7D0B4;
  background-color: #FFFFFF;
}
.inputWrap {
  float: left;
  border: solid 1px #ECE8DA;
  padding: 2px;
}

The key is in the float. For some reason, adding the float lets both browsers render the padding in between the two borders properly. Go figure.


3 Responses to “An Interesting CSS Dilemma”  

  1. 1 Nathan Smith

    I’ve given up trying to style forms and buttons in Safari. If Apple wants to keep them from being over-ridden by CSS, then Safari users should just get used to seeing forms and buttons look worse than they should. ;)

  2. 2 ColourMod

    well input fields you can modify to a certain degree. buttons can be modified using an image.

  1. 1 Paris Hilton Sex Tape Video 2 - Paris Hilton Exposed *HOT*


Leave a Reply