下划线样式的输入框

<input style="border:0;border-bottom: 1px dashed #999999; width:40px;" type="text" onMouseOver="style.background='#eee'" onMouseOut="style.background='#fff'" />

dotted :  在MAC平台上IE4+与WINDOWS和UNIX平台上IE5.5+为点线。否则为实线
dashed :  在MAC平台上IE4+与WINDOWS和UNIX平台上IE5.5+为虚线。否则为实线
solid :  实线边框

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Vue中,要创建下划线样式输入框,我们可以使用CSS样式来实现。 首先,在组件的template中创建一个input元素,给它一个唯一的id,并绑定一个v-model指令,将输入的值绑定到组件的data属性中。 然后,在组件的style标签中,我们可以使用CSS来定义下划线样式。可以使用伪元素`::after`来实现下划线的效果。 例如,使用以下的HTML和CSS代码可以创建一个下划线样式输入框: ```html <template> <div class="underline-input"> <input type="text" id="input" v-model="inputValue" /> <label for="input">请输入内容</label> </div> </template> <style> .underline-input { position: relative; } input { width: 100%; padding: 10px; border: none; border-bottom: 1px solid black; outline: none; // 可选 } input:focus { border-color: blue; // 可选,获得焦点时改变下划线颜色 } input + label { position: absolute; left: 0; bottom: 10px; transition: all 0.3s ease; pointer-events: none; // 可选,防止标签干扰输入 } input:focus + label, input:not(:placeholder-shown) + label { transform: translateY(-25px); // 根据需求调整标签的位置 font-size: 14px; // 根据需求调整标签的字体大小 color: blue; // 可选,获得焦点或输入内容时改变标签的颜色 } label { font-size: 16px; color: gray; // 可选,初始标签颜色 } </style> ``` 以上代码会创建一个带有下划线样式输入框。当输入框获得焦点或输入内容时,输入框下方的下划线会变为蓝色,标签会上移并改变颜色。你可以根据需要调整样式和动画效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值