CSS组合选择器
第01步:创建css:with.css
@charset "utf-8"; /* 组合选择器,用","隔开 */ .a,.b,div span.sp{ background-color:#0F0; color:#F00 } /*span的样式*/ div.di_01{ background-color:#666; color:#606 }
第02步:创建html代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>组合选择器</title> <link href="with.css" rel="stylesheet" type="text/css" /> </head> <body> <a class="b">组合标签01“.b”</a><BR /> <span class="a">组合标签02“.a”</span> <div class="di_01">组合、关联标签03<span class="sp">“div span”<span></div> </body> </html>
时间: 2024-10-12 19:17:25