NEW
Font size
WorksheetsCss questions
Total questions: 20
Worksheet time: 20mins
What is the default value of the position property in CSS?
absolute
absolute
static
fixed
Which CSS property is used for changing the text color?
font-color
color
text-color
text-style
What does the CSS property opacity control?
Element transparency
Border thickness
Background color
Text shadow
Which CSS property is used for creating rounded corners?
border-radius
corner-radius
curve-border
round-corner
How can you center an element horizontally in CSS?
text-align: center
margin: auto
position: center
align: center
Which CSS property is used to set the spacing between lines of text?
letter-spacing
text-spacing
line-height
word-spacing
What is the purpose of the CSS property z-index?
Define the stacking order of elements
Set the font size
Adjust the element's width
Control the transparency of an element
How can you hide an element in CSS without affecting the layout?
opacity: 0
visibility: hidden
hidden: true
display: none
What does the CSS property margin: auto; do?
Centers the element horizontally and vertically within its container.
Adds equal margins to all sides of the element.
Only adds a top margin to the element.
Does not affect the element's margin.
How can you set a background image in CSS?
background-color: image-url('background.jpg');
image: url('background.jpg');
background-image: url('background.jpg');
bg-image: 'background.jpg';
What does the CSS property position: relative; do?
Positions the element relative to its normal position in the document flow
Aligns the element to the right of its container.
Fixes the element's position to the viewport.
Removes the element from the document flow.
What does the CSS property overflow: hidden; do?
Expands the element to fill the entire viewport.
Clips any content that overflows the element's box.
Adds a shadow to the element
Makes the element's content visible outside its box.
What does the CSS property overflow: hidden; do?
Expands the element to fill the entire viewport.
Clips any content that overflows the element's box.
Adds a shadow to the element
Makes the element's content visible outside its box.
How can you hide an element from the screen but keep it accessible for screen readers?
visibility: hidden;
display: none;
opacity: 0;
position: absolute; left: -9999px;
How can you set the background color of an element to a transparent value?
background-color: transparent;
background: none;
background-opacity: 0;
opacity: 0;
How do you select all <p> elements that are children of a <div> using CSS?
div p {}
div > p {}
div ~ p {}
div + p {}
What does the CSS property box-sizing: border-box; do?
Adds padding and border to the content width.
Includes padding and border within the element's total width.
Removes padding and border from the element.
Sets the size of the element's box to zero.
How can you vertically align an inline element?
vertical-align: middle;
margin-top: auto; margin-bottom: auto;
position: relative; top: 50%; transform: translateY(-50%);
line-height: 2;
How can you apply a shadow to text in CSS?
Using the font-shadow: 1px 1px #888; property.
Using the text-shadow property.
Applying the shadow: 2px 2px 2px #000; property.
Utilizing the box-shadow property.
