---
title: "ff ie padding"
author: "a68091555"
date: "2010-09-27T19:01:22Z"
tags: []
categories: ["Web前端"]
slug: "ff-ie-padding"
draft: false
lastmod: "2010-09-27T19:01:22Z"
id: 773545
url: "https://a68091555.iteye.com/blog/773545"
---

ff 和 ie对padding-top的解析是不一样的，在ie中，元素占用的高度 = padding-top + 元素原来的高度，在ff中，该padding-top被算在元素的原始高度之内。

解决方法：

一，尽量不用到padding-top；

二，在设置的padding-top后加入!important，ie不会解析这个属性。

<div style="padding-top:5px;height:10px !important;height:15px;width:200px;background-color:#ffeeee"> test </div>

三，利用*，ff不解析*，用这个也可以实现使用padding-top的效果在各浏览器一致。

<div style="padding-top:5px;height:10px;*height:15px;width:200px;background-color:#ffeeee"> test </div>