Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website Beginning HTML and CSS Write an HTML Element

Supposing that I type: Tito Ngoma. How do i make the fist name green and the second yellow?

Adding CSS to HTML language to change name colors.

2 Answers

Because you are dealing with an inline element... the best solution is to create a class .green and class .yellow in your css and give them the appropriate hex color codes. Then use a span tag to wrap around the text you want to be colored.

Here is an example

<h1><span class="green">Tito</span> <span class="yellow">Ngoma</span></h1>

If you set the color of your h1 to be yellow or green then you only need to use one of the span tags.

Thanks.

Saad Anjum
Saad Anjum
6,408 Points

Try attempting it yourself and post your solution and if doesn't work we can try fixing it.