0% found this document useful (0 votes)
17 views13 pages

CSS Exam Sample Questions

The document contains a series of multiple choice questions about CSS properties, values, and selectors. Some key points covered include: - The "important" keyword is used to override style precedence and inheritance. - RGB, HSL, and RGBA values that represent the color blue. - Selectors like "aside > p" that match specific element relationships. - Properties like "text-decoration: none;" that remove underlines from links. - The @font-face rule used to define web fonts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views13 pages

CSS Exam Sample Questions

The document contains a series of multiple choice questions about CSS properties, values, and selectors. Some key points covered include: - The "important" keyword is used to override style precedence and inheritance. - RGB, HSL, and RGBA values that represent the color blue. - Selectors like "aside > p" that match specific element relationships. - Properties like "text-decoration: none;" that remove underlines from links. - The @font-face rule used to define web fonts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

What keyword do you add to a style property to override style precedence and style inheritance?

cascade!

use!

important!

import!
-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

CSS comments are entered as:

/* comment */

! comment !

/* comment

<!--- comment --->

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

Which of the following values is used to represent the color red?

rgb(10, 0, 0)

rgb(1000, 0, 0)

rgb(255, 0, 0)

rgb(0, 255, 0)

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

What is the hue associated with the color value hsl(90, 100%, 50%)?

90

100%
50%

Cannot be determined by the color value

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

What is the HSL color value for red displayed with the highest saturation and lightness and with 50%
transparency?

hsl(0, 100%, 100%, 0.5)

hsl(255, 100%, 100%, 0.5)

hsla(0, 100%, 100%, 0.5)

hsla(0.5, 0, 100%, 100%)

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

What is the style to display h1 headings in green text on a yellow background?

h1 {color: green; background-color: yellow;}

h1 {color: green; bgcolor: yellow;}

h1 {text: green; background: yellow;}

h1 {textColor: green; backgroundColor: yellow;}

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------
Which of the following matches the color blue?

rgb(0, 0, 255)

hsl(240, 100%, 50%);

rgba(0, 0, 255, 1)

All of the above

Which of the following selectors is used to match only paragraphs that are children of the aside
element?

aside p

aside > p

All of the above

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

For the following style rules, what is the font size of the h1 heading in pixels?

body {font-size: 16px;}

body > article {font-size: 0.75em;}

body > article > h1 {font-size: 1.5em;}


16px;

12px;

18px;

18.25px;

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

Provide a style rule to remove underlining from hypertext links marked with the <a> tag and nested
within a navigation list.

nav > a {text-decoration: none;}

nav > a {text-decoration: no-underline;}

nav a {text-decoration: none;}

nav a {text-decoration: underline=“no”;}

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

Provide an @font-face rule to create a web font named Cantarell based on the font file [Link]
and [Link].

i. @font-face {
   font-family: Cantarell;

   src: url(‘[Link]’) format(‘woff’),

   src: url(‘[Link]’) format(‘truetype’);

ii. font-family: Cantarell, [Link], [Link].

iii. Cantarell {

   src: url(‘[Link]’) format(‘woff’),

   src: url(‘[Link]’) format(‘truetype’);

iv. All of the above will work

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------

Which of the following provides a style rule to display all blockquote elements belonging to the Reviews
class in italic and indented 3em?

i. Reviews > blockquote {

   font-style: italic;
   indent: 3em;

ii. blockquote#Reviews {

   font-style: italic;

   indent: 3em;

iii. [Link] {

   font-style: italic;

   text-indent: 3em;

iv. blockquote#Reviews {

   italic: true;

   indent: 3em;

-------------------------------------------------------------------------------------------------------------------------------------------
---------------------------
Which of the following style rules will center the text of all h1 through h6 headings with the text
displayed at normal weight?

i. h1 - h6 {

   text-align: center;

   weight: normal;

ii. h1, h2, h3, h4, h5, h6 {

   align: center;

   weight: normal;

iii. h1, h2, h3, h4, h5, h6 {

   text-align: center;

   font-weight: normal;

iv. h1 - h6 {
   text-align: center;

   font-weight: normal;

Common questions

Powered by AI

The @font-face rule to embed a web font named Cantarell is: '@font-face { font-family: Cantarell; src: url(‘Cantarell.woff’) format(‘woff’), url(‘Cantarell.ttf’) format(‘truetype’); }'. This declaration specifies the font name ('font-family'), and the 'src' attribute links to the font files with their respective formats ('woff' and 'truetype').

The RGB representation for the color red is 'rgb(255, 0, 0)'. This is because the RGB color model defines colors through the intensity of the red, green, and blue channels. For pure red, the red channel is at its maximum intensity (255), while the green and blue channels are set to 0, resulting in 'rgb(255, 0, 0)' .

In the HSL color model, the hue value represents the type of color and is measured in degrees on the color wheel (from 0 to 360). It affects the resulting color by determining where the color falls on the spectrum—red at 0 degrees, green at 120 degrees, blue at 240 degrees, etc. The hue value impacts the basic shade of the color before saturation and lightness are applied .

CSS comments are properly entered using the format /* comment */, where the comment text is enclosed between /* and */. This format ensures that the comment is recognized and does not affect the actual CSS styling .

The keyword 'important!' should be added to a CSS style property to override other styles and inheritance. This is done by appending '!important' to the CSS rule, ensuring it takes precedence over other conflicting styles .

The CSS style to display h1 headings in green text on a yellow background is 'h1 {color: green; background-color: yellow;}'. The 'color' property is used to set the text color to green, and the 'background-color' property sets the background of the element to yellow .

The 'h1' element's font size within a nested structure is computed by multiplying its parent element's font size by the 'em' value specified in the rule. For body {font-size: 16px;} and body > article {font-size: 0.75em;}, the font size for body > article > h1 {font-size: 1.5em;} becomes 0.75 * 16px = 12px for the article, then 1.5 * 12px = 18px for the h1 .

To apply styles only to paragraphs that are direct children of an 'aside' element, the correct selector format is 'aside > p'. This uses the child combinator (>) to ensure that only elements that are direct children, and not just descendants, are selected .

The style rule that removes underlining from anchors within a navigation list is 'nav a {text-decoration: none;}'. This rule targets all 'a' elements (hyperlinks) that are descendants of any 'nav' element, removing default text underlining set by browsers .

To style all 'blockquote' elements with the 'Reviews' class to be italicized and indented, the rule 'blockquote.Reviews { font-style: italic; text-indent: 3em; }' is correct. This styles all blockquote elements with the 'Reviews' class by setting 'font-style' to italic and 'text-indent' to 3em to increase indentation .

You might also like