Programming in HTML5 with JavaScript and CSS3 — Question 65
Which CSS3 code segment styles the text color of EM elements to be red and semi-transparent?
Answer options
- A. em { color: #ff00007f; }
- B. em { color: rgba (255,0,0,0.5); }
- C. em { color: rgba (255,0,0.127); }
- D. em { color: rgba (100%,0%,0%, 50%); }
Correct answer: B
Explanation
The correct answer is B because it uses the rgba function to set the red color with 50% opacity, making it semi-transparent. Option A is incorrect due to the use of an invalid hex code format for transparency. Option C has a wrong alpha value that doesn't achieve the desired semi-transparency, and option D incorrectly uses percentage values which are not valid for rgba.