<style> .demo a{ float: left; display: block; height: 50px; width: 50px; border-radius:10px;/*边框圆角化*/ background: #ffbaad; text-align: center; text-decoration: none; margin-right: 5px; font: bold 20px/50px Arial; /*加粗 字体大小/行高 family:字体类型*/ } /*存在id属性的元素 a[]{}*/ a[id]{ /*改变用有id属性的a的元素*/ } a[id=first]{ /*改变id为fist的a的元素*/ } /* =是觉对等于*/ /* *=是包含这个元素*/ /*^=是包含以这个开头的*/ /*$=是包含以这个结尾的*/ a[class="links item"]{ /*改变class属性等于links item的a的元素*/ background: red; } a[class*="rrr"]{ /*改变class属性包含 item的a的元素*/ background: #5dff3e; } a[href^=http]{ background: #b3d4fc; } a[href$=com]{ background: #3b54fc; } </style>
属性选择器
最新推荐文章于 2024-05-14 20:08:50 发布