html5第八课时,属性选择器

来源:互联网 发布:yum安装nginx 编辑:程序博客网 时间:2024/05/18 11:36
<!DOCTYPE html><html><head lang="en">    <meta charset="UTF-8">    <title>属性选择器</title>    <style>        img[alt="123"]{        /*alt也可以没有值,如果只有alt代表所有带alt属性的都会变化,*/            margin: 30px;        }
/*[abc^="def"]  选择 abc 属性值以 "def" 开头的所有元素  [abc$="def"] 选择 abc 属性值以 "def" 结尾的所有元素  [abc*="def"] 选择 abc 属性值中包含子串 "def" 的所有元素*/
img[alt^="2"]{ margin: 50px; } img[alt$="3"]{ border: 1px #585858 solid; } img[alt$="4"]{ border: 1px red dashed; } img[alt*="23"] { border-radius: 20px; } </style></head><body><img src="../../image/lunzi.png" alt="123"/><img src="../../image/lunzi.png" alt="234"/></body></html>
0 0