CSS Selectors, Ways to Add CSS, Comments CSS Selectors, Ways to add CSS, and Comments Test your knowledge of CSS Selectors, Ways to Add CSS, and Comments. 1 / 20 Why would you use comments in your CSS code? To explain the purpose of specific styles To add hidden styles To apply a default style 2 / 20 What’s the correct syntax to add a comment in CSS? <!-- Comment --> /* Comment */ // Comment 3 / 20 Where do you typically place an internal CSS block within an HTML document? Inside the tag Inside the tag At the end of the document 4 / 20 Which method of adding CSS is best for maintaining consistent styles across multiple pages of a website? Inline CSS External CSS Internal CSS 5 / 20 Which property controls the visibility of an element without removing it from the document layout? display: none opacity: 0 visibility: hidden 6 / 20 How do you make the text inside an element italic? font-style: italic text-style: italic font-variant: italic 7 / 20 Which property would you use to create space inside an element, between the content and its border? margin padding border-spacing 8 / 20 To set the width of an element to 50% of its parent container, which value would you use? width: 50px width: 50% width: 50em 9 / 20 Which CSS property is used to change the color of text? font-color text-color color 10 / 20 How can you style all <a> elements that have already been visited by the user? a:link a:visisted a:hover 11 / 20 Which selector would you use to apply styles to elements with the attribute type="text"? input[text] input[type="text"] input::text 12 / 20 To style the first paragraph (<p>) element inside a <div>, which selector is correct? div p:first-of-type div:first-child p div p:first-child 13 / 20 Which selector targets elements that are the only child of their parent? :first-child :only-child :last-child 14 / 20 How would you apply a style to all <li> elements that are direct children of an <ul>? ul li ul > li ul + li 15 / 20 Which CSS selector would you use to style an anchor (<a>) tag only when it is hovered over? a:link a:hover a:active 16 / 20 How do you select all elements with a class name active? #active .active active 17 / 20 To apply the same style to all <p> elements on a page, which selector should you use? #p .p p 18 / 20 Which selector would you use to style a specific element with an ID of header? .header #header header 19 / 20 Which of these selectors would you use to target all elements inside a container with a class of box? box * .box * #box * 20 / 20 To apply a quick style directly within an HTML element, which method would you use? Inline CSS Internal CSS External CSS Your score isThe average score is 0% 0% Restart quiz Do you want to learn about selectors, comments, etc? Read our other blogs on CSS. Share on FacebookPost on XFollow usSave You Might Also Like The Box Model in CSS Quiz September 7, 2024 Box Model Quiz: Background and Border Property August 30, 2024 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.