gpt4 book ai didi

html - 无法控制 CSS 转换中的可点击区域

转载 作者:太空宇宙 更新时间:2023-11-04 02:49:24 24 4
gpt4 key购买 nike

我正在尝试创建一个滑动搜索栏/框,当您选择放大镜时,它会在过渡时移动。问题是只有很小的空间可供您选择放大镜来打开搜索栏。然后,当搜索栏打开时,关闭它的空间向后移动(放大镜的右侧)大约 5 像素。我希望可选区域始终位于放大镜上。

这是HTML

<div class="wrap">
<form action="" autocomplete="on">
<input id="search" name="search" type="text" placeholder="Search by Address, Agent or Client..."/>
<span class="fa fa-search"></span>
</form>

这是CSS

body {
background: #005DC1;
font-size: 15px;
}

.wrap {
position: relative;
right: 50px;
height: 22px;
float: right;
}

input[type="text"] {
height: 20px;
width: 0px;
font-size: 12px;
font-family: helvetica;
border: none;
outline: none;
color: rgba(255, 255, 255, 0.8);
padding: 3px;
position: absolute;
top: 0;
right: 0;
background: none;
z-index: 1;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}

input[type="text"]:focus:hover {
border-bottom: 1px solid #fff;
}

input[type="text"]:focus {
width: 250px;
z-index: 1;
border-bottom: 1px solid #fff;
cursor: text;
}

.wrap span {
color: rgba(255, 255, 255, 0.8);
z-index: 5000;
cursor: pointer;
right: 3px;
height: 20px;
width: 25px;
}

这是我当前的 CodePen .

这里是原文Codepen我正在尝试模仿我自己的设计。

最佳答案

我认为您只需要在输入中添加 padding-right,请参阅 this CodePen

关于html - 无法控制 CSS 转换中的可点击区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33289957/

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