+ 1

How to change <p> in css

Hello guys , im new here and my question is - if i have 2-3 <p> how can i make different style (in css) one by one not to all <p> at the same time . Tnx pre

9th Nov 2016, 7:30 PM
Mladen Uzunov
Mladen Uzunov - avatar
5 Réponses
+ 6
You can add an id or a class. an ID : in HTML it will be : <p> </p> <p id="ID1"> ... </p> <p id="ID2"> ...</p> In the CSS you'll use the following to change the style of the second and the 3rd paragraphs with a different style for each one of them : #ID1{ color:red; } #ID2 { color:blue; } The first paragraph won't change, the second will have a red color and the 3rd will be blue. An ID is unique, so you can use it when you want to have a unique style for that element. If for example you want to change the second and the 3rd paragraphs both to red, you can use a class this way : in HTML it will be : <p> </p> <p class="red"> ... </p> <p id="red"> ...</p> in the CSS you'll use the following to change the style of the second and the 3rd paragraphs both to red : .red{ color:red; } You can also use nth-child () selector.
9th Nov 2016, 7:41 PM
User3827
+ 4
hi you can set class or id to p tag : <p class="firstpclass"></p>
9th Nov 2016, 7:39 PM
Payam Omrani
Payam Omrani - avatar
+ 1
Thanks you so much
9th Nov 2016, 7:42 PM
Mladen Uzunov
Mladen Uzunov - avatar
0
what should i write in css firstpclass {} ?
9th Nov 2016, 7:41 PM
Mladen Uzunov
Mladen Uzunov - avatar
0
how can add html language in challenge
11th Nov 2016, 8:58 PM
Mohammad Bilal
Mohammad Bilal - avatar