Q81. How do you specify a hover effect for an HTML element in CSS?
a) element:hover { style properties }
b) element:click { style properties }
c) element:focus { style properties }
d) element:active { style properties }
Show Answer
Correct Answer: a) element:hover { style properties }
Explanation: To specify a hover effect for an HTML element in CSS, use the :hover pseudo-class. This applies styles when the user hovers over the element.
Q82. What is the default value of the position property in CSS?
a) relative
b) absolute
c) fixed
d) static
Show Answer
Correct Answer: d) static
Explanation: The default value of the position property in CSS is static. This means the element is positioned according to the normal flow of the document, and top, right, bottom, and left properties do not apply.
Q83. How do you change the font size of an HTML element using CSS?
a) font-size: value;
b) text-size: value;
c) size: value;
d) font: size value;
Show Answer
Correct Answer: a) font-size: value;
Explanation: To change the font size of an HTML element using CSS, you use the font-size property. The value can be in pixels, ems, percentages, or other units.
Q84. Which CSS property is used to set the visibility of an element?
a) display
b) visibility
c) opacity
d) hidden
Show Answer
Correct Answer: b) visibility
Explanation: The visibility property in CSS is used to control the visibility of an element. It can be set to visible, hidden, or collapse (for table elements).
Q85. How do you apply a CSS style to all elements of a specific type on a webpage?
a) element { style properties }
b) .element { style properties }
c) #element { style properties }
d) element, element { style properties }
Show Answer
Correct Answer: a) element { style properties }
Explanation: To apply a CSS style to all elements of a specific type, use the element selector (e.g., p { style properties } to style all <p> elements).
Q86. How do you specify a URL for an image in an HTML document?
a) background-image: url(‘image.jpg’);
b) src: ‘image.jpg’;
c) img src=’image.jpg’
d) url(‘image.jpg’);
Show Answer
Correct Answer: a) background-image: url(‘image.jpg’);
Explanation: To specify a URL for an image in CSS as a background, use the background-image property with the url() function. For <img> elements, you use the src attribute.
Q87. What is the purpose of the float property in CSS?
a) Positions an element to the left or right of its container
b) Aligns text within an element
c) Sets the transparency of an element
d) Defines the width of an element
Show Answer
Correct Answer: a) Positions an element to the left or right of its container
Explanation: The float property in CSS is used to position an element to the left or right of its container, allowing other content to wrap around it.
Q88. How do you create a CSS rule that applies styles to all paragraphs and headings?
a) p, h1, h2, h3 { style properties }
b) p + h1 + h2 + h3 { style properties }
c) p h1 h2 h3 { style properties }
d) p h1, h2, h3 { style properties }
Show Answer
Correct Answer: a) p, h1, h2, h3 { style properties }
Explanation: To create a CSS rule that applies styles to all paragraphs and headings, list the selectors separated by commas (e.g., p, h1, h2, h3 { style properties }).
Q89. Which property is used to set the space between the border and the content of an HTML element?
a) margin
b) padding
c) border-spacing
d) border-width
Show Answer
Correct Answer: b) padding
Explanation: The padding property in CSS sets the space between the border and the content of an HTML element. It controls the internal space within the element.
Q90. How do you create a CSS rule that applies to all elements with a specific class?
a) .classname { style properties }
b) classname { style properties }
c) #classname { style properties }
d) element.classname { style properties }
Show Answer
Correct Answer: a) .classname { style properties }
Explanation: To create a CSS rule that applies to all elements with a specific class, use the class selector with a dot . followed by the class name (e.g., .classname { style properties }).