HTML – Working with colour

  1. Which HTML attribute is used to set the text color?
    a) text
    b) fgcolor
    c) color
    d) style
    Answer: d) style

  2. What is the correct syntax to set text color to red using inline CSS?
    a) <p color="red">
    b) <p style="color: red;">
    c) <p text="red">
    d) <p fgcolor="red">
    Answer: b) <p style="color: red;">

  3. Which property is used in CSS to change background color?
    a) bgcolor
    b) background-color
    c) backcolor
    d) color-background
    Answer: b) background-color

  4. Which HTML tag supports the bgcolor attribute in older HTML versions?
    a) <body>
    b) <p>
    c) <span>
    d) <title>
    Answer: a) <body>

  5. How do you set a background color to yellow using inline style?
    a) <div style="bgcolor: yellow;">
    b) <div style="background-color: yellow;">
    c) <div bg="yellow">
    d) <div background="yellow">
    Answer: b) <div style="background-color: yellow;">

  6. Which color format is not valid in CSS?
    a) Named colors
    b) HEX codes
    c) RGB values
    d) YUV codes
    Answer: d) YUV codes

  7. Which of the following is a valid HEX color code?
    a) #123456
    b) #12G45F
    c) #ZZZZZZ
    d) #1234
    Answer: a) #123456

  8. What is the HEX code for white?
    a) #000000
    b) #FFFFFF
    c) #FFFF00
    d) #FF00FF
    Answer: b) #FFFFFF

  9. What is the RGB code for black?
    a) rgb(255,255,255)
    b) rgb(0,0,0)
    c) rgb(0,255,0)
    d) rgb(255,0,0)
    Answer: b) rgb(0,0,0)

  10. Which format allows color with transparency in CSS?
    a) HEX
    b) RGB
    c) RGBA
    d) HSL
    Answer: c) RGBA


  1. What does the “A” stand for in RGBA?
    a) Angle
    b) Alpha (transparency)
    c) Area
    d) Amount
    Answer: b) Alpha (transparency)

  2. Which color name is valid in HTML?
    a) brightblue
    b) neonorange
    c) dodgerblue
    d) supergreen
    Answer: c) dodgerblue

  3. What is the default text color of a webpage?
    a) Black
    b) Blue
    c) Gray
    d) Depends on browser
    Answer: d) Depends on browser

  4. Which tag can use the color property in CSS?
    a) All text tags
    b) Only <p>
    c) Only <span>
    d) Only <div>
    Answer: a) All text tags

  5. Which tag can use the bgcolor attribute directly in HTML 4.01?
    a) <table>
    b) <tr>
    c) <td>
    d) All of the above
    Answer: d) All of the above

  6. How many characters are in a full HEX color code?
    a) 3
    b) 4
    c) 6
    d) 8
    Answer: c) 6

  7. What is the short HEX code for black?
    a) #000
    b) #FFF
    c) #F0F
    d) #F00
    Answer: a) #000

  8. What is the RGB value for pure red?
    a) rgb(255,0,0)
    b) rgb(0,255,0)
    c) rgb(0,0,255)
    d) rgb(128,128,128)
    Answer: a) rgb(255,0,0)

  9. Which HSL value defines blue color?
    a) hsl(0, 100%, 50%)
    b) hsl(120, 100%, 50%)
    c) hsl(240, 100%, 50%)
    d) hsl(60, 100%, 50%)
    Answer: c) hsl(240, 100%, 50%)

  10. Which color value allows brightness control using lightness?
    a) HEX
    b) RGB
    c) HSL
    d) CMYK
    Answer: c) HSL


  1. Which of the following sets text color to blue using CSS?
    a) style=”font: blue”
    b) style=”text-color: blue”
    c) style=”color: blue”
    d) style=”fontcolor=blue”
    Answer: c) style=”color: blue”

  2. What value of alpha gives full transparency in RGBA?
    a) 0
    b) 0.5
    c) 1
    d) -1
    Answer: a) 0

  3. What value of alpha gives full opacity in RGBA?
    a) 1
    b) 0
    c) 255
    d) 100
    Answer: a) 1

  4. Which of these color codes is invalid?
    a) #abc
    b) #aabbcc
    c) rgb(255, 255, 255)
    d) #abcd
    Answer: d) #abcd

  5. Which tool is used to pick a color from the screen?
    a) Color Wheel
    b) Eyedropper
    c) Brush
    d) Eraser
    Answer: b) Eyedropper

  6. How do you make background fully transparent?
    a) background-color: transparent;
    b) background-color: rgba(0,0,0,1);
    c) background-color: none;
    d) background: 0%;
    Answer: a) background-color: transparent;

  7. What is the default background color of HTML pages?
    a) White
    b) Gray
    c) Transparent
    d) Browser-defined
    Answer: d) Browser-defined

  8. How many named colors are supported in HTML5?
    a) 16
    b) 50
    c) 140
    d) Unlimited
    Answer: c) 140

  9. Which of these is a valid named color in HTML?
    a) skyblue
    b) lemonyellow
    c) firebrick
    d) neongreen
    Answer: c) firebrick

  10. Which color is represented by #00FF00?
    a) Red
    b) Blue
    c) Green
    d) Cyan
    Answer: c) Green


  1. Which format is supported for coloring in inline CSS?
    a) HEX
    b) RGB
    c) RGBA
    d) All of the above
    Answer: d) All of the above

  2. Which tag will inherit color from parent by default?
    a) <span>
    b) <div>
    c) <p>
    d) All of the above
    Answer: d) All of the above

  3. Which of the following is used to apply color only to one word in a sentence?
    a) <p>
    b) <span>
    c) <div>
    d) <section>
    Answer: b) <span>

  4. What is the valid CSS color value for semi-transparent red?
    a) rgba(255, 0, 0, 0.5)
    b) rgb(255, 0, 0, 0.5)
    c) red, 0.5
    d) #FF000080
    Answer: a) rgba(255, 0, 0, 0.5)

  5. What does color: inherit; do?
    a) Sets default browser color
    b) Uses color of parent element
    c) Applies white color
    d) Makes text invisible
    Answer: b) Uses color of parent element

  6. Which CSS property is used to change the border color?
    a) border-style
    b) border-color
    c) outline-color
    d) edge-color
    Answer: b) border-color

  7. Which attribute in HTML4 was used to change color of links?
    a) color
    b) link
    c) text
    d) a-color
    Answer: b) link

  8. Which attribute in HTML was used to change visited link color?
    a) color
    b) visited
    c) vlink
    d) link-color
    Answer: c) vlink

  9. Which value is correct for applying a color using HSL format?
    a) hsl(0-360, %, %)
    b) hsl(255, 255, 255)
    c) hsl(#00ff00)
    d) hsl(12,12,12)
    Answer: a) hsl(0-360, %, %)

  10. Which one is the most flexible format for web designers to control transparency?
    a) RGB
    b) RGBA
    c) HEX
    d) Named Colors
    Answer: b) RGBA


  1. Which CSS property controls text color?
    a) font-color
    b) color
    c) text-color
    d) color-text
    Answer: b) color

  2. Which of these does NOT affect color rendering in browser?
    a) Monitor calibration
    b) Browser settings
    c) Internet speed
    d) CSS applied
    Answer: c) Internet speed

  3. Which function defines transparency level in HSL format?
    a) opacity
    b) alpha
    c) hsla
    d) none
    Answer: c) hsla

  4. What is the value range for red in RGB?
    a) 0 to 255
    b) 0 to 100
    c) 1 to 100
    d) 0 to 1
    Answer: a) 0 to 255

  5. Which color property value is invalid?
    a) #FFF
    b) red
    c) rgb(256,0,0)
    d) rgba(0,0,0,0.5)
    Answer: c) rgb(256,0,0)

  6. How can you apply background color to the whole page?
    a) <body style="background-color: lightblue;">
    b) <head style="background-color: lightblue;">
    c) <title style="bgcolor: lightblue;">
    d) <html style="background: lightblue;">
    Answer: a) <body style="background-color: lightblue;">

  7. What is the color of #FF0000?
    a) Green
    b) Blue
    c) Red
    d) Yellow
    Answer: c) Red

  8. Which one is not a valid CSS color format?
    a) rgba(255, 0, 0, 0.5)
    b) #FF00FF
    c) color=red
    d) hsl(0, 100%, 50%)
    Answer: c) color=red

  9. Which color format uses a percentage for saturation and lightness?
    a) RGB
    b) RGBA
    c) HSL
    d) HEX
    Answer: c) HSL

  10. What is the difference between transparent and rgba(0,0,0,0)?
    a) No difference
    b) transparent is a keyword
    c) transparent does not work in older browsers
    d) rgba is slower
    Answer: b) transparent is a keyword

error: Content is protected !!