Learn CSS ~ Selectors & Visual Rules CSS Setup and Selectors 2.1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following statements is correct? A. IDs are more specific than classes and tags. B. Multiple classes are more specific than IDs and tags. C. Tags are more specific than IDs and classes. D. Classes are more specific than IDs and tags.

A. IDs are more specific than classes and tags.

The following code attempts to style a paragraph using the <style> tag, but fails to do so. Why? <head> <style> <p style="color:red;">I'm learning to code!</p> </style> </head> A. The contents of the <style> tag must be CSS code, not HTML code. B. The value of the color attribute must be changed to style:red;. C. The style attribute of the <p> element can be removed because the <style> tag replaces it. D. The color attribute must be changed to color-style.

A. The contents of the <style> tag must be CSS code, not HTML code.

What is the most specific selector in the code below? A. p { } B. #side-bar { } C. .main-content { } D. .main-content p { }

B. #side-bar { }

Using a `<style>` tag for CSS code instead of inline styles helps accomplish which of the following? A. There are no significant advantages to using a <style> tag over inline styles. B. A clear separation between a structural language (HTML) and a styling language (CSS). C. A decrease in the amount of time the browser needs to render a web page. D. A better experience for users that visit your web page.

B. A clear separation between a structural language (HTML) and a styling language (CSS).

The following HTML code attempts to use inline styling to change the color of the paragraph text, but fails to do so. Why? <p color="red;">I'm learning to code!</p> A. The value of the color attribute must be changed to style: red;. B. The color attribute is invalid. It should be changed to style and then set equal to color: red;. C. The color red should be set to Red instead. D. The color attribute must be changed to color-style.

B. The color attribute is invalid. It should be changed to style and then set equal to color: red;.

CSS code can be written in an HTML file with which of the following tags? A. <stylesheet> B. <CSS> C. <style> D. <css>

C. <style>

What will be the color of the links after applying the CSS below? body { color: green; } .main-content a { color: blue; } a { color: red !important; } A. Blue B. Green C. Red D. Black

C. Red

Which of the following best describes the concept of CSS selector specificity? A. Specificity refers to whether the !important tag is used. B. Specificity refers to the order in which HTML elements appear in the browser immediately after rendering. C. Specificity refers to how a browser decides which styles to display when there are multiple styles defined for the same element. D. Specificity refers to whether you write an ID, class, or tag selector.

C. Specificity refers to how a browser decides which styles to display when there are multiple styles defined for the same element.

What is the correct syntax to select an HTML element inside another HTML element? A. li.main-list { } B. .main-list, li { } C. .main-list + li { } D. .main-list li { }

D. .main-list li { }

What is the correct syntax to style multiple unrelated selectors? A. p.nav-menu { } B. .nav-menu p { } C. .nav-menu; p { } D. .nav-menu, p { }

D. .nav-menu, p { }

You wish to link a CSS file called **main.css** to an HTML file. Which of the following lines of code correctly links the HTML file and the stylesheet? A. <link href="main.css" type="stylesheet" rel="text/css" /> B. <link href="main.css" type="css/text" rel="stylesheet" /> C. <link href="main.css" type="stylesheet" rel="css/text" /> D. <link href="main.css" type="text/css" rel="stylesheet" />

D. <link href="main.css" type="text/css" rel="stylesheet" />

What is the main difference between inline styles and the <style> tag? A. Inline styles allow you to write CSS in a separate file, whereas the <style> tag embeds CSS directly within HTML opening tags. B. The <style> tag allow you to write CSS in a separate file, whereas inline styles embed CSS directly within HTML opening tags. C. There is no difference between inline styles and the <style> tag. D. Inline styles directly modify HTML elements using a style attribute, whereas the <style> tag allows you to write CSS in a dedicated section of the HTML file.

D. Inline styles directly modify HTML elements using a style attribute, whereas the <style> tag allows you to write CSS in a dedicated section of the HTML file.

Separating HTML and CSS into their own files helps accomplish which of the following? A. A better experience for users that visit your web page. B. Faster loading times for web pages by browsers. C. An approval rating of 'A' from the W3C for your code. D. Separating HTML structure from CSS style to make code easier to read and reuse.

D. Separating HTML structure from CSS style to make code easier to read and reuse.

A stylesheet will not style any HTML code unless which of the following occurs? A. The stylesheet is named using the required style.css filename. B. The stylesheet ends with .style as the file extension. C. The stylesheet contains a CSS document type declaration. D. The stylesheet is linked to the HTML page using a <link> tag.

D. The stylesheet is linked to the HTML page using a <link> tag.


Kaugnay na mga set ng pag-aaral

Module 2 quiz - medical terminology (50 q's but some were duplicates)

View Set

taxes, retirement, and other insurance concepts

View Set

Torts - Strict Liability + Enterprise Liability

View Set