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
Anne Hennegar
9,164 PointsCSS Conundrum for Mixed Font and Colors
I'm thinking there is an easy solution for this, but it's escaping me at the moment.
I need to be able to use CSS to handle this scenario
Current code:
<h3>Day 1 & 2 <em>New York City</em></h3>
I need to:
- Make "Days 1 & 2" in one font and the color brown
- Make "New York City" in a different font and the color green
This scenario repeats for a number of days with different cities.
H3 is already defined as the font used for Days 1 & 2.
Can I rewrite to something like what's below and then define the "city" with the new font, italics and color?
<h3>Day 1 & 2 <span class="city">New York City</span></h3>
2 Answers
Hugo Paz
15,622 PointsHi Anne,
I edited your post so it would show the code correctly. Please press the edit post button to see how i did it. It makes it easier for other people to help.
Regarding your question, yes that is what you should do. Set a new font and color in that span.
.city{
font-family: /* the font you want*/
color: /* the color you want*/
}
Anne Hennegar
9,164 PointsThanks folks. I apologize on the markdown issue. I never noticed the cheatsheet link below. I'll play around with it as well as the suggestion.
I do find the markdown on my edited post to very hard to read. I can barely make out the "New York City" gray text on the black background.
Christopher Aporta
24,258 PointsChristopher Aporta
24,258 PointsAnne,
I'm having trouble following your question, but I'd love to help. Could you either post your code using Markdown (cheatsheet below) directly into this thread like so...
or build a pen for reference?
Thanks!
Chris