MCQ on HTML Programming Basics | NIELIT ECC

Advertisement

Q91. Which CSS property controls the visibility of an element without changing its layout?
a) display
b) visibility
c) opacity
d) overflow

Show Answer

Correct Answer: b) visibility
Explanation: The visibility property controls the visibility of an element without affecting its layout. Setting it to hidden makes the element invisible but still occupies space in the layout.

Q92. How do you define a color using RGB values in CSS?
a) color: rgb(r, g, b);
b) color: rgba(r, g, b, a);
c) color: hsl(h, s, l);
d) color: hex(rrggbb);

Show Answer

Correct Answer: a) color: rgb(r, g, b);
Explanation: To define a color using RGB values in CSS, use the rgb(r, g, b) format, where r, g, and b are values for red, green, and blue channels.

Q93. What is the use of the text-align property in CSS?
a) Aligns text horizontally within its container
b) Aligns an element’s position relative to its container
c) Sets the text color
d) Sets the font size

Show Answer

Correct Answer: a) Aligns text horizontally within its container
Explanation: The text-align property in CSS is used to align text horizontally within its container. It can be set to values such as left, right, center, or justify.

Q94. How do you apply a CSS style to an element with a specific ID?
a) #id { style properties }
b) .id { style properties }
c) id { style properties }
d) element#id { style properties }

Show Answer

Correct Answer: a) #id { style properties }
Explanation: To apply a CSS style to an element with a specific ID, use the ID selector with a hash # followed by the ID name (e.g., #id { style properties }).

Q95. How do you create a CSS rule that applies styles to an element when it is being clicked?
a) element:active { style properties }
b) element:focus { style properties }
c) element:hover { style properties }
d) element:visited { style properties }

Show Answer

Correct Answer: a) element:active { style properties }
Explanation: The :active pseudo-class in CSS applies styles to an element when it is being clicked or activated.

Q96. How do you set the maximum width of an element in CSS?
a) max-width: value;
b) width-max: value;
c) max-size: value;
d) size: max-width value;

Show Answer

Correct Answer: a) max-width: value;
Explanation: The max-width property in CSS sets the maximum width of an element. It prevents the element from expanding beyond the specified value.

Q97. How do you add space between elements using CSS?
a) margin
b) padding
c) spacing
d) border

Show Answer

Correct Answer: a) margin
Explanation: The margin property in CSS adds space around elements, outside their border. It is used to create space between elements.

Q98. What is the purpose of the opacity property in CSS?
a) Sets the transparency level of an element
b) Defines the font style of an element
c) Sets the border width of an element
d) Aligns text within an element

Show Answer

Correct Answer: a) Sets the transparency level of an element
Explanation: The opacity property in CSS sets the transparency level of an element. Values range from 0 (completely transparent) to 1 (fully opaque).

Q99. Which CSS property controls the stacking order of elements?
a) z-index
b) stack-order
c) position
d) order

Show Answer

Correct Answer: a) z-index
Explanation: The z-index property controls the stacking order of positioned elements. Higher z-index values appear in front of lower values.

Q100. How do you include an external CSS file in an HTML document?
a) <link rel=”stylesheet” href=”styles.css”>
b) <style src=”styles.css”>
c) <import src=”styles.css”>
d) <css href=”styles.css”>

Show Answer

Correct Answer: a) <link rel=”stylesheet” href=”styles.css”>
Explanation: To include an external CSS file in an HTML document, use the <link> tag with rel=”stylesheet” and href attributes. This links the CSS file to the HTML document.

Advertisement
« Prev1 ... 89 10
error: Content is protected !!
Scroll to Top