CS 102 CSS Practice Test
25 Questions
100 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does CSS stand for?

Cascading Style Sheets

What is the correct HTML for referring to an external style sheet?

Where in an HTML document is the correct place to refer to an external style sheet?

In the section

Which HTML tag is used to define an internal style sheet?

<style> Signup and view all the answers

Which HTML attribute is used to define inline styles?

<p>style</p> Signup and view all the answers

Which is the correct CSS syntax?

<p>body {color: black;}</p> Signup and view all the answers

How do you insert a comment in a CSS file?

<p>/* comment */</p> Signup and view all the answers

Which property is used to change the background color?

<p>background-color</p> Signup and view all the answers

How do you add a background color for all

elements?

<p>h1 {background-color: #FFFFFF;}</p> Signup and view all the answers

Which CSS property is used to change the text color of an element?

<p>color</p> Signup and view all the answers

Which CSS property controls the text size?

<p>font-size</p> Signup and view all the answers

What is the correct CSS syntax for making all the

elements bold?

<p>p {font-weight: bold;}</p> Signup and view all the answers

How do you display hyperlinks without an underline?

<p>a {text-decoration: none;}</p> Signup and view all the answers

How do you make each word in a text start with a capital letter?

<p>text-transform: capitalize;</p> Signup and view all the answers

Which property is used to change the font of an element?

<p>Both font-family and font can be used</p> Signup and view all the answers

How do you make the text bold?

<p>font-weight: bold;</p> Signup and view all the answers

How do you display a border like this: The top border = 10 pixels, The bottom border = 5 pixels, The left border = 20 pixels, The right border = 1 pixel?

<p>border-width: 10px 1px 5px 20px;</p> Signup and view all the answers

Which property is used to change the left margin of an element?

<p>margin-left</p> Signup and view all the answers

When using the padding property, are you allowed to use negative values?

<p>False</p> Signup and view all the answers

How do you make a list that lists its items with squares?

<p>list-style-type: square;</p> Signup and view all the answers

How do you select an element with id 'demo'?

<p>#demo</p> Signup and view all the answers

How do you select elements with class name 'test'?

<p>.test</p> Signup and view all the answers

How do you select all

elements inside a

element?

<p>div p</p> Signup and view all the answers

How do you group selectors?

<p>Separate each selector with a comma</p> Signup and view all the answers

What is the default value of the position property?

<p>static</p> Signup and view all the answers

Study Notes

CSS Basics

  • CSS stands for Cascading Style Sheets, used for styling HTML documents.
  • External Style Sheet is referred to in HTML using the <link> tag within the <head> section: <link rel="stylesheet" type="text/css" href="style.css">.

Where to Place Styles

  • The correct place to include an external style sheet is within the <head> section of an HTML document.
  • Internal styles are defined using the <style> tag, also placed in the <head> section.

Inline and Internal Styles

  • The inline style attribute in HTML is defined using the style attribute, e.g., <p style="color:red;">Text</p>.
  • CSS Syntax for styles includes selectors followed by property-value pairs, e.g., body {color: black;}.

CSS Properties and Values

  • Inline comments in CSS are inserted using /* comment here */.
  • The background-color property changes the background color of an element.
  • The syntax h1 {background-color:#FFFFFF;} applies a white background to all <h1> elements.

Text and Font Styles

  • The color property modifies the text color of an element.
  • Font-size decides the text size of an element, e.g., p {font-size:16px;}.
  • To make all <p> elements bold, use the syntax: p {font-weight:bold;}.
  • The rule a {text-decoration:none;} removes underlines from hyperlinks.
  • The text-transform property with the value capitalize makes the first letter of each word uppercase, e.g., text-transform:capitalize;.

Font Customization

  • Properties font-family and font can both be used to change an element's font.
  • To make text bold, use font-weight:bold;.

Borders and Margins

  • Border-width can be specified using the syntax border-width:10px 1px 5px 20px; for top, right, bottom, and left respectively.
  • margin-left property adjusts the left margin of an element.

Padding and List Styles

  • Negative values are not allowed for the padding property.
  • To create a list with square bullet points, use: list-style-type: square;.

Selectors in CSS

  • To select an element with the id "demo", use #demo.
  • To select elements with class name "test", write .test.
  • div p selects all <p> elements inside a <div>.
  • Group selectors by separating them with commas, e.g., h1, h2, h3 {color:blue;}.

Positioning

  • The default value of the position property in CSS is static.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge about Cascading Style Sheets (CSS) with this CS 102 practice quiz. Covering essential questions about external and internal styles, this quiz is perfect for students looking to solidify their understanding of CSS in web development. Challenge yourself and prepare for your upcoming tests!

More Like This

HTML and CSS Web Development Quiz
3 questions
CSS Properties Quiz
6 questions

CSS Properties Quiz

MatchlessThermodynamics avatar
MatchlessThermodynamics
Introduction to CSS: Cascading Style Sheets
12 questions
Use Quizgecko on...
Browser
Browser