Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
The <link> tag is used to link external style sheets. It requires the rel="stylesheet" attribute and the href attribute pointing to the file.
Question 5 of 50
Which is the correct CSS syntax?
Not quite. Try another option.
Answer: body {color: black;}
The standard CSS syntax consists of a selector (body) and a declaration block wrapped in curly braces ({color: black;}).
Question 6 of 50
How do you insert a comment in a CSS file?
Not quite. Try another option.
Answer: / this is a comment /
CSS comments start with / and end with /.
Question 7 of 50
Which CSS property is used to change the background color?
Not quite. Try another option.
Answer: background-color
The background-color property sets the background color of an element.
Question 8 of 50
How do you add a background color for all <h1> elements?
Not quite. Try another option.
Answer: h1 {background-color:#FFFFFF;}
To select all elements of a specific type, use the element name (Type Selector) as the selector, in this case, 'h1'.
Question 9 of 50
Which CSS property is used to change the text color of an element?
Not quite. Try another option.
Answer: color
The 'color' property specifies the color of the text content inside an element.
Question 10 of 50
Which CSS property controls the text size?
Not quite. Try another option.
Answer: font-size
The font-size property sets the size of the text.
Question 11 of 50
What is the correct CSS syntax for making all the <p> elements bold?
Not quite. Try another option.
Answer: p {font-weight:bold;}
The font-weight property sets how thick or thin characters in text should be displayed; 'bold' makes them thick.
Question 12 of 50
How do you display hyperlinks without an underline?
Not quite. Try another option.
Answer: a {text-decoration:none;}
The text-decoration property is used to set or remove decorations from text. Setting it to 'none' removes the underline from links.
Question 13 of 50
How do you make each word in a text start with a capital letter?
Not quite. Try another option.
Answer: text-transform:capitalize
The text-transform property controls the capitalization of text. 'capitalize' transforms the first character of each word to uppercase.
Question 14 of 50
Which property is used to change the font of an element?
Not quite. Try another option.
Answer: font-family
The font-family property specifies the font for an element.
Question 15 of 50
How do you select an element with id 'demo'?
Not quite. Try another option.
Answer: #demo
The ID selector uses the hash (#) character followed by the id name.
Question 16 of 50
How do you select elements with class name 'test'?
Not quite. Try another option.
Answer: .test
The class selector uses a period (.) character followed by the class name.
Question 17 of 50
How do you select all p elements inside a div element?
Not quite. Try another option.
Answer: div p
The descendant selector (space) matches all elements that are descendants of a specified element. 'div p' selects all <p> elements inside <div> elements.
Question 18 of 50
In the CSS Box Model, what is the innermost component?
Not quite. Try another option.
Answer: Content
The CSS Box Model consists of margins, borders, padding, and the actual content. The content is the innermost part.
Question 19 of 50
Which property is used to generate space around an element's content, inside of any defined borders?
Not quite. Try another option.
Answer: padding
Padding is the space between the content and the border.
Question 20 of 50
Which property is used to generate space outside the border?
Not quite. Try another option.
Answer: margin
Margin is the space outside the border, separating the element from other elements.
Question 21 of 50
How do you specify a background image?
Not quite. Try another option.
Answer: background-image: url('image.jpg')
The background-image property sets one or more background images for an element using the url() function.
Question 22 of 50
How do you prevent a background image from repeating?
Not quite. Try another option.
Answer: background-repeat: no-repeat;
The background-repeat property defines if/how the background image repeats. 'no-repeat' shows the image only once.
Question 23 of 50
Which CSS property specifies the alignment of text?
Not quite. Try another option.
Answer: text-align
The text-align property is used to set the horizontal alignment of a text (e.g., center, left, right, justify).
Question 24 of 50
What is the correct CSS shorthand for setting a border?
Not quite. Try another option.
Answer: border: 1px solid black;
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).
Question 25 of 50
Which property is used to set the height of a line of text?
Not quite. Try another option.
Answer: line-height
The line-height property specifies the height of a line.
Question 26 of 50
What is the difference between 'div' and 'span'?
Not quite. Try another option.
Answer: div is block, span is inline
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).
Question 27 of 50
Which CSS property collapses table borders into a single border?
Not quite. Try another option.
Answer: border-collapse: collapse;
The border-collapse property sets whether table borders should collapse into a single border or be separated.
Question 28 of 50
How do you group multiple selectors to share the same styles?
Not quite. Try another option.
Answer: Separate them with a comma
To group selectors, separate each selector with a comma. Example: h1, h2, p { color: red; }.
Question 29 of 50
If 'margin: 10px 20px 30px 40px;' is set, what is the left margin?
Not quite. Try another option.
Answer: 40px
The order for padding/margin shorthand is Top, Right, Bottom, Left (Clockwise). Therefore, 40px is the left margin.
Question 30 of 50
Which pseudo-class is used to define a special state of an element when the user moves the mouse over it?
Not quite. Try another option.
Answer: :hover
The :hover pseudo-class is used to select an element when the user mouses over it.
Question 31 of 50
How do you create a 'zebra-striped' table using CSS?
The :nth-child() pseudo-class matches elements based on their position in a group of siblings. Using 'even' or 'odd' creates a striped effect.
Question 32 of 50
Which selector is used to select input fields with a specific type attribute?
Not quite. Try another option.
Answer: input[type='text']
The attribute selector [attribute='value'] is used to select elements with a specific attribute and value.
Question 33 of 50
Which property specifies the stack order of an element?
Not quite. Try another option.
Answer: z-index
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.
Question 34 of 50
Which CSS property is used to italicize text?
Not quite. Try another option.
Answer: font-style
The font-style property is typically used to specify italic text.
Question 35 of 50
Which of the following has the highest priority?
Not quite. Try another option.
Answer: Inline CSS
Inline styles (inside an HTML element) have the highest priority, overriding external and internal styles and browser defaults.
Question 36 of 50
What value of the 'display' property makes an element completely disappear without occupying space?
Not quite. Try another option.
Answer: none
display: none; removes the element from the document flow, so it takes up no space. visibility: hidden; hides it but keeps the space.
Question 37 of 50
How can you center-align a block element (like a div) horizontally?
Not quite. Try another option.
Answer: margin-left: auto; margin-right: auto;
Setting the left and right margins to 'auto' centers a block element horizontally within its container.
Question 38 of 50
Which property specifies the width of a table border?
Not quite. Try another option.
Answer: border-width
The border-width property specifies the width of the four borders.
Question 39 of 50
Which pseudo-class is commonly used to style an input field when it is clicked on or selected via tab?
Not quite. Try another option.
Answer: :focus
The :focus pseudo-class is applied when an element (like an input) has received focus.
Question 40 of 50
How do you make a list not display bullet points?
Not quite. Try another option.
Answer: list-style-type: none;
The list-style-type property specifies the type of list item marker. Setting it to 'none' removes the bullets.
Question 41 of 50
What is the purpose of the Universal Selector (*) in CSS?
Not quite. Try another option.
Answer: Selects all elements on the page
The asterisk (*) is the universal selector, which matches any and all elements in the document.
Question 42 of 50
Which CSS unit is relative to the font-size of the root element?
Not quite. Try another option.
Answer: rem
rem stands for 'root em'. It is relative to the font-size of the root element (<html>).
Question 43 of 50
Which property allows you to set the position of a background image?
Not quite. Try another option.
Answer: background-position
The background-position property sets the starting position of a background image.
Question 44 of 50
How can you specify that a text area in a form should not be resizable?
Not quite. Try another option.
Answer: resize: none;
The resize property specifies if (and how) an element is resizable by the user. 'none' disables resizing.
Question 45 of 50
Which property controls the space between the borders of adjacent table cells?
Not quite. Try another option.
Answer: border-spacing
The border-spacing property sets the distance between the borders of adjacent cells (only works when border-collapse is separate).
Question 46 of 50
How do you change the cursor to a pointer/hand when hovering over a submit button?
Not quite. Try another option.
Answer: cursor: pointer;
The cursor property specifies the mouse cursor to be displayed. 'pointer' typically displays a hand icon indicating a link or clickable item.
Question 47 of 50
What is the default positioning of HTML elements?
Not quite. Try another option.
Answer: static
HTML elements are positioned static by default. They follow the normal flow of the page.
Question 48 of 50
Which property specifies the transparency of an element?
Not quite. Try another option.
Answer: opacity
The opacity property sets the opacity level for an element (0.0 is fully transparent, 1.0 is fully opaque).
Question 49 of 50
Which CSS selector selects all elements with the class 'intro' inside a div?
Not quite. Try another option.
Answer: div .intro
The selector 'div .intro' (with a space) selects all elements with class 'intro' that are descendants of a <div>.
Question 50 of 50
Which property adds a shadow to text?
Not quite. Try another option.
Answer: text-shadow
The text-shadow property adds a shadow to text.
That's unit 3
Answer a few questions and your score shows up here.
Nearly through. Did unit 3 of CSE326 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 3 of CSE326 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.