# CSS - Need help with text alignment (Safari vs Firefox)

**URL:** <https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791>\
**Category:** web dev\
**Created:** [May 8, 2008, 7:00pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791 "2008-05-08T19:00:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lacohido](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@lacohido](https://forum.kirupa.com/u/lacohido)\
**Post date:** [May 8, 2008, 7:00pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791/1 "2008-05-08T19:00:33Z")

</div>

Hi there  
Ive been trying to figure this out for a while now. I’ve seen it on a couple projects I’ve worked on. I dont know if its a Safari Bug, Firefox Bug, or if Im doing something wrong.

Anyway, whenever I use Header tags (\<h1\>, \<h2\>, etc) and sometimes the \<p\> tag I get this weird padding issue. In Safari there is a slight TOP padding (1px or so) and in Firefox I get 0px top-padding.

My Padding and Margin is set to 0. Take a look.

![](http://acohido.com/padding.jpg)

Does anyone know anything about this?  
Thanks in advance  
-Landon

---

<div class="post-metadata">

**Author:** ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)\
**Post date:** [May 8, 2008, 7:29pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791/2 "2008-05-08T19:29:55Z")

</div>

The text is the same distance away from the blue mark so it’s the top for sure, hrmmm.

---

<div class="post-metadata">

**Author:** ![fasterthanlight](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fasterthanlight](https://forum.kirupa.com/u/fasterthanlight)\
**Post date:** [May 8, 2008, 7:40pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791/3 "2008-05-08T19:40:16Z")

</div>

what happens when you set padding-top to 1px?

do they both increase by one? or does Safari remain unchanged, and only Firefox increases?

Have you defined your fonts correctly?  
If you are leaving it up to the default serif, this could be why its happening, a non default font could fix it

---

<div class="post-metadata">

**Author:** ![lacohido](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@lacohido](https://forum.kirupa.com/u/lacohido)\
**Post date:** [May 8, 2008, 8:25pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791/4 "2008-05-08T20:25:23Z")

</div>

[QUOTE=fasterthanlight™;2323784]what happens when you set padding-top to 1px?

do they both increase by one? or does Safari remain unchanged, and only Firefox increases?

Have you defined your fonts correctly?  
If you are leaving it up to the default serif, this could be why its happening, a non default font could fix it[/QUOTE]

fasterthanlight-  
If I add 1px to the top it adds it in both Safari and Firefox. Good thought though.  
Also, the font-family is defined for the \<h2\>

Here is the CSS for that element:

```auto

#main h2{
    font-size: 20px;
    margin: 10px 0 0 0;
    background: url(images/h2.gif) no-repeat;
    color: #333333;
    font-family: Times, Times New Roman, serif;
}

```

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 8, 2008, 9:05pm UTC](https://forum.kirupa.com/t/css-need-help-with-text-alignment-safari-vs-firefox/259791/5 "2008-05-08T21:05:52Z")

</div>

it’s the difference in the default line-height, if you define the line-height to a px it should render the same.
