FROM GOOGLE GEMINI:
CSS (Cascading Style Sheets) Multiple Choice Questions
Q1. What does CSS stand for?
A) Computer Style Sheets
B) Cascading Style Sheets
C) Creative Style Sheets
D) Colorful Style Sheets
Answer: B) Cascading Style Sheets
Q2. Which HTML tag is used to define an internal style sheet?
A)
<script>B)
<css>C)
<style>D)
<design>
Answer: C) <style>
Q3. Which is the correct CSS syntax to change the background color of an element?
A)
background-color: yellow;B)
color: yellow;C)
bg-color: yellow;D)
background: yellow;(Note: Both A and D are valid, butbackground-coloris the property specifically for background color. In standard strict multiple-choice questions, A is the most precise property name).
Answer: A) background-color: yellow;
Q4. How do you insert a comment in a CSS file?
A)
// this is a commentB)
/* this is a comment */C)
<!-- this is a comment -->D)
' this is a comment
Answer: B) /* this is a comment */
Q5. Which CSS property is used to change the text color of an element?
A) text-color
B) fg-color
C) color
D) font-color
Answer: C) color
Q6. Which CSS property controls the text size?
A) font-style
B) text-size
C) font-size
D) text-style
Answer: C) font-size
Q7. How do you select an element with the id "header"?
A)
.headerB)
#headerC)
*headerD)
header
Answer: B) #header
Q8. How do you select elements with the class name "box"?
A)
.boxB)
#boxC)
*boxD)
box
Answer: A) .box
Q9. Which CSS property is used to change the left margin of an element?
A) padding-left
B) indent
C) margin-left
D) spacing-left
Answer: C) margin-left
Q10. What is the default value of the position property in CSS?
A) relative
B) fixed
C) absolute
D) static
Answer: D) static
SOME MORE EXAMPLES:
Here is a comprehensive list of 100 multiple-choice questions (MCQs) on CSS (Cascading Style Sheets), organized by topic. Each question includes the correct answer and a brief explanation to help you master the concepts.
📋 Section 1: Introduction & Syntax (Questions 1–15)
1. What does CSS stand for?
A) Creative Style Sheets
B) Computer Style Sheets
C) Cascading Style Sheets
D) Colorful Style Sheets
Answer: C
Explanation: CSS stands for Cascading Style Sheets. It is used to format the layout of web pages.
2. What is the correct HTML refereeing an external style sheet?
A)
<style src="mystyle.css">B)
<link rel="stylesheet" type="text/css" href="mystyle.css">C)
<stylesheet>mystyle.css</stylesheet>D)
<link src="mystyle.css">
Answer: B
Explanation: The
<link>tag is used inside the<head>section of an HTML document to link an external CSS file using thehrefattribute.
3. Where in an HTML document is the correct place to refer to an external style sheet?
A) At the end of the document
B) In the
<body>sectionC) In the
<head>sectionD) Inside the
<html>tag
Answer: C
Explanation: External stylesheets should always be linked inside the
<head>tag so they load before the body content renders.
4. Which HTML tag is used to define an internal style sheet?
A)
<script>B)
<css>C)
<style>D)
<link>
Answer: C
Explanation: The
<style>tag is used to embed CSS rules directly within an HTML document.
5. Which HTML attribute is used to define inline styles?
A)
stylesB)
classC)
styleD)
font
Answer: C
Explanation: The
styleattribute allows you to apply CSS directly to a single HTML element.
6. Which is the correct CSS syntax?
A)
body {color: black;}B)
{body;color:black;}C)
body:color=black;D)
body:color:black;
Answer: A
Explanation: The standard CSS syntax consists of a selector followed by a declaration block enclosed in curly braces
{}containingproperty: value;pairs.
7. How do you insert a comment in a CSS file?
A)
// this is a commentB)
' this is a commentC)
/* this is a comment */D)
<!-- this is a comment -->
Answer: C
Explanation: CSS comments start with
/*and end with*/. Single-line//comments are not valid in standard CSS.
8. Which property is used to change the background color?
A)
colorB)
background-colorC)
bgcolorD)
background-image
Answer: B
Explanation:
background-colorsets the background color of an element.colorchanges the text color.
9. How do you add a background color for all <h1> elements?
A)
all.h1 {background-color: #FFFFFF;}B)
h1 {background-color: #FFFFFF;}C)
h1.all {background-color: #FFFFFF;}D)
h1 {bg-color: #FFFFFF;}
Answer: B
Explanation: You target all elements of a specific type simply by using their tag name as the selector.
10. Which CSS property is used to change the text color of an element?
A)
text-colorB)
colorC)
fgcolorD)
font-color
Answer: B
Explanation: The
colorproperty is specifically used to define the foreground color (text color) of an element.
11. Which character is used to separate a property and its value in CSS?
A) Comma (
,)B) Semi-colon (
;)C) Colon (
:)D) Period (
.)
Answer: C
Explanation: A colon (
:) separates a property from its value, while a semi-colon (;) terminates a CSS declaration.
12. Which character terminates a CSS declaration?
A) Colon (
:)B) Semi-colon (
;)C) Period (
.)D) Exclamation (
!)
Answer: B
Explanation: Each CSS statement must end with a semi-colon (
;) to separate it from the next rule.
13. Is CSS case-sensitive?
A) Yes
B) No
C) Only for font names
D) Only for color codes
Answer: B
Explanation: CSS is generally case-insensitive, though class names and IDs are case-sensitive because they depend on HTML.
14. What is the extension of a regular CSS file?
A)
.htmlB)
.jsC)
.cssD)
.style
Answer: C
Explanation: External style sheets must be saved with a
.cssfile extension.
15. Which of the following is NOT a valid way to write CSS?
A) Inline CSS
B) Internal CSS
C) External CSS
D) Outline CSS
Answer: D
Explanation: The three valid methods to implement CSS are Inline, Internal (Embedded), and External.
🎯 Section 2: Selectors & Specificity (Questions 16–30)
16. How do you select an element with id "demo"?
A)
.demoB)
#demoC)
*demoD)
demo
Answer: B
Explanation: The
#symbol is used to select elements by theiridattribute.
17. How do you select elements with class name "test"?
A)
#testB)
*testC)
.testD)
test
Answer: C
Explanation: The
.symbol is used to target elements belonging to a specificclass.
18. How do you select all p elements inside a div element?
A)
div.pB)
div pC)
div + pD)
div > p
Answer: B
Explanation: A space denotes a descendant selector, matching all
<p>elements nested anywhere inside a<div>.
19. How do you select all p elements that are the immediate children of a div element?
A)
div pB)
div + pC)
div > pD)
div ~ p
Answer: C
Explanation: The
>combinator selects only direct children, ignoring deeply nested grandchildren.
20. How do you group multiple selectors?
A) Separate each selector with a space
B) Separate each selector with a comma
C) Separate each selector with a plus sign
D) Separate each selector with a slash
Answer: B
Explanation: Commas are used to apply the same CSS ruleset to multiple selectors simultaneously.
21. What is the universal selector in CSS?
A)
#B)
.C)
*D)
@
Answer: C
Explanation: The asterisk (
*) matches any and all elements on a page.
22. Which selector matches an element that is currently being hovered over by the mouse?
A)
:activeB)
:focusC)
:hoverD)
:visited
Answer: C
Explanation: The
:hoverpseudo-class applies styles when the user points to an item without clicking it.
23. Which CSS selector has the highest specificity?
A) Class selector (
.classname)B) ID selector (
#idname)C) Element selector (
p)D) Universal selector (
*)
Answer: B
Explanation: IDs have higher specificity weights than classes, elements, and attributes.
24. What does the selector a[target="_blank"] do?
A) Selects all links
B) Selects all links with a target attribute
C) Selects all links with
target="_blank"D) None of the above
Answer: C
Explanation: This is an attribute selector that targets
<a>elements whosetargetattribute perfectly matches_blank.
25. Which pseudo-class represents an element that has focus (like a text input clicked by user)?
A)
:visitedB)
:activeC)
:focusD)
:hover
Answer: C
Explanation: The
:focuspseudo-class triggers when an element becomes ready to accept input.
26. How do you select the first letter of every <p> element?
A)
p:first-letterB)
p::first-letterC)
p:initial-letterD)
p.first-letter
Answer: B
Explanation: The
::first-letterpseudo-element targets the first character of the first line of a block container.
27. How do you apply CSS to target every alternate <tr> element (even rows)?
A)
tr:nth-child(even)B)
tr:nth-child(2)C)
tr:evenD)
tr:nth-row(even)
Answer: A
Explanation: The
:nth-child(even)selector matches every element that is an even-indexed child of its parent.
28. What does the + combinator mean (e.g., div + p)?
A) Selects all
<p>inside<div>B) Selects the
<p>element placed immediately after a<div>C) Selects every
<p>that follows a<div>D) Combines styles of both
<div>and<p>
Answer: B
Explanation: The adjacent sibling combinator (
+) matches the very next sibling element.
29. What does the ~ combinator mean (e.g., div ~ p)?
A) Selects all
<p>elements that are general siblings after a<div>B) Selects the direct child
<p>of a<div>C) Selects the first
<p>inside a<div>D) None of the above
Answer: A
Explanation: The general sibling combinator (
~) matches all specified sibling elements following the target element, regardless of how far down they are.
30. Which rule overrides all other style declarations, including inline styles?
A)
!overrideB)
!importantC)
!defaultD)
!force
Answer: B
Explanation: Appending
!importantto a CSS property value breaks standard cascading order to ensure that style takes precedence.
🔤 Section 3: Typography & Fonts (Questions 31–45)
31. Which property is used to change the font of an element?
A)
font-styleB)
font-weightC)
font-familyD)
font-variant
Answer: C
Explanation:
font-familyspecifies a prioritized list of font family names for the text.
32. How do you make the text bold?
A)
font: bold;B)
font-weight: bold;C)
style: bold;D)
text-size: bold;
Answer: B
Explanation: The
font-weightproperty sets how thick or thin characters in text should be displayed.
33. How do you display a borderless text font to italic?
A)
font-style: italic;B)
font: italic;C)
text-style: italic;D)
font-weight: italic;
Answer: A
Explanation:
font-stylecontrols whether text is rendered innormal,italic, orobliquevariations.
34. Which property controls the text size?
A)
text-styleB)
font-sizeC)
text-sizeD)
font-style
Answer: B
Explanation:
font-sizehandles the scale dimensions of typography.
35. What is the default font size of standard paragraph text in most browsers?
A) 12px
B) 14px
C) 16px
D) 18px
Answer: C
Explanation: Most modern web browsers default their body base font size to 16px.
36. Which CSS unit is relative to the font-size of the root element (html)?
A) em
B) rem
C) px
D) %
Answer: B
Explanation:
remstands for "Root EM". It scales relative to the root elements' (<html>) sizing values.
37. Which property changes the spacing between text characters?
A)
line-heightB)
letter-spacingC)
word-spacingD)
text-indent
Answer: B
Explanation:
letter-spacingincreases or decreases the tracking spaces between characters.
38. How do you make each word in a text start with a capital letter?
A)
text-transform: capitalize;B)
text-transform: uppercase;C)
text-style: capitalize;D) You cannot do this with CSS
Answer: A
Explanation:
text-transform: capitalize;automatically converts the first letter of every single word into uppercase format.
39. How do you remove the underline from all hyperlinks?
A)
a {text-decoration: no-underline;}B)
a {underline: none;}C)
a {text-decoration: none;}D)
a {decorations: none;}
Answer: C
Explanation: Hyperlinks natively carry an underline decoration. Setting
text-decoration: none;successfully strips it away.
40. Which property controls the vertical spacing between lines of text?
A)
letter-spacingB)
word-spacingC)
line-heightD)
vertical-align
Answer: C
Explanation:
line-heightmodifies the height of bounding text lines (often called leading).
41. How do you align text to the center of a container?
A)
text-align: center;B)
align: center;C)
text-align: middle;D)
float: center;
Answer: A
Explanation:
text-alignhandles inline horizontal text alignments with options likeleft,right,center, orjustify.
42. Which property is used to add a shadow effect to text characters?
A)
box-shadowB)
text-shadowC)
font-shadowD)
element-shadow
Answer: B
Explanation:
text-shadowaccepts values for horizontal offset, vertical offset, blur radius, and color to offset typography shadows.
43. What value of text-transform converts all text to lowercase?
A)
text-transform: smallcase;B)
text-transform: lower;C)
text-transform: lowercase;D)
text-decoration: lowercase;
Answer: C
Explanation:
text-transform: lowercase;forces all targeted textual alphabetic strings into lowercase letters.
44. What does font-variant: small-caps; do?
A) Makes the font size smaller
B) Converts all lowercase letters into scaled-down uppercase capital letters
C) bolds only capitals
D) Uses alternative lowercase fonts
Answer: B
Explanation: The
small-capsvalue forces all lowercase text elements to render as small variations of capital letters.
45. Which of the following is a generic font-family fallback value?
A) Times New Roman
B) Arial
C) sans-serif
D) Helvetica
Answer: C
Explanation:
sans-serif,serif,monospace,cursive, andfantasyare fallback generic font families native to CSS specifications.
📦 Section 4: The Box Model & Layouts (Questions 46–65)
46. What components make up the standard CSS Box Model?
A) Content, Margin, Links
B) Content, Padding, Border, Margin
C) Width, Height, Border, Scale
D) Padding, Flex, Grid, Gaps
Answer: B
Explanation: The box model consists layered from inside out: Content -> Padding -> Border -> Margin.
47. When using the standard box model, what is the calculated width of an element?
A) Only the value of the
widthpropertyB) Width + Padding
C) Width + Padding + Border
D) Width + Padding + Border + Margin
Answer: C
Explanation: In the default box model layout model, an element's visible physical rendering size is width + total padding + total border size.
48. Which CSS property changes the box model calculation to include padding and borders inside the specified width?
A)
box-sizing: content-box;B)
box-sizing: border-box;C)
size-model: inclusive;D)
layout-sizing: shrink;
Answer: B
Explanation:
box-sizing: border-box;instructs the browser to incorporate paddings and borders inside the primary designated object width and height boundaries.
49. How do you set a margin space on top of an element?
A)
padding-topB)
margin-topC)
top-marginD)
margin: top;
Answer: B
Explanation:
margin-topsets structural layout spacing outside the element borders on the upper perimeter side.
50. What is the shorthand order for padding and margins (e.g., margin: 10px 20px 30px 40px;)?
A) Top, Left, Bottom, Right
B) Top, Right, Bottom, Left
C) Bottom, Right, Top, Left
D) Left, Right, Top, Bottom
Answer: B
Explanation: Multi-value direction shorthands evaluate clockwise: Top, Right, Bottom, Left (TRBL).
51. How do you center a block element horizontally within its parent container using margins?
A)
margin: center;B)
margin: 0 auto;C)
margin: auto 0;D)
horizontal-align: center;
Answer: B
Explanation: Specifying
autofor the left and right margins instructs the browser to split the remaining available block container width evenly.
52. Which property hides an element but keeps its space reserved in the page layout?
A)
display: none;B)
visibility: hidden;C)
opacity: 0;D) Both B and C
Answer: D
Explanation:
visibility: hiddenandopacity: 0mask the element visually without extracting its layout space from the DOM sequence, unlikedisplay: none;.
53. Which property completely removes an element from the page layout flow?
A)
display: none;B)
visibility: hidden;C)
hidden: true;D)
clear: both;
Answer: A
Explanation:
display: none;completely removes the element from the layout flow as if it didn't exist.
54. What is the default position value for HTML elements?
A)
absoluteB)
relativeC)
staticD)
fixed
Answer: C
Explanation: The default position value is
static. It follows the normal top-to-bottom document flow.
55. An element with position: absolute; positions itself relative to:
A) The viewport window
B) Its nearest positioned ancestor (non-static)
C) Its direct parent element regardless of position
D) The body element only
Answer: B
Explanation:
absoluteplacement targets coordinates against the nearest containing ancestor element possessing a positioning status other thanstatic.
56. Which position value keeps an element anchored in place relative to the browser viewport even during scrolling?
A)
relativeB)
absoluteC)
fixedD)
sticky
Answer: C
Explanation:
fixedlocks elements rigidly into reference positions mapped against the view screen frames.
57. What property controls the stacking order of overlapping positioned elements?
A)
layer-indexB)
z-indexC)
stack-orderD)
order
Answer: B
Explanation:
z-indextakes numeric integers determining layering depth orders along the virtual Z-axis.
58. How do you add a solid black border line around an element?
A)
border: 1px solid black;B)
border-style: solid 1px black;C)
border: black solid 1px;D) All of the above are valid due to loose shorthand parsing
Answer: A
Explanation: The standard
bordershorthand syntax structure iswidth style color;. However, the order of these values does not strictly matter.
59. How do you make border corners rounded?
A)
border-roundB)
corner-radiusC)
border-radiusD)
box-radius
Answer: C
Explanation:
border-radiuscurves the outer structural edges of element background boxes.
60. What is the purpose of the clear property?
A) Clears out element content data
B) Specifies which sides of an element floating elements are not allowed to float
C) Resets margins and padding fields back to zero
D) Clears validation caching errors
Answer: B
Explanation: The
clearproperty enforces whether an element must move below floating elements that precede it.
61. Which property sets an element's structural display layout to Flexbox?
A)
flex: true;B)
display: flexbox;C)
display: flex;D)
layout: flex;
Answer: C
Explanation:
display: flex;activates standard flexible box formatting layout structures across immediate child elements.
62. In Flexbox, which property aligns items along the main axis (horizontally by default)?
A)
align-itemsB)
justify-contentC)
align-contentD)
flex-direction
Answer: B
Explanation:
justify-contentaligns items along the main axis, whilealign-itemsmanages alignment along the cross axis.
63. How do you change the main axis direction in a flex container to vertical?
A)
flex-direction: vertical;B)
flex-direction: column;C)
flex-axis: vertical;D)
justify-content: column;
Answer: B
Explanation:
flex-direction: column;rotates the primary axis flow from rows to vertical columns.
64. What CSS Grid property is used to define column dimensions?
A)
grid-columnsB)
grid-template-columnsC)
grid-template-rowsD)
grid-layout-columns
Answer: B
Explanation:
grid-template-columnsexplicitly structures the structural column line spacing layout of grid containers.
65. What unit is unique to CSS Grid and represents a fraction of the available space?
A) fr
B) gr
C) flex
D) rem
Answer: A
Explanation: The
frunit stands for "fraction", dynamically splitting available structural track partitions within Grid designs.
🎨 Section 5: Colors, Backgrounds, & Advanced (Questions 66–85)
66. Which of the following is NOT a valid color value notation format in CSS?
A)
color: rgb(255, 0, 0);B)
color: #FF0000;C)
color: red;D)
color: color-name(red);
Answer: D
Explanation: Color keywords are used directly (e.g.,
red), without wrapping them in a functional notation likecolor-name().
67. What does the 'A' stand for in RGBA and HSLA color formats?
A) Alternate
B) Alpha
C) Array
D) Accumulator
Answer: B
Explanation: The Alpha channel represents opacity values ranging decimal points between
0.0(fully transparent) up to1.0(fully opaque).
68. How do you make a background image repeat only vertically?
A)
background-repeat: repeat-x;B)
background-repeat: repeat-y;C)
background-repeat: vertical;D)
background-attachment: scroll;
Answer: B
Explanation: The value
repeat-yrepeats the background image along the Y-axis (vertically).
69. Which property fixes a background image so that it doesn't scroll with the rest of the page?
A)
background-repeat: fixed;B)
background-attachment: fixed;C)
background-position: center;D)
background-scroll: none;
Answer: B
Explanation: Setting
background-attachment: fixed;keeps the background image stationary relative to the viewport.
70. How do you add a shadow effect outside an entire structural element box?
A)
text-shadowB)
border-shadowC)
box-shadowD)
element-shadow
Answer: C
Explanation:
box-shadowapplies drop shadow effects around element frames.
71. What CSS property applies filter effects like blur or grayscale to an element's rendering output?
A)
blurB)
filterC)
transformD)
transition
Answer: B
Explanation: The
filterproperty gives graphical access to structural image processing parameters likeblur(),grayscale(), orsepia().
72. Which CSS property is used to smoothly animate changes in CSS properties over time?
A)
animationB)
transformC)
transitionD)
change-speed
Answer: C
Explanation:
transitioncontrols simple property interpolation speed shifts over a given duration.
73. What rule is used to define keyframe states for complex multi-stage CSS animations?
A)
@keyframesB)
@animateC)
@stepsD)
@motion
Answer: A
Explanation: The
@keyframesat-rule establishes keyframe checkpoints detailing changes across custom runtime tracks.
74. Which property allows you to rotate, scale, skew, or translate an element?
A)
transitionB)
transformC)
animationD)
skew-mode
Answer: B
Explanation:
transformapplies 2D or 3D structural modifications to targeted visual items.
75. How do you scale an element to twice its original size using transforms?
A)
transform: double();B)
transform: scale(2);C)
transform: size(200%);D)
scale: 2x;
Answer: B
Explanation: The
scale()function increases or decreases element dimensions relative to its original size.
76. What feature is used to query device properties to apply responsive CSS code styles?
A)
@mediarulesB)
@responsivequeriesC)
@devicefiltersD) Flexbox rules
Answer: A
Explanation:
@mediaqueries target different screens, screen aspect properties, or resolutions to implement responsive layouts.
77. Which CSS media descriptor targets standard mobile phone screens using viewport layout constraints?
A)
max-widthB)
device-modeC)
mobile-onlyD)
screen-ratio
Answer: A
Explanation: Setting standard breakpoints via
max-widthormin-widthtargets device sizes (e.g.,@media (max-width: 600px)).
78. Which property changes mouse cursor styles when passing above an element?
A)
mouse-styleB)
pointer-modeC)
cursorD)
hover-icon
Answer: C
Explanation: The
cursorproperty allows customization of mouse icons, such as transforming it into a pointing hand usingcursor: pointer;.
79. How do you declare a custom property (CSS Variable)?
A)
var-my-color: #000;B)
--my-color: #000;C)
$my-color: #000;D)
@my-color: #000;
Answer: B
Explanation: Native CSS custom variable identifiers must always be prefixed with two dashes (
--).
80. How do you consume a declared CSS variable value?
A)
color: get(--my-color);B)
color: var(--my-color);C)
color: --my-color;D)
color: $my-color;
Answer: B
Explanation: You extract custom variable property values by invoking the
var()functional expression wrapper.
81. Which property controls how content behaves when it overflows its container?
A)
overflowB)
break-outC)
containD)
display
Answer: A
Explanation:
overflowdefines whether clipping occurs, or scrollbars appear, when element contents exceed their containers' dimensions.
82. Which value of the overflow property clips content and hides the remaining overflow text?
A)
scrollB)
visibleC)
hiddenD)
auto
Answer: C
Explanation:
overflow: hidden;cuts off excess protruding content without providing tracking scrolling pathways.
83. What function allows simple mathematical calculations to be performed inside a CSS value field?
A)
math()B)
calc()C)
compute()D)
sum()
Answer: B
Explanation: The
calc()function allows dynamic property values calculations to mix variable measurement units (e.g.,calc(100% - 20px)).
84. Which CSS property changes the layout order of structural items inside a flex container?
A)
z-indexB)
flex-indexC)
orderD)
tabindex
Answer: C
Explanation: The
orderproperty controls the visual arrangement sequence of flex items within a flex container.
85. What property forces text lines to clip and append ellipses (...) when combined with overflow constraints?
A)
text-overflow: ellipsis;B)
text-cut: dots;C)
word-break: clip;D)
font-variant: dots;
Answer: A
Explanation:
text-overflow: ellipsis;signals truncation paths by injecting trailing ellipsis points.
⚡ Section 6: Architecture, Standards, & Advanced Layouts (Questions 86–100)
86. What organization manages the formal standardization of CSS specifications?
A) Google
B) Microsoft
C) W3C (World Wide Web Consortium)
D) WHATWG
Answer: C
Explanation: The W3C develops specifications and guidelines for web languages like HTML and CSS.
87. What does the "Cascading" in CSS refer to?
A) The way animations loop
B) The method used to determine which style rules apply when multiple rules compete
C) JavaScript execution pipelines
D) The linear code execution order
Answer: B
Explanation: Cascading defines the deterministic system browsers use to resolve stylistic conflicts based on specificity, origin, and order.
88. Which selector matches any checkbox element that is currently checked?
A)
input:selectedB)
input:checkedC)
input[checked=true]D)
input::checked
Answer: B
Explanation: The
:checkedpseudo-class matches toggle checkboxes or radio options currently marked active.
89. Which property sets whether an element behaves as a block or inline box model object?
A)
layoutB)
displayC)
box-typeD)
visibility
Answer: B
Explanation:
displaydetermines the rendering box behaviors (block,inline,inline-block, etc.).
90. What is a key characteristic of an inline element?
A) It starts on a new line and takes up full width
B) It respects specified width and height settings
C) It sits on the same line and its width is defined only by its content
D) It cannot contain text
Answer: C
Explanation: Inline elements do not start on new lines and ignore top/bottom manual width/height assignments.
91. What is the difference between inline-block and inline?
A)
inline-blockforces line breaksB)
inline-blockallows manual width and height settings to be respectedC) There is no difference
D)
inline-blockcannot use margins
Answer: B
Explanation:
inline-blockelements flow inline on the same text line, but retain the ability to use box model width, height, and padding parameters.
92. Which CSS property isolates structural blend modes for element overlays?
A)
mix-blend-modeB)
background-blendC)
color-blendD)
opacity
Answer: A
Explanation:
mix-blend-modespecifies how an element's content blends with the content of the parent element behind it.
93. What selector targets the root element of the document (typically HTML)?
A)
:rootB)
*C)
#rootD)
html:all
Answer: A
Explanation: The
:rootpseudo-class represents the highest-level configuration node in a document tree.
94. What attribute selector targets values starting with a specific prefix string (e.g., href starting with https)?
A)
a[href^="https"]B)
a[href$="https"]C)
a[href*="https"]D)
a[href~="https"]
Answer: A
Explanation: The prefix operator
^=matches attribute strings starting exactly with the specified text snippet.
95. What attribute selector matches values ending with a specific string?
A)
^=B)
*=C)
$=D)
~=
Answer: C
Explanation: The suffix operator
$=matches attribute strings ending exactly with the specified text snippet.
96. What does pointer-events: none; do?
A) Changes the mouse pointer to a circle
B) Prevents the element from responding to mouse clicks or hover states
C) Disables JavaScript execution entirely
D) Prevents text selection actions
Answer: B
Explanation:
pointer-events: none;makes the element "click-through," meaning it ignores all pointer interactions and passes them to elements underneath.
97. Which property handles column distribution gaps inside CSS Grid or Flexbox layouts?
A)
grid-gapB)
gapC)
spacingD)
margin-gap
Answer: B
Explanation: The modern
gapshorthand property establishes empty gutter spacings between tracking flex items or grid structural partitions.
98. Which pseudo-class selects elements that have no child nodes or text strings inside them?
A)
:nullB)
:blankC)
:emptyD)
:void
Answer: C
Explanation: The
:emptyselector targets elements that contain no children, not even whitespace text nodes.
99. Which property forces text lines to break mid-word if necessary to prevent layout container clipping?
A)
word-break: break-word;B)
text-align: adjust;C)
overflow: force;D)
white-space: wrap;
Answer: A
Explanation:
word-break: break-all;orbreak-wordoverrides text processing to insert arbitrary wrap splits when long continuous words threaten container boundaries.
100. How do you import another external CSS file from within an existing CSS style sheet?
A)
@import url("styles.css");B)
#include "styles.css";C)
link("styles.css");D)
@require "styles.css";
Answer: A
Explanation: The
@importat-rule allows developers to modularly ingest secondary stylesheet documents directly within active CSS files.
No comments:
Post a Comment