This forum is now read-only. Please use our new forums! Go to forums
What if I want two or three or four different Paragraphs to be all seperate colors?
Does CSS only apply to ALL of a certain SELECTOR? or can I pick and choose different colors, fonts, sizes but for the same type of selector? Example:
< p >This is a sentence.< /p >”
< p >This is another sentence.< /p >
So, can I choose, lets say, two different colors for the two different sentences in CSS? or because there is more than one, I now have to edit their styles individually in HTML?
Answer 53ed1141282ae3b406000137
You can using IDs or classes. To target specific sections like
‘s. Hope this helps.
Here is the html and css for an example of using divs and classes. HTML:
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css">
</head>
<body>
<p id="one"><p>Sample Text one</p>
<p id="two"><p>Sample Text two</p>
<p class="three">Sample Text three</p>
<p class="four">Sample Text four</p>
</body>
</html>
CSS:
#one{
font-family: 'Impact';
color: red;
font-size: 25px;
}
#two{
font-family: 'Times New Roman';
color: blue;
font-size: 50px;
}
.three{
font-family: 'Impact';
color: red;
font-size: 25px;
}
.four{
font-family: 'Times New Roman';
color: blue;
font-size: 50px;
}
Answer 53ed6c367c82caa2df0006a1
Ah thank you! That makes so much sense now! I am about to learn IDs and Classes so I think I got too far ahead of myself xD
Thanks again!
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
perfect soln!!!!