通过属性来设置样式

/**一般我们都是通过标签或则类名,id名来设置样式,很少会用属性,那么让大家看看用属性来设置得方便的地方,

form表单中经常用的就是input  button 了,那么这会儿我们就可以用这个来通过属性给他改变样式了,

*/

/**效果图

 
*/
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        [title]{
            color: orchid;
        }
        [title=我是h1]{
            border: 1px solid #000000;
        }
        input[type=text]{
            padding-left: 10px;
            color: red;
        }
        input[type=button]{
            color:white;
            background: #2ce942;
            border: none;
            outline:none;
        }
        input[value=我是type]{
            border: 3px solid purple;
        }
    </style>
</head>
<body>
<div title="大家好"> 大家好</div>
<h1 title="我是h1"> 我是h1</h1>
<input type="text" value="我是type为text">
<input type="text" value="我是type">
<span>button按钮清除了默认的样式边框和选中后的蓝色边框效果</span>
<input type="button" value="我是type为button">

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值