ul li a
a
.example a
div a
.example a
div a
a
ul li a
<a>
element with a "title" attribute?1) .nav {...}
2) nav {...}
3) #nav {...}
1) An element with an ID of "nav"
2) A nav element
3) An element with a class of "nav"
They all target the same nav element.
1) An element with an class of "nav"
2) A nav element
3) An element with a id of "nav"
1) An element with an class of "nav"
2) A nav element
3) An div with a id of "nav"
rgba()
value?rgba()
value applies transparency to the background color only.rgba()
value specifies the level of transparency of an element, as a whole, including its content.rgba()
value applies transparency to the background color only.rgba()
value specifies the level of transparency of the parent element only.<nav>
element is an example of an inline element. <header>
is an example of a block element.<span>
is an example of a block element. <div>
is an example of an inline element..grid { display: grid; width: 500px; 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; }
1. External; CSS is written in a separate file.
2. Inline; CSS is added to the <head> of the HTML page.
3. Internal; CSS is included within the HTML tags.
1. External; CSS is written in a separate file and is linked within the <header> element of the HTML file.
2. Inline; CSS is added to the HTML tag.
3. Internal; CSS is included within the <header> element of the HTML file.
1. External; CSS is written in a separate file and is linked within the <head> element of the HTML file.
2. Internal; CSS is included within the <header> element of the HTML file.
3. Inline; CSS is added to the HTML tag.
1. External; CSS is written in a separate file and is linked within the <head> element of the HTML file .
2. Inline; CSS is added to the HTML tag.
3. Internal; CSS is included within the <head> element of the HTML file.
a:active { color: pink; }
p { color: #000000; }
"p" is the selector
"#000000" is the property
"color" is the value
"p" is the selector
"color" is the property
"#000000" is the value
"color" is the selector
"#000000" is the property
"#p" is the value
"color" is the selector
"p" is the property
"#000000" is the value
@media (min-width: 1024px), screen and (orientation: landscape) { … }
<div style="margin-bottom: 2rem;">Div 1</div> <div style="margin-top: 2rem;">Div 2</div>
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>
display:none
and visibility:hidden
?Both will hide the element on the page, but display:none has greater browser support. visibility:hidden is a new property and does not have the best browser support
display:none hides the elements but maintains the space it previously occupied. visibility:hidden will hide the element from view and remove it from the normal flow of the document
display:none hides the element from view and removes it from the normal flow of the document. visibility:hidden will hide the element but maintains the space it previously occupied.
There is no difference; both will hide the element on the page
font-weight: 400; font-weight: 700;
.grid { display: grid; grid-template-columns: 50px 1fr 2fr; }
li:nth-child(3 + 2n) { margin: 0 5 px; }
li:nth-child(3n + 2) { margin: 0 5 px; }
li:nth-child(2), li:nth-child(5), li:nth-child(8) { margin: 0 5 px; }
li:nth-child(2n + 3) { margin: 0 5 px; }
@font-face { font-family: 'Avenir', sans-serif; src: url('avenir.woff2') format('woff2'), url('avenir.woff') format('woff'); }
.example{ margin-left: calc(5% + 5px); }
<a>
tag containing the title attribute?.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>