CSS CSS Technology Applications 3 — Questions and Answers
Question 1: Which CSS function allows you to perform calculations to determine property values?
- compute()
- calc() (Correct answer)
- math()
- eval()
Correct answer: calc()
The calc() function lets you compute values, mixing units like percentages and pixels.
Question 2: What does 'box-sizing: border-box' change about the box model?
- It removes the border
- Width and height include padding and border (Correct answer)
- It centers the element
- It disables margins
Correct answer: Width and height include padding and border
With border-box, the element's width and height include its padding and border.
Question 3: Which pseudo-class selects an element when a user hovers their mouse over it?
- :focus
- :hover (Correct answer)
- :active
- :visited
Correct answer: :hover
The :hover pseudo-class applies styles when the pointer is over the element.
Question 4: In CSS Grid, which property defines the columns of the grid container?
- grid-rows
- grid-template-columns (Correct answer)
- column-count
- grid-gap
Correct answer: grid-template-columns
grid-template-columns defines the number and size of columns in a grid.
Question 5: What is the highest specificity among these selectors?
- A class selector
- An ID selector (Correct answer)
- An element selector
- The universal selector
Correct answer: An ID selector
ID selectors have higher specificity than class, element, or universal selectors.
Question 6: Which property would you use to make text uppercase without changing the HTML?
- font-variant
- text-transform (Correct answer)
- text-decoration
- font-style
Correct answer: text-transform
text-transform: uppercase converts text to uppercase visually.
Question 7: What does a media query like '@media (max-width: 600px)' do?
- Applies styles when the viewport is at most 600px wide (Correct answer)
- Sets the page width to 600px
- Limits images to 600px
- Applies only to print
Correct answer: Applies styles when the viewport is at most 600px wide
This media query applies its styles only when the viewport width is 600px or less.
Which CSS function allows you to perform calculations to determine property values?