gpt4 book ai didi

css - 带有搜索图标位置的文本框

转载 作者:太空宇宙 更新时间:2023-11-03 20:50:58 25 4
gpt4 key购买 nike

我不太擅长CSS,文本框已经右对齐,我试着把搜索图标放到文本框里,就是进不去。代码如下:

<style type="text/css">
#textbox-search{overflow:auto;}

#textbox-search input.searchkeyword {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border:1px solid #8e8e8e;
background-color:#f5f5f5;
height:16px;
padding:-4px;
padding-left:-48px;
color:#4a4a4a;
float:right;
}

#textbox-search input.button{
border:0;
padding:4px;
margint:0 0 0 600px;
width:24px;
height:24px;
background:transparent url('images/search.png') center center no-repeat;
float:right;

}
</style>

<form id="textbox-search">
<input type="submit" class="button" value="" />
<input type="text" class="searchkeyword" />
</form>

更新:enter image description here

最佳答案

您可以像这样使用 background 属性简单地实现这一点

input{  
background: url("http://png.findicons.com/files/icons/1389/g5_system/32/toolbar_find.png") top right no-repeat;
height:30px;
padding-right:30px;
}

JS Fiddle Demo

您可以根据图像尺寸更改高度和填充值。

关于css - 带有搜索图标位置的文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16000283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com