CSS - cascading style sheets, backgrounds, colours, fonts, borders, boxes, margins, padding, positioning, class and id selectors - One Line Questions
1.
What is the correct CSS syntax for selecting an element with the ID 'main-content'? —
#main-content
2.
What is the correct CSS syntax for selecting all elements with the class 'example'? —
.example
3.
What is the default value of the CSS 'position' property? —
static
4.
What does the CSS selector `div > p` match? —
All `p` elements that are direct children of a `div` element.
5.
What does the CSS pseudo-class ':hover' apply to? —
An element when the user moves the mouse pointer over it.
6.
What is the default font-family for most web browsers? —
Inherited from user agent stylesheet
7.
Which CSS property is used to set the color of text? —
color
8.
What is the CSS property for setting the color of the background image? —
background-color
9.
Which CSS property is used to set the background image of an element? —
background-image
10.
What is the CSS property for setting the background position? —
background-position
11.
Which CSS property is used to control the repetition of a background image? —
background-repeat
12.
Which CSS property specifies the color of the border? —
border-color
13.
Which CSS property is used to set the style of the border around an element? —
border-style
14.
Which CSS property is used to specify the width of an element's border? —
border-width
15.
Which property is used to change the background color of an element in CSS? —
background-color
16.
What does CSS stand for? —
Cascading Style Sheets
17.
What is the CSS 'box model' composed of? —
Content, Padding, Border, Margin
18.
What is the CSS selector that targets elements that are direct children of another element? —
Child selector (>)
19.
Which CSS property is used to control the visibility of an element? —
visibility
20.
Which CSS property is used to set the font family (e.g., Arial, Times New Roman)? —
font-family
21.
Which CSS property controls the text size of an element? —
font-size
22.
What is the CSS property for setting the font style (e.g., italic)? —
font-style
23.
Which CSS property is used to make text bold? —
font-weight: bold;
24.
What is the CSS property for setting the height of an element? —
height
25.
What is the default value for the CSS 'display' property for a `<div>` element? —
block
26.
What does the CSS property 'text-decoration: none;' do? —
It removes any default text decorations like underlines.
27.
What does the CSS property 'float: left;' do? —
It makes the element appear on the left side of the page, allowing text to wrap around it.
28.
What is the purpose of the 'box-sizing' property in CSS? —
It defines how the width and height properties are calculated.
29.
What does `display: inline-block;` do in CSS? —
It makes the element behave like an inline element but allows width and height.
30.
What does the CSS property 'opacity: 0;' do? —
It makes the element completely transparent.
31.
What does the CSS property 'position: absolute;' do? —
It allows the element to be positioned relative to its nearest positioned ancestor.
32.
What does the CSS 'border-radius' property do? —
It rounds the corners of an element's border.
33.
What is the CSS property for setting the horizontal positioning of absolutely positioned elements? —
left
34.
Which CSS property is used to control the spacing between letters? —
letter-spacing
35.
Which CSS property controls the spacing between lines of text? —
line-height
36.
Which CSS property is used to add space inside the border of an element? —
padding
37.
What is the CSS shorthand property for setting all four margins (top, right, bottom, left) in order? —
margin
38.
Which CSS property is used to set the color of the text's outline? —
outline-color
39.
Which CSS property is used to set the style of the outline around an element? —
outline-style
40.
Which CSS property is used to control the overflow of content that exceeds the element's box? —
overflow
41.
Which CSS property is used to add space outside the border of an element? —
margin
42.
What does `position: fixed;` in CSS do? —
Removes the element from the document flow and positions it relative to the viewport.
43.
Which CSS property is used to control the alignment of text within an element? —
text-align
44.
Which CSS property is used to create a text shadow? —
text-shadow
45.
What does the CSS property 'display: inline;' do? —
The element flows like text, and other elements flow around it.
46.
What is the purpose of the CSS `!important` rule? —
To override other CSS rules, making the rule with `!important` take precedence.
47.
What is the CSS property for setting the vertical positioning of absolutely positioned elements? —
top
48.
Which CSS property is used to set the vertical alignment of text within an element? —
vertical-align
49.
Which CSS property allows an element to occupy space but not be displayed? —
display: none;
50.
Which CSS property is used to set the width of an element? —
width