Explanation:The <link> tag is used to link external style sheets. It requires the rel="stylesheet" attribute and the href attribute pointing to the file.
Incorrect! Try again.
5Which is the correct CSS syntax?
A.body:color=black;
B.{body;color:black;}
C.body {color: black;}
D.body = color: black;
Correct Answer: body {color: black;}
Explanation:The standard CSS syntax consists of a selector (body) and a declaration block wrapped in curly braces ({color: black;}).
Incorrect! Try again.
6How do you insert a comment in a CSS file?
A.// this is a comment
B.' this is a comment
C./ this is a comment /
D.<!-- this is a comment -->
Correct Answer: / this is a comment /
Explanation:CSS comments start with / and end with /.
Incorrect! Try again.
7Which CSS property is used to change the background color?
A.color
B.bgcolor
C.background-color
D.background-style
Correct Answer: background-color
Explanation:The background-color property sets the background color of an element.
Incorrect! Try again.
8How do you add a background color for all <h1> elements?
A.h1.all {background-color:#FFFFFF;}
B.h1 {background-color:#FFFFFF;}
C.all.h1 {background-color:#FFFFFF;}
D.#h1 {background-color:#FFFFFF;}
Correct Answer: h1 {background-color:#FFFFFF;}
Explanation:To select all elements of a specific type, use the element name (Type Selector) as the selector, in this case, 'h1'.
Incorrect! Try again.
9Which CSS property is used to change the text color of an element?
A.text-color
B.fgcolor
C.color
D.font-color
Correct Answer: color
Explanation:The 'color' property specifies the color of the text content inside an element.
Incorrect! Try again.
10Which CSS property controls the text size?
A.font-style
B.text-size
C.font-size
D.text-style
Correct Answer: font-size
Explanation:The font-size property sets the size of the text.
Incorrect! Try again.
11What is the correct CSS syntax for making all the <p> elements bold?
A.p {text-size:bold;}
B.p {font-weight:bold;}
C.p {style:bold;}
D.p {text:bold;}
Correct Answer: p {font-weight:bold;}
Explanation:The font-weight property sets how thick or thin characters in text should be displayed; 'bold' makes them thick.
Incorrect! Try again.
12How do you display hyperlinks without an underline?
A.a {decoration:no-underline;}
B.a {text-decoration:none;}
C.a {underline:none;}
D.a {text-style:no-underline;}
Correct Answer: a {text-decoration:none;}
Explanation:The text-decoration property is used to set or remove decorations from text. Setting it to 'none' removes the underline from links.
Incorrect! Try again.
13How do you make each word in a text start with a capital letter?
A.text-style:capitalize
B.transform:capitalize
C.text-transform:capitalize
D.font-transform:capitalize
Correct Answer: text-transform:capitalize
Explanation:The text-transform property controls the capitalization of text. 'capitalize' transforms the first character of each word to uppercase.
Incorrect! Try again.
14Which property is used to change the font of an element?
A.font-weight
B.font-style
C.font-family
D.font-typeface
Correct Answer: font-family
Explanation:The font-family property specifies the font for an element.
Incorrect! Try again.
15How do you select an element with id 'demo'?
A.#demo
B..demo
C.demo
D.*demo
Correct Answer: #demo
Explanation:The ID selector uses the hash (#) character followed by the id name.
Incorrect! Try again.
16How do you select elements with class name 'test'?
A.#test
B..test
C.test
D.*test
Correct Answer: .test
Explanation:The class selector uses a period (.) character followed by the class name.
Incorrect! Try again.
17How do you select all p elements inside a div element?
A.div.p
B.div p
C.div + p
D.div, p
Correct Answer: div p
Explanation:The descendant selector (space) matches all elements that are descendants of a specified element. 'div p' selects all <p> elements inside <div> elements.
Incorrect! Try again.
18In the CSS Box Model, what is the innermost component?
A.Border
B.Margin
C.Padding
D.Content
Correct Answer: Content
Explanation:The CSS Box Model consists of margins, borders, padding, and the actual content. The content is the innermost part.
Incorrect! Try again.
19Which property is used to generate space around an element's content, inside of any defined borders?
A.padding
B.margin
C.border
D.spacing
Correct Answer: padding
Explanation:Padding is the space between the content and the border.
Incorrect! Try again.
20Which property is used to generate space outside the border?
A.padding
B.margin
C.border-spacing
D.outline
Correct Answer: margin
Explanation:Margin is the space outside the border, separating the element from other elements.
Explanation:The background-image property sets one or more background images for an element using the url() function.
Incorrect! Try again.
22How do you prevent a background image from repeating?
A.background-repeat: no-repeat;
B.background-repetition: none;
C.background: unique;
D.background-repeat: never;
Correct Answer: background-repeat: no-repeat;
Explanation:The background-repeat property defines if/how the background image repeats. 'no-repeat' shows the image only once.
Incorrect! Try again.
23Which CSS property specifies the alignment of text?
A.text-align
B.text-justify
C.font-align
D.text-position
Correct Answer: text-align
Explanation:The text-align property is used to set the horizontal alignment of a text (e.g., center, left, right, justify).
Incorrect! Try again.
24What is the correct CSS shorthand for setting a border?
A.border: 1px solid black;
B.border: solid black 1px;
C.border-width: 1px solid black;
D.border-style: 1px black solid;
Correct Answer: border: 1px solid black;
Explanation:The border shorthand property sets the width, style, and color in that order (though order often doesn't strictly matter for browsers, width-style-color is standard).
Incorrect! Try again.
25Which property is used to set the height of a line of text?
A.line-height
B.text-height
C.font-height
D.spacing-height
Correct Answer: line-height
Explanation:The line-height property specifies the height of a line.
Incorrect! Try again.
26What is the difference between 'div' and 'span'?
A.div is inline, span is block
B.div is block, span is inline
C.Both are block elements
D.Both are inline elements
Correct Answer: div is block, span is inline
Explanation:A <div> is a block-level element (starts on a new line, takes full width), while <span> is an inline element (does not start on a new line, takes only necessary width).
Incorrect! Try again.
27Which CSS property collapses table borders into a single border?
A.border-style: collapse;
B.border-collapse: collapse;
C.table-border: single;
D.border-spacing: 0;
Correct Answer: border-collapse: collapse;
Explanation:The border-collapse property sets whether table borders should collapse into a single border or be separated.
Incorrect! Try again.
28How do you group multiple selectors to share the same styles?
A.Separate them with a comma
B.Separate them with a space
C.Separate them with a plus sign
D.Separate them with a semicolon
Correct Answer: Separate them with a comma
Explanation:To group selectors, separate each selector with a comma. Example: h1, h2, p { color: red; }.
Incorrect! Try again.
29If 'margin: 10px 20px 30px 40px;' is set, what is the left margin?
A.10px
B.20px
C.30px
D.40px
Correct Answer: 40px
Explanation:The order for padding/margin shorthand is Top, Right, Bottom, Left (Clockwise). Therefore, 40px is the left margin.
Incorrect! Try again.
30Which pseudo-class is used to define a special state of an element when the user moves the mouse over it?
A.:active
B.:hover
C.:focus
D.:visited
Correct Answer: :hover
Explanation:The :hover pseudo-class is used to select an element when the user mouses over it.
Incorrect! Try again.
31How do you create a 'zebra-striped' table using CSS?
Explanation:The :nth-child() pseudo-class matches elements based on their position in a group of siblings. Using 'even' or 'odd' creates a striped effect.
Incorrect! Try again.
32Which selector is used to select input fields with a specific type attribute?
A.input#text
B.input.text
C.input[type='text']
D.input:text
Correct Answer: input[type='text']
Explanation:The attribute selector [attribute='value'] is used to select elements with a specific attribute and value.
Incorrect! Try again.
33Which property specifies the stack order of an element?
A.d-index
B.s-index
C.x-index
D.z-index
Correct Answer: z-index
Explanation:The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order.
Incorrect! Try again.
34Which CSS property is used to italicize text?
A.font-weight
B.text-style
C.font-style
D.font-variant
Correct Answer: font-style
Explanation:The font-style property is typically used to specify italic text.
Incorrect! Try again.
35Which of the following has the highest priority?
A.External CSS
B.Internal CSS
C.Inline CSS
D.Browser default
Correct Answer: Inline CSS
Explanation:Inline styles (inside an HTML element) have the highest priority, overriding external and internal styles and browser defaults.
Incorrect! Try again.
36What value of the 'display' property makes an element completely disappear without occupying space?
A.hidden
B.none
C.invisible
D.block
Correct Answer: none
Explanation:display: none; removes the element from the document flow, so it takes up no space. visibility: hidden; hides it but keeps the space.
Incorrect! Try again.
37How can you center-align a block element (like a div) horizontally?
Explanation:Setting the left and right margins to 'auto' centers a block element horizontally within its container.
Incorrect! Try again.
38Which property specifies the width of a table border?
A.border-width
B.border-size
C.table-border
D.width
Correct Answer: border-width
Explanation:The border-width property specifies the width of the four borders.
Incorrect! Try again.
39Which pseudo-class is commonly used to style an input field when it is clicked on or selected via tab?
A.:selected
B.:active
C.:focus
D.:hover
Correct Answer: :focus
Explanation:The :focus pseudo-class is applied when an element (like an input) has received focus.
Incorrect! Try again.
40How do you make a list not display bullet points?
A.list-style-type: none;
B.bullet-style: none;
C.text-decoration: none;
D.list: none;
Correct Answer: list-style-type: none;
Explanation:The list-style-type property specifies the type of list item marker. Setting it to 'none' removes the bullets.
Incorrect! Try again.
41What is the purpose of the Universal Selector (*) in CSS?
A.Selects the first element
B.Selects all elements on the page
C.Selects all elements with a specific ID
D.Selects all elements inside a div
Correct Answer: Selects all elements on the page
Explanation:The asterisk (*) is the universal selector, which matches any and all elements in the document.
Incorrect! Try again.
42Which CSS unit is relative to the font-size of the root element?
A.px
B.em
C.rem
D.%
Correct Answer: rem
Explanation:rem stands for 'root em'. It is relative to the font-size of the root element (<html>).
Incorrect! Try again.
43Which property allows you to set the position of a background image?
A.background-location
B.background-position
C.background-origin
D.background-align
Correct Answer: background-position
Explanation:The background-position property sets the starting position of a background image.
Incorrect! Try again.
44How can you specify that a text area in a form should not be resizable?
A.resize: none;
B.fixed: true;
C.size: fixed;
D.max-width: 100%;
Correct Answer: resize: none;
Explanation:The resize property specifies if (and how) an element is resizable by the user. 'none' disables resizing.
Incorrect! Try again.
45Which property controls the space between the borders of adjacent table cells?
A.cell-padding
B.cell-spacing
C.border-spacing
D.border-collapse
Correct Answer: border-spacing
Explanation:The border-spacing property sets the distance between the borders of adjacent cells (only works when border-collapse is separate).
Incorrect! Try again.
46How do you change the cursor to a pointer/hand when hovering over a submit button?
A.cursor: pointer;
B.mouse: pointer;
C.cursor: hand;
D.pointer: hand;
Correct Answer: cursor: pointer;
Explanation:The cursor property specifies the mouse cursor to be displayed. 'pointer' typically displays a hand icon indicating a link or clickable item.
Incorrect! Try again.
47What is the default positioning of HTML elements?
A.relative
B.fixed
C.static
D.absolute
Correct Answer: static
Explanation:HTML elements are positioned static by default. They follow the normal flow of the page.
Incorrect! Try again.
48Which property specifies the transparency of an element?
A.filter
B.visibility
C.opacity
D.transparent
Correct Answer: opacity
Explanation:The opacity property sets the opacity level for an element (0.0 is fully transparent, 1.0 is fully opaque).
Incorrect! Try again.
49Which CSS selector selects all elements with the class 'intro' inside a div?
A.div.intro
B.div .intro
C..intro div
D.div #intro
Correct Answer: div .intro
Explanation:The selector 'div .intro' (with a space) selects all elements with class 'intro' that are descendants of a <div>.
Incorrect! Try again.
50Which property adds a shadow to text?
A.font-shadow
B.text-shadow
C.shadow-text
D.text-effect
Correct Answer: text-shadow
Explanation:The text-shadow property adds a shadow to text.
Incorrect! Try again.
Give Feedback
Help us improve by sharing your thoughts or reporting issues.