You are designing a responsive website and want a box to always be 10% of the viewport width. Which CSS value would you use?
- %
- em
- px
- vw
To make a box 10% of the viewport width, you should use the 'vw' (viewport width) unit. The 'vw' unit is based on the width of the viewport, making it ideal for responsive design. It ensures the box is always a percentage of the viewport's width, regardless of the screen size.
Loading...
Related Quiz
- What is the main advantage of using SCSS over plain CSS?
- You want to overlay a button on top of an image. The button should be at the bottom right corner of the image. How would you position the button using CSS?
- The ::first-letter pseudo-element in CSS targets the ________ of a block-level element.
- What is the difference between the em and rem units when setting font size in CSS?
- In a React application, you are tasked with styling a button that changes its background color based on a prop passed to it. Which CSS-in-JS library would be ideal for this?