加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 碗状下划线或输入边框

发布时间:2020-12-14 23:13:29 所属栏目:资源 来源:网络整理
导读:参见英文答案 Input with border for half height????????????????????????????????????5个 我有一个输入字段,底部只有一个边框,现在我需要在输入的左侧和右侧创建一个小线.这有点难以描述,所以我将使用一个例子: input { background-color: transparent; h

参见英文答案 > Input with border for half height????????????????????????????????????5个
我有一个输入字段,底部只有一个边框,现在我需要在输入的左侧和右侧创建一个小线.这有点难以描述,所以我将使用一个例子:

input {
  background-color: transparent;
  height: 20px;
  padding: 10px 10px 1px;
  
  border: 0;
  border-bottom: 1px solid red;
}

Fiddle

这就是我所拥有的:

Before

这就是我需要的样子:

After

最佳答案
在输入上使用多个box-shadows可以让您具有此下划线效果:

input {
  height:20px;
  padding:0 5px;
  border: 0;  
  box-shadow: -9px 9px 0px -7px red,9px 9px 0px -7px red;
  width:300px;
}

需要根据输入的高度调整sbox-shadow的spread radius and the X/Y offset,如本例中可以看到的输入更高:

input {
  height:20px;
  padding:10px 5px;
  border: 0;  
  box-shadow: -18px 18px 0px -17px red,18px 18px 0px -17px red;
  width:300px;
}

浏览器支持box-shadows is IE9+.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读