将鼠标悬停在输入字段中

问题描述 投票:-2回答:3

我有输入公司和一个问题。我将我的按钮放在负边距左边(删除输入之间的空格),因为我需要它看起来像一个整体,只有按钮应该有边框圆。如果我不使用负边距并删除文本字段的右边框,我会在输入之间获得一些空白空间。问题是当你点击文本框时,我看不到右边的悬停,这怎么能修复?最后,我应该像照片一样(所有方面的按钮上的圆形边框,按钮和文本字段之间没有空格),只有正确的悬停

enter image description here

#text-area {
height: 11px;
}

#button-area {
margin-left:-10px;

}
<input type="text" placeholder="enter text here" id="text-area">
<input type="submit" placeholder="enter text here" id="button-area" value="Find">
html css
3个回答
2
投票

根据我从你的问题中理解的,我对这个问题的CSS代码看起来有点像这样。

            #text-area {
               /* height: 11px;
               */
               border: 2px solid rgba(92, 91, 91, 0.589);
               border-right: none;  
               margin-right: none;
               padding-right: none;
            }
            
            #button-area {
               margin-left: -4.8%;
               padding-top: 0.0625rem;
               padding-bottom: 0.0625rem;
               background-color: #8cc425;
               border: 0.125rem solid rgba(92, 91, 91, 0.589);
               border-radius: 0.1875rem;
            }
            #button-area:hover{
                cursor: pointer;
            }
        <input type="text" placeholder="enter text here" id="text-area">
        <input type="submit" placeholder="enter text here" id="button-area" value="Find" >

您可以自由尝试此代码。如果您对此答案中的此评论有任何疑问。


0
投票

这是你想要的结果吗?

.formthing {
  border: 1px solid gray;
  display: inline;
  border-radius: 3px;
  padding: 1px;
}

#text-area {
  border: none;
}

#button-area {
  margin-left: -4px;
  margin-right: -2px;
  background-color: #CDFF65;
  height: 23px;
  border: 1px solid gray;
  border-radius: 3px;
}

.formthing:hover, 
.formthing:hover > #button-area {
  border: 1px solid #5794BF;
}
<div class="formthing">
  <input type="text" placeholder="enter text here" id="text-area">
  <input type="submit" placeholder="enter text here" id="button-area" value="Find">
</div>

我删除了borderinput,在divinput周围创建了一个新的button,并用borderborder-radius做了一些造型。


0
投票

https://jsfiddle.net/chaitanya207/svh46aL1/

.find-box{
    width:450px;
    position:relative;
}
.find-box input[type="text"]{
    width:450px;
    border:2px solid #9f9f9f;
    height:70px;
    border-radius: 5px;
    font-family:arial;
    text-transform:capitalize;
    text-indent:10px;
    outline:none;
}
.find-box input[type="submit"]{
    width:100px;
    background:#cdff65;
    border:none;
    font-family:arial;
    font-size:18px;
    height:72px;
    border-radius: 0px 5px 5px 0px;
    position:absolute;
    top:2px;
    right:-2px;
    cursor:pointer;
}
© www.soinside.com 2019 - 2024. All rights reserved.