ul li a
a
.example a
div a
.example adiv aaul li a<a> 元素?a[title]{...}a > title {...}a.title {...}a=title {...}注意:以下问题的替代问题。
<a> 标签中包含 title 属性的 CSS 选择器是什么?a[title]a > titlea=titlea.title注意:上述问题的替代问题。
1) .nav {
...;
}
2) nav {
...;
}
3) #nav {
...;
}
它们都针对相同的 nav 元素。rgba() 值的 background 属性有什么区别?rgba() 值的 background 仅对背景颜色应用透明度。rgba() 值的 background 指定整个元素的透明度,包括其内容。rgba() 值的 background 仅对背景颜色应用透明度。rgba() 值的 background 仅指定父元素的透明度。<nav> 元素是内联元素的一个例子。<header> 是块级元素的一个例子。<span> 是块级元素的一个例子。<div> 是内联元素的一个例子。.grid {
display: grid;
width: 500px;
grid-template-columns: 50px 1fr 2fr;
}
注意:以下问题的替代问题。
.grid { display: grid; grid-template-columns: 50px 1fr 2fr; }
注意:上述问题的替代问题。
注意:以下问题的替代问题。
注意:上述问题的替代问题。
background: blue url(image.jpg) no-repeat scroll 0px 0px;
background-color: blue;
background-image: url(image.jpg);
background-repeat: no-repeat;
background-attachment: scroll;
background-position: 0px 0px;
background-color: blue;
background-img: URL(image.jpg);
background-position: no-repeat;
background-scroll: scroll;
background-size: 0px 0px;
background-color: blue;
background-src: URL(image.jpg);
background-repeat: no-repeat;
background-wrap: scroll;
background-position: 0px 0px;
background-color: blue;
background-src: URL(image.jpg);
background-repeat: no-repeat;
background-scroll: scroll;
background-position: 0px 0px;
.example {
color: yellow;
}
ul li a {
color: blue;
}
ul a {
color: green;
}
a {
color: red;
}
<ul>
<li><a href="#" class="example">link</a></li>
<li>list item</li>
<li>list item</li>
</ul>
注意:以下问题的替代问题。
注意:上述问题的替代问题。
line-height: 20px;
line-height: 2;
<section>
<p>paragraph one</p>
</section>
<p>paragraph two</p>
section p {
color: red;
}
section + p {
color: blue;
}
<svg>、<line> 和 <ellipse>)进行编码。a:active {
color: pink;
}
p::first-letter { color: red; }p:first-letter { color: red; }first-letter::p { color: red; }first-letter:p { color: red; }p {
color: #000000;
}
A “p” is the selector “#000000” is the property “color” is the value
B “p” is the selector “color” is the property “#000000” is the value
C “color” is the selector “#000000” is the property “#p” is the value
D “color” is the selector “p” is the property “#000000” is the value
rem { font-size: 1px; }corner-radius: 10px;border-corner: 10px;corner-curve: 10px;border-radius: 10px;@media (min-width: 1024px), screen and (orientation: landscape) { … }
color: #000color: rgb(0,0,0)color: #000000color: 000000<div style="margin-bottom: 2rem;">Div 1</div>
<div style="margin-top: 2rem;">Div 2</div>
flex-flow: column; 或 flex-direction: column;flex-flow: column;flex-column: auto;flex-direction: column;
flex-direction: row;flex-direction: row-reverse;flex-direction: column;flex-direction: column-reverse;flex-direction: row-reverse;flex-direction: row;flex-direction: column-reverse;flex-direction: column;flex-direction: row;flex-direction: row-reverse;flex-direction: column;flex-direction: reverse-column;flex-direction: column;flex-direction: column-reverse;flex-direction: row;flex-direction: row-reverse;h2 ~ p {
color: blue;
}
h2 + p {
background: beige;
}
<section>
<p>paragraph 1</p>
<h2>Heading</h2>
<p>paragraph 2</p>
<p>paragraph 3</p>
</section>
注意:以下问题的变体。
h2 ~ p {
color: blue;
}
<section>
<p>P1</p>
<h2>H2</h2>
<p>P3</p>
<p>P4</p>
</section>

