views:

55

answers:

4

Hi

I'm experiencing a strange CSS spacing issue in Chrome (but not in Firefox and/or IE)

My site is: http://tinyurl.com/33oxwg

The vertical spacing in Firefox between the "Real Estate Search" (H2 tag) and the form input field for "San Francisco, CA" (#city-field input tag) is perfect, but in Chrome, Chrome is applying more/extra vertical spacing than desired.

To help, I've attached a screenshot. The redline represent the extra spacing that Chrome is adding that Firefox/IE are not.

http://img837.imageshack.us/img837/4149/spacing.png

Any ideas why Chrome is apply more spacing than Firefox & IE.

And how to fix this issue.

Thanks in advance

UPDATE

I'm also using a "reset stylesheet" to standardize across all browsers the H2 spacing, etc. It can be found in my linked HTML document above yet still am experiencing this issue.

+1  A: 

Use a reset stylesheet.

Different browsers interpret CSS rules for tags like H1, H2, UL, LI, etc. in different ways. These include padding and default font size. A reset stylesheet takes all those and removes the defaults so that you may substitute your own values when you so desire.

Robusto
I have used a reset stylesheet, as seen in the top of my CSS
JasonTT
(and even using the reset stylesheet as I am, I'm still experiencing these problems)
JasonTT
+1  A: 

According to Web Inspector, in Chrome, your input tag has a 2px top and bottom margin. However, Firebug shows no margin for this same input, in Firefox. Use the following in your CSS:

#city-field {margin:0}

Edit: The extra spacing is being caused because the input is set to display:inline-block. If you change it to display:block, you will notice the space disappears. Try using floats and display:block to get the content inline instead.

Rupert
I just updated the live code above to use the code you have, it still does not help.
JasonTT
@JasonTT Okay cool. I've updated my answer with the correct problem, I think.
Rupert
@Rupert, if I do #city-field{display:block;}, that does in fact eliminate the extra spacing issue; HOWEVER, that then pushes my submit button to a newline below the city-field input field. Any idea how I can keep the submit button on the same row as the city-field input while also eliminating that funky extra spacing?
JasonTT
+1  A: 

Try setting the height propriety of #city-field, let's say, at 20px.

however.

achairapart
A: 

I'm thinking that the line-height is the culprit. Try setting the line height of the h2 to somewhere around 13 to 15 pixels. By default it is set to normal. According to W3C, line-height: normal "Tells user agents to set the used value to a "reasonable" value based on the font of the element." Firefox and Chrome could be setting different "reasonable" values since they are built on entirely different rendering engines.

Brian Ray