仅具有底部边框的输入文本字段

问题描述 投票:0回答:7

如何设置文本

input
字段的样式,使其只有像这样的
border-bottom

预期文本

Input
字段

html css border html-input
7个回答
60
投票

使用

outline:0
,然后设置
border-bottom

input {
  outline: 0;
  border-width: 0 0 2px;
  border-color: blue
}
input:focus {
  border-color: green;
  outline: 1px dotted #000
}
<input placeholder="Text" type="text" />


35
投票

试试这个

.inp {
    border:none;
    border-bottom: 1px solid #1890ff;
    padding: 5px 10px;
    outline: none;
 }

[placeholder]:focus::-webkit-input-placeholder {
    transition: text-indent 0.4s 0.4s ease; 
    text-indent: -100%;
    opacity: 1;
 }
<input class="inp" placeholder="What needs to be done?👻"/>


14
投票
input {
    border: 0;
    outline: 0;
    border-bottom: 2px solid blue;
}

5
投票
#input_Id{
   border:0px;
   border-bottom:2px solid #eee;
}

2
投票

input {
  border: 0;
  outline: 0;
  border-bottom: 2px solid #03a8f45e;
  font-size: 1.4rem;
  color: #ccc;
        
}
<input placeholder="Enter search query" type="text" name="fname" autofocus />


2
投票

将以下代码添加到您的 css 文件中。它将自动更改应用程序中所有输入框的样式。

input {
    border: 0;
    outline: 0;
    border-bottom: 2px solid #1890ff;
}

如果您只需要为输入框应用样式,请使用以下类声明,

.inputbox {
    border: 0;
    outline: 0;
    border-bottom: 2px solid #1890ff;
}

<input class="inputbox" placeholder="Enter a number"/>

0
投票
.field {
      width: 100%;
      position: relative;
      border-bottom: 1px solid lightgray;
      border-radius: 0px;
      font-size: 14px;
      font-weight: bold;
    }
© www.soinside.com 2019 - 2024. All rights reserved.