[英]CSS: background image for submit button
我已使用自定義背景圖片設置了提交按鈕的樣式。 但是在不同的瀏覽器上顯示卻有所不同。
幾乎所有瀏覽器都顯示正確:
但是在2上它有額外的高度:
誰能指出我的標記有什么問題?
CSS:
input[type="submit"]{
background: url(http://dl.dropbox.com/u/17055243/icons.png) -99px 0px no-repeat;
width:30px;
height:30px;
border:none;
float:left;
margin:30px 0 0;
cursor:pointer;
}
HTML:
<form>
<input type="text" class="placeholder" value="Search" />
<input type="submit" value="" />
</form>
經過測試:
在我看來,文本框的高度與提交按鈕不同。 嘗試設置文本框的高度。
我在第二個搜索欄中看到文本為斜體,看起來略小。 我認為搜索欄正在適應文本並使其變小,從而使搜索圖標顯得更大。
您可能需要做的是將其添加到您的樣式表中,以控制占位符:
{font-style:normal}
嘗試這個。 它將為元素提供固定的高度。
input[type="text"]{
margin:30px 0 0;
width:226px;
color:#999999;
font-size:12px;
font-style:italic;
border:1px solid #cccccc;
border-right:none;
background-color:#ededed;
float:left;
height:28px;
padding-right: 7px;
padding-left: 7px;
line-height: 28px;
}
提交按鈕和輸入文本字段的邊框,邊距,內邊距等具有不同的默認值。首先,您必須將其同時提交到提交按鈕和文本字段中
margin:0;
padding: 0;
border: none;
outline: none;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.