input输入框对伪类(after,before)支持情况

input 对伪元素(:before :after)的支持情况

伪类是个很便捷的元素,今天写东西的时候,突然发现没效果,后来发现input对伪类也有不支持的,记录一下。


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	<style>
		input:before {
			content: '';
			display: block;
			width: 10px;
			height: 10px;
			background-color: #000;
		}
		input:after {
			content: "";
			display: block;
			width: 15px;
			height: 15px;
			background-color: #f00;
		}
		div{
			padding: 10px 0;
		}
	</style>
</head>
<body>
	<div>button <input type="button"></div>
	<div>color <input type="color"></div>
	<div>date <input type="date"></div>
	<div>datetime-local <input type="datetime-local"></div>
	<div>email <input type="email"></div>
	<div>file <input type="file"></div>
	<div>hidden <input type="hidden"></div>
	<div>image <input type="image"></div>
	<div>month <input type="month"></div>
	<div>number <input type="number"></div>
	<div>passwork <input type="password"></div>
	<div>range <input type="range"></div>
	<div>reset <input type="reset"></div>
	<div>search <input type="search"></div>
	<div>submit <input type="submit"></div>
	<div>text <input type="text"></div>
	<div>tel <input type="tel"></div>
	<div>time <input type="time"></div>
	<div>number <input type="number"></div>
	<div>url <input type="url"></div>
	<div>week <input type="week"></div>
	<div>datetime <input type="datetime"></div>
	<div>checkbox <input type="checkbox"></div>
	<div>radio <input type="radio"></div>	
</body>
</html>


after 的颜色是红色 #f00
before 的颜色是黑色 #000
再来看一下效果,在Windows chorme 打开
在这里插入图片描述
我们可以看到很多类型的input都不支持伪类,buttom 、 number 、text 、 email 等等。

Chore保存网页
注:本文只针对Chrome浏览器。
打开 Chrome 浏览器,找到需要截图的页面
在该页面右键,选择检查(F12);
打开命令行:‘Ctrl’+‘Shift’+‘P’(Windows),‘Alt’+‘Command’+‘I’(Mac);
命令行输入Screen,在模糊匹配的列表里面选择 ‘Capture full size screenshot’ 。

  • 9
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值