2010-11-01 54 views
1

類拿出一個對一個奇怪的問題......爲什麼Firefox在鏈接<a>和<input type = submit>中顯示不同的CSS?

這裏是我的一個按鈕CSS:

a.cta-btn-green { 
    color:#fff !important; 
    font-size:14px !important; 
    font-weight:bold; 
    text-shadow: #060 1px 1px 1px; 
    background-color:#329122; 
    padding:5px 10px; 
    -moz-border-radius:14px; 
    -webkit-border-radius:14px; 
    text-decoration:none; 
    float:right; 
    border:0; 
    font-family:Arial, Helvetica, sans-serif; 
    cursor:pointer; 
    background: -moz-linear-gradient(100% 100% 90deg, #307d23, #4ac236); 
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4ac236), to(#307d23)); 
} 


input.cta-btn-green { 
    color:#fff !important; 
    font-size:14px !important; 
    font-weight:bold; 
    text-shadow: #060 1px 1px 1px; 
    background-color:#329122; 
    padding:5px 10px; 
    -moz-border-radius:14px; 
    -webkit-border-radius:14px; 
    text-decoration:none; 
    float:right; 
    border:0; 
    font-family:Arial, Helvetica, sans-serif; 
    cursor:pointer; 
    background: -moz-linear-gradient(100% 100% 90deg, #307d23, #4ac236); 
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4ac236), to(#307d23)); 
} 

兩個CSS類是相同的,但一個被應用到<a>,另一個是應用於<input type="submit" /> ...效果是,Firefox給出的input.cta-btn-green的高度大於a.cta-btn-green

任何人都可以告訴我哪裏出錯了嗎?

感謝

+0

字體較高還是整個元素? – thejh 2010-11-01 12:42:56

+0

整個元素 – Nasir 2010-11-01 12:44:11

回答

1

如果你告訴你的ainputdisplay:block那麼你將能夠設置特定的高度,從而使它們相同。

所以下面的行添加到兩個規則:

display:block; 
height:20px; /*adjust this as needed*/ 
1

嘗試明確設置每條規則的heightline-height

0

我認爲,這是因爲你只設置字體高度 - 在<input>元素AFAIK也具有典型的按鈕邊框其中<a>元素沒有按沒有。

相關問題