justify-content: space-around;justify-content: center;justify-content: auto;justify-content: space-between;display:none 和 visibility:hidden 之间有什么区别?element:hover {scale: 0.5;}element:hover {transform: scale(0.5);}element:hover {scale: 50%;}element:hover {transform: scale(50%);}font-weight: 400;
font-weight: 700;
li:nth-child(3 + 2n) {
margin: 0 5px;
}
li:nth-child(3n + 2) {
margin: 0 5px;
}
li:nth-child(2),
li:nth-child(5),
li:nth-child(8) {
margin: 0 5px;
}
li:nth-child(2n + 3) {
margin: 0 5px;
}
a[href="#"] {...}a[href~="#"]a[href^="#"]a[href="#"]padding: 10px 10px 0px 0px;padding: 10px 0px;padding: 10px 0;padding: 10px 0px 10px 0px;@font-face {
font-family: 'Avenir', sans-serif;
src:
url('avenir.woff2') format('woff2'),
url('avenir.woff') format('woff');
}
position: absolute;display: flex;display: block;float: left;.example {
margin-left: calc(5% + 5px);
}
.logo { position: absolute; left: 100px; top: 150px; }.logo { position: absolute; margin-left: 100px; margin-top: 150px; }.logo { position: absolute; padding-left: 100px; padding-top: 150px; }.logo { position: absolute; left-padding: 100px; top-padding: 150px; }p:first-of-type {
color: red;
}
p {
color: blue;
}
.container {
color: yellow;
}
p:first-child {
color: green;
}
<div class="container">
<h1>Heading</h1>
<p>Paragraph1</p>
<p>Paragraph2</p>
</div>
::placeholder 伪元素的用途是什么?:)或双冒号(::)表示法,例如 ::before 和 :before,以下哪项陈述是正确的?::)以在伪元素和伪类之间创建一致性。对于较新的浏览器,使用双冒号表示法。对于 IE8 及以下版本,使用单冒号表示法(:)。::)来区分伪元素和伪类。然而,现代浏览器支持两种格式。较旧的浏览器(如 IE8 及以下版本)不支持。___。color: red; /* declaration A */
font-size: 1em; /* declaration B */
padding: 10px 0; /* declaration C */
a:link {
background: #0000ff;
}
a:hover {
background: rgba(0, 0, 255, 0.5);
}
a {
color: blue;
}
a:hover {
background: white;
}
a:link {
background: blue;
}
a:hover {
color: rgba(0, 0, 255, 0.5);
}
a:hover {
background: rgba(blue, 50%);
}
a:link {
background: rgba(blue);
}
div.sidebar {}* {}div#sidebar2 p {}.sidebar p {}body {
background: #ffffff; /* white */
}
section {
background: #0000ff; /* blue */
height: 200px;
}
!elevate!*primeoverride!important___ 伪类为点击过的链接设置不同的颜色。a:visiteda:hovera:linka:focusbackground-color: #aaa;background-color: #999999;background-color: rgba(170,170,170,0.5);background-color: rgba(170,170,170,0.2);."header clear" {}header#clear {}.header.clear {}.header clear {}___ 指定的。'h1' 是 ___,而 'color' 是 ___。h1 {
color: red;
}
font-weight: bold;
font-weight: 400;font-weight: medium;font-weight: 700;font-weight: Black;HTML {
font-size: 10px;
}
body {
font-size: 2rem;
}
.rem {
font-size: 1.5rem;
}
.em {
font-size: 2em;
}
<body>
<p class="rem"></p>
<p class="em"></p>
</body>
font-styletext-transformfont-variantletter-spacing.element {cursor: pointer;}.element {cursor: hand;}.element {cursor: move-hand;}.element {cursor: pointer-hand;}background-position: 10% 50%;
grid-template-columns: 2fr 1fr;
<img id="photo" alt="" src="..." />
img#photo:hover {scale: 0.5;}img#photo:hover {transform: scale(0.5);}img#photo {hover-scale: 0.5;}img#photo:hover {size: smaller;}A. border-radius: 10px 10px 0 0;
B. border-top-left-radius: 10px; and border-top-right-radius: 10px;
C. border-radius: 10px 0;
D. border-top-radius: 10px;
<section>
<p class="example">...</p>
</section>
1. section * {...}
2. [class*='example'] {...}
3. p.example {...}
4. section p {...}
1. p {...}
2. p.example {...}
3. section p {...}
4. [class*='example'] {...}
1. p.example {...}
2. section p {...}
3. [class*='example'] {...}
4. section * {...}
1. p {...}
2. section p {...}
3. [class*='example'] {...}
4. p.example {...}
input[type="text"]:not([disabled]) {...}input[type="text"]:not("disabled") {...}input[type*="text"]:not([disabled="disabled"]) {...}input[type="text"]:not([type="disabled"]) {...}input[type="text"] 选择所有类型为文本的输入,:not([disabled]) 选择所有没有 “disabled” 属性的元素。结合两者,只选择类型为 “text” 且没有 “disabled” 属性的输入元素。
background-color: hsl(0, 0, 0, 0.5);background-color: rgbx(0, 0, 0, 0.5);background-color: rgba(0, 0, 0, 0.5);background-color: rgba(0, 0, 0, 1);rgba 是 CSS 中的一个函数。rgba 代表红色、绿色、蓝色和 alpha。alpha 的值可以在 0 到 1 之间(包括 0 和 1),其中 0 表示完全透明,1 表示完全不透明。
<header> 元素内的标题?<header>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
</header>
<h2>Heading 2</h2>
header h1, header h2 {...}header h1 + header h2 {...}header h1, h2 {...}h1, h2 {...}.container {
display: flex;
}
.item {
border: 1px solid red;
flex-direction: row-reverse;
}
transition: margin 1000ms ease-in-out;transition: color 1.3s ease-in;transition: position 400ms linear;transition: opacity 1s ease-in;article p {
color: blue;
}
article > p {
color: green;
}
<article>
<p>Paragraph 1</p>
<aside>
<p>Paragraph 2</p>
</aside>
</article>
border: 1px solid red;
border-size: 1px;
border-style: solid;
border-color: red;
border-size: 1px;
border-type: solid;
border-color: red;
border-width: 1px;
border-style: solid;
border-color: red;
border-width: 1px;
border-line: solid;
border-color: red;
_。section {
color: gray;
}
<section>
<p>paragraph</p>
<a href="#">link</a>
</section>
.header {...}header {...}#header {...}header > h1 {...} a
a:hover
:link
:visited
:hover
:active
:focus
:active
:focus
:hover
:link
:visited
:link
:visited
:focus
:hover
:active
section * psection + psection ~ psection > pul {
--color: red;
}
p {
color: var(--color);
}
a {
color: var(--color, orange);
}
<p>Paragraph</p>
<ul>
<li>
<a href="#">list item a link </a>
</li>
<li>list item</li>
</ul>
.example {
width: 800px;
margin: 0 auto;
}
10vw = ?px
10vh = ?px
10vmin = ?px
10vmax = ?px
p:first-of-type:first-letter {
color: red;
}
<body>
<p>Paragraph 1.</p>
<p>Paragraph 2.</p>
<article>
<h1>Heading</h1>
<p>Paragraph 3.</p>
<p>paragraph 4.</p>
</article>
<section>
<p>Paragraph 5.</p>
<p>Paragraph 6.</p>
</section>
</body>
a[href$='domain.com'] {
color: pink;
}
a[href='*domain.com'] {
color: pink;
}
a[href*='domain.com'] {
color: rgba(255, 155, 155);
}
a[href*='domain.com'] {
color: pink;
}
background: linear-gradient(#648880, #293f50);background-image: linear(#648880, #293f50);background: gradient(linear, #648880, #293f50);background-color: linear-gradient(#648880, #293f50);.glyphicon-bgcircle {
circle-radius: 50%;
margin: 50px;
background-color: #fdadc6;
color: rgba(255, 255, 255, 1);
font-size: 24px;
}
glyphicon-bgcircle {
border-circle: 50%;
padding: 50px;
background-color: #fdadc6;
color: rgba(255, 255, 255, 1);
font-size: 24px;
}
.glyphicon-bgcircle {
border-radius: 50%;
padding: 50px;
background-color: #fdadc6;
color: rgba(255, 255, 255, 1);
font-size: 24px;
}
.glyphicon-bgcircle {
radius-rounded: 50%;
margin: auto;
background-color: #fdadc6;
color: rgba(255, 255, 255, 1);
font-size: 24px;
}
A. font-size: xsmall
B. font-size: 50%
C. font-size: 1em
D. font-size: 20px

