OA Exams
Which CSS property is used to change the background color of an element?
a) colorb) background-colorc) bgcolord) border-color
Correct Answer: b) background-color
Explanation: The background-color property is used to specify the background color of an HTML element.
How do you display hyperlinks without an underline in CSS?
a) a {text-decoration:none;}b) a {underline:none;}c) a {decoration:none;}d) a {no-underline:true;}
Correct Answer: a) a {text-decoration:none;}
Explanation: The text-decoration:none CSS rule removes the default underline from hyperlinks.
Which CSS property controls the text size of an element?
a) font-sizeb) text-sizec) font-weightd) size
Correct Answer: a) font-size
Explanation: The font-size property controls the size of the text inside an HTML element.
Which CSS property is used to make text bold?
a) font-style:boldb) font-weight:boldc) font-size:boldd) font:bold
Correct Answer: b) font-weight:bold
Explanation: The font-weight property is used to make text bold in CSS.
How do you make each word in a text start with a capital letter in CSS?
a) text-capital:eachb) text-transform:capitalizec) text-transform:uppercased) text-decoration:capitalize
Correct Answer: b) text-transform:capitalize
Explanation: The text-transform:capitalize property makes the first letter of each word uppercase.
Which CSS property changes the font of an element?
a) font-familyb) font-stylec) font-textd) font-change
Correct Answer: a) font-family
Explanation: The font-family property specifies the font of an HTML element.
Which CSS property is used to change the left margin of an element?
a) padding-leftb) margin-leftc) left-margind) margin
Correct Answer: b) margin-left
Explanation: The margin-left property adjusts the left margin of an HTML element.
True or False: Negative values can be used when specifying padding in CSS.
a) Trueb) False
Correct Answer: b) False
Explanation: Padding in CSS cannot have negative values, only positive values are allowed
How do you select an element with the ID demo in CSS?
a) .demob) #democ) demod) div.demo
Correct Answer: b) #demo
Explanation: The #demo selector is used to target an element by its ID in CSS.
How do you select all elements with the class name test in CSS?
a) #testb) *testc) .testd) test
Correct Answer: c) .test
Explanation: The .test selector is used to target all elements with the class name test in CSS.
How do you group multiple selectors in CSS?
a) Use a space between selectorsb) Use a plus symbol between selectorsc) Use a comma between selectorsd) Use a period between selectors
Correct Answer: c) Use a comma between selectors
Explanation: Grouping multiple selectors with a comma allows the same CSS rule to apply to all specified elements.
What is the default value of the CSS position property?
a) absoluteb) relativec) fixedd) static
Correct Answer: d) static
Explanation: The default value of the position property is static, meaning elements are positioned according to the normal flow of the document.
Which HTML element is used to define strong importance text?
a) <strong>b) <em>c) <b>d) <mark>
Correct Answer: a) <strong>
Explanation: The <strong> tag is used to define text that is of strong importance, often rendering in bold.
How do you add a comment in CSS?
a) // this is a commentb) <!– this is a comment –>c) /* this is a comment */d) # this is a comment
Correct Answer: c) /* this is a comment */
Explanation: Comments in CSS are written inside /* ... */ and are ignored by the browser.
Which CSS property is used to change the text color of an element?
a) colorb) text-colorc) font-colord) background-color
Correct Answer: a) color
Explanation: The color property is used to change the text color in CSS.
How do you set a background image in CSS?
a) background-image:img(‘image.gif’);b) background:src(‘image.gif’);c) background-image:url(‘image.gif’);d) background-image(‘image.gif’);
Correct Answer: c) background-image:url('image.gif');
Explanation: The background-image property is used to set a background image for an element in CSS.
Which CSS property is used to set the width of an element’s border?
a) border-sizeb) border-widthc) borderd) border-style
Correct Answer: b) border-width
Explanation: The border-width property sets the thickness of the border around an element.
How do you add a shadow to text in CSS?
a) text-shadowb) font-shadowc) shadow-textd) text-box-shadow
Correct Answer: a) text-shadow
Explanation: The text-shadow property adds shadow effects to text in CSS.
What is the CSS property that controls the horizontal alignment of a block element?
a) align-contentb) text-alignc) justify-contentd) float
Correct Answer: b) text-align
Explanation: The text-align property is used to specify the horizontal alignment of inline content within a block-level element.
Which CSS property controls the visibility of an element?
a) displayb) visibilityc) opacityd) overflow
Correct Answer: b) visibility
Explanation: The visibility property is used to control whether an element is visible or hidden on the page.