Home >Web Front-end >HTML Tutorial >CSS选择器优先级 - 走一趟再说
<span style="color: #800000;"> .a</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">red </span>}<span style="color: #800000;"> .b</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">green </span>}
<span style="color: #800000;"> div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">red </span>}<span style="color: #800000;"> .div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">green </span>}
<span style="color: #800000;"> [data-name='div']</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}<span style="color: #800000;"> .a</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}
<span style="color: #800000;"> div[data-name='div']</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}<span style="color: #800000;"> .a</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}
<span style="color: #800000;"> .a</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}<span style="color: #800000;"> #div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}
<span style="color: #800000;"> [data-name='div']</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}<span style="color: #800000;"> #div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}
<span style="color: #800000;"> div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}<span style="color: #800000;"> #div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}
<span style="color: #800000;"> div</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;">blue </span>}<span style="color: #800000;"> [data-name='div']</span>{<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> red </span>}