<style>
.container {
position: relative;
height: 200px;
width: 200px;
border: 1px solid black;
}
</style>
<div class="container"><div class="overlay"></div></div>
.overlay {
position: static;
top: 200px;
bottom: 200px;
right: 200px;
left: 200px;
background-color: rgba(0, 0, 0, 0.5);
}
.overlay {
position: absolute;
top: 200px;
bottom: 200px;
right: 200px;
left: 200px;
background-color: rgba(0, 0, 0, 0.5);
}
.overlay {
position: static;
top: 0;
bottom: 0;
right: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
<div class="container">
<img src="grumpy-cat.gif" />
<p>The z-index property is cool!</p>
</div>
img {
position: absolute;
left: 0px;
top: 0px;
// Missing line
}
z-index: 1;z-index: -1;z-index: 0;z-index: true;font-size: reduce;font-size: 8px;font-size: -1em;font-size: smaller;<span class="highlight">#BLM</span>
.highlight {
background-color: yellow;
}
#highlight {
background-color: yellow;
}
.highlight {
color: yellow;
}
#highlight {
color: yellow;
}
background-repeat: no-repeat;
background-repeat: fixed;
background-repeat: none;
background-tile: none;
transform: rotate(-30deg);transform: rotate(30deg);rotate: 30deg;spin: 30deg;background-image: file('wood.png');background-image: url('wood.png');background-image: wood.png;image: wood.png<section><p>paragraph one</p></section><p>paragraph two</p>
section > p {
color: blue;
}
p {
color: blue;
}
section + p {
color: blue;
}
p + section {
color: blue;
}
transform: translateX(-100px)transform: translateY(-100px)transform: translateY(100px)transform: translateX(100px)<div> 在外层 <div> 中水平居中?<div id="outer">
<div id="inner">Center Me!</div>
</div>
#inner {
width: 50%;
}
#outer {
width: 100%;
}
#inner {
left: 0;
right: 0;
position: center;
}
#inner {
text-align: center;
}
#inner {
width: 50%;
margin: 0 auto;
}
.pen {
height: 100px;
width: 100px;
border: 2px dashed brown;
position: relative;
}
#puppy {
position: absolute;
right: 80px;
bottom: 0px;
}
<div class="pen">
<span id="puppy">🐶</span>
</div>
<a> 元素添加 hover 伪类?a:hover {...}a :hover {...}a.hover {...}a hover {...} <style>
#cellar-door {
box-shadow: 3px 5px 10px #000;
}
.text-shadow {
text-shadow: 3px 5px 10px #000;
}
</style>
<h1 _____> Cellar Door</h1>
class="text-shadow"id="cellar-door"id="text-shadow"class="cellar-door"-- 此行已取消。/* 此行已取消。 */// 此行已取消。# 此行已取消。 h2 ~ p {
color: blue;
}
<section>
<p>P1</p>
<h2>H2</h2>
<p>P3</p>
<p>P4</p>
</section>
a:visited {
...;
}
a:active {
...;
}
a:hover {
...;
}
a:focus {
...;
}
:visited 样式在链接被打开后应用。
:active 样式在鼠标点击并按住时应用。
:hover 样式在鼠标悬停或点击并按住时应用。
:focus 样式在使用键盘 Tab 键导航链接时应用。:visited 样式在链接被打开后应用。
:active 样式在鼠标点击时应用。
:hover 样式在鼠标悬停时应用。
:focus 样式在鼠标点击并按住或使用键盘 Tab 键导航链接时应用。:visited 样式在链接被打开后应用。
:active 样式仅在鼠标点击时应用,且在鼠标释放前。
:hover 样式在鼠标悬停时应用。
:focus 样式在使用键盘 Tab 键导航链接时应用。:visited 样式在鼠标按住时应用。
:active 样式在链接被打开时应用。
:hover 样式在鼠标悬停时应用。
:focus 样式在使用键盘 Tab 键导航链接时应用。input.valid[false] {
color: red;
}
input:invalid {
color: red;
}
input.not(valid) {
color: red;
}
input.invalid {
color: red;
}
img {
transform: grayscale(1);
}
img {
filter: grayscale(0);
}
img {
transform: grayscale(0);
}
img {
filter: grayscale(1);
}
.logo {
position: absolute;
padding-left: 100px;
padding-top: 150px;
}
.logo {
position: absolute;
left: 100px;
top: 150px;
}
.logo {
position: absolute;
left-padding: 100px;
top-padding: 150px;
}
.logo {
position: absolute;
margin-left: 100px;
margin-top: 150px;
}
<div> 在其容器内会如何定位?<style>
.container {
height: 200px;
width: 200px;
}
.child {
margin: auto 0;
height: 100px;
}
</style>
<div class="container">
<div class="child">...</div>
</div>
header {
grid-column: 1 / auto;
}
header {
grid-column: 1/-1;
}
header {
grid-column: -1/1;
}
header {
grid-column: 1/100%;
}
align-items: start;
justify-items: end;
align-items: center;
justify-items: center;
align-items: middle;
justify-items: middle;
align-items: stretch;
justify-items: stretch;
align-items 参考 justify-items 参考
input.valid[false] {
color: red;
}
input:invalid {
color: red;
}
input.not(valid) {
color: red;
}
input.invalid {
color: red;
}
@import@link@insert@style<style>
#tall-text {
display: inline;
font-size: 20px;
height: 200px;
}
</style>
<p id="tall-text">Did I grow?</p>

row: 3; column: 3;grid-row: 3; grid-column: 3;row: 2; column: 2;grid-row: 2; grid-column: 2;var(--name, value)var(--name)var(value)<link rel="stylesheet" type="text/css" href="mystyle.css"><stylesheet>mystyle.css</stylesheet><style src= "mystyle.css">| 参考资料:HTML link 标签 | HTML Link 标签语法 |
div pdiv > pdiv + pdiv ~ p参考资料:CSS visibility 属性 - W3Schools
参考资料:CSS outline 属性 - W3Schools
参考资料:CSS text-align 属性 - W3Schools
参考资料:CSS visibility:hidden vs display:none
p.class#id-