In Mark Pilgrim’s magnum opus – Dive Into HTML5, there is this section under Web Forms that talks about the styling of
I mis-understood the idea several times before knowing what it is really all about, and after knowing, I decided to share my final opinions here:
There are two parts of the story, one is the fact stated on the book, and another is the practice used based on the fact.
First, let’s talk about the fact
In Dive Into HTML5, it was mentioned “By default, Safari will not apply even the most basic CSS styles to <input type=”search”> fields.”
Well, this is not entirely true. Depends on the definition of CSS styles, I consider the change of
height as basic styling as well, so in this case, Safari can, by default, apply CSS style rules. Refer to the input box with
However, what doesn’t work is when you try to alter the design appearance of the input, let’s say if you apply
'border:1px solid red;', by default, Safari will not render it. Refer to the input box with
In the case above, if you want to force Safari to style the border, you have to use the hack mentioned by John Lein in Mark’s Dive into HTML5. Refer to the input box with
One more thing to note at this point is that this is not just a Safari issue, Chrome also has the same behavior.
Second, let’s talk about the practice
Do websites need to look exactly the same in every browser? The answer is here. Form element can show up based on the UA design. There isn’t a need to make a button or search box to look exactly the same in every browser.
This is not to say what Mark Pilgrim mentioned in his book was wrong, he didn’t encourage people to change the style of a form, he simply pointed out how to do so if you want to force the styling (we all know how hard to convince the bureaucrats in an agency). The only part that needs a bit clarification is the line “By default, Safari will not apply even the most basic CSS styles to <input type=”search”> fields.” Again, this is based on my interpretation.
Thanks to Mark Pilgrim to write such a nice book for FREE.
Thanks to the tip by John Lein.
Thanks to MarcHaunschild to brought this issue up.
Thanks hoopyfrood for the reply to make me rethink.
Thanks to Paul Irish’s comment to make me rethink again about this.
And thanks to Mathias Bynens’ reminder link.