Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Padding issue. Need help please

Tags:

html

css

spacing

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

My site is here.

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.

enter image description here

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.

like image 851
JasonTT Avatar asked Jun 12 '26 18:06

JasonTT


2 Answers

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.

like image 191
Robusto Avatar answered Jun 14 '26 12:06

Robusto


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.

like image 33
Rupert Madden-Abbott Avatar answered Jun 14 '26 12:06

Rupert Madden-Abbott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!