Give a paragraph a red colour using the style attribute.
Acceptance criteria
- 1.Give a paragraph a red colour using the style attribute.
HTML Tutorial · HTML Basics
These 10 tasks go with the HTML Styles chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “HTML allows you to style your web page content to make it visually appealing. Styles define colors, fonts, spacing, and layout of elements. You can apply styles inline , internally, or externally using CSS.” .
1.Add an inline styleexercise · easy · 10 min
Give a paragraph a red colour using the style attribute.
Passes when: Give a paragraph a red colour using the style attribute.
2.Add a classexercise · easy · 10 min · practice plan
Give a paragraph the class "lead".
Passes when: Give a paragraph the class "lead".
3.Add an idexercise · easy · 10 min · practice plan
Give a section the id "main".
Passes when: Give a section the id "main".
4.Combine class and styleexercise · easy · 10 min · practice plan
Give a div both a class of "box" and an inline background.
Passes when: Give a div both a class of "box" and an inline background.
5.Style two elements with one classexercise · medium · 10 min · practice plan
Give two paragraphs the same class "note".
Passes when: Give two paragraphs the same class "note".
6.Fix the wrong attribute namebug fix · easy · 8 min
"styles" is not a real attribute.
Passes when: "styles" is not a real attribute.
7.Fix the class written as a selectorbug fix · easy · 8 min · practice plan
The class value should not include the dot.
Passes when: The class value should not include the dot.
8.Fix the id written with a hashbug fix · easy · 8 min · practice plan
The id value should not include the #.
Passes when: The id value should not include the #.
9.Fix the extra classbug fix · easy · 8 min · practice plan
A stray second class was left on the element.
Passes when: A stray second class was left on the element.
10.Fix the duplicated class attributebug fix · easy · 8 min · practice plan
The element has two class attributes; only the first counts.
Passes when: The element has two class attributes; only the first counts.
Between them these tasks cover style attribute, class attribute and Inline styling.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.