css - Bing 等搜索框内的搜索按钮

标签 css bing search-box

如何在搜索框内实现搜索按钮,就像在 Bing 等网站上看到的那样?

search box with graphic for button

最佳答案

它看起来像是在里面,但实际上不是(你不能将 html 放在输入中)。

两个元素(一个输入和一个按钮)靠得很近,边距为 0,并且高度相同。按钮的图形有 3px 的白色边距。所以它创造了这种效果。

可能的标记和样式可能是:

<input type="text" id="q" />
<input type="button" id="b" value="Search" />


#q, #b { 
   margin: 0 
}
#q { 
   padding: 5px; 
   font-size: 2em; 
   line-height: 30px 
}
#b { 
   /* image replacement */
   text-indent: -99999px; 
   width: 30px; 
   height: 30px; 
   display: block;
   background: gray url(button.png) 0 0 no-repeat;

   /* placing next to input using float or absolute positioning omitted ... */
}

关于css - Bing 等搜索框内的搜索按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25381658/

相关文章:

css - 可以将背景图像添加到输入字段的值吗?

javascript - 具有固定宽度和自动调整高度的 HTML 文本输入

Perl 脚本来向后测试所有可能的日期

Bing 广告 - 上传离线转化数据

python - 使用python下载bing图像搜索结果(自定义url)

c# - 我如何使用 radsearchbox 的 AutoPostback 功能?

python - wxPython:如何在 SearchCtrl 上收听 EVT_KEY_DOWN?

css - 仅使用 CSS 定位标题项

html - 一行上传文件

java - Android:快速搜索到 map 结果