How do I apply bgcolor to a specific paragraph not the whole body | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I apply bgcolor to a specific paragraph not the whole body

Html

29th Apr 2020, 11:05 AM
Lesego Modise
Lesego Modise - avatar
7 Answers
+ 3
In css p{ Background-color:blue; } In html <Head> <style> p{ Background-color:blue; } </style> </head> Learn css
29th Apr 2020, 11:11 AM
Abhay
Abhay - avatar
+ 2
Go to your paragraph which is obviosly <p>Your Paragraph</p>.. Then put 'class' attribute inside the first <p>.. you get👇👇 <p class="paragraph">Your Paragraph</p> Then go to css section.. Start with a dot and write paragaph(which is is your value.. it can be anything you asign it to) like this👇 .paragraph{ background-color: red; color:black; } Try it.. but you should learn CSS, which is pretty easy to learn
29th Apr 2020, 8:00 PM
Yasin Ndaba
Yasin Ndaba - avatar
+ 1
Thanks Abhay🤓
29th Apr 2020, 11:13 AM
Lesego Modise
Lesego Modise - avatar
0
It's not responding!
29th Apr 2020, 11:52 AM
Lesego Modise
Lesego Modise - avatar
0
Yup because it is background-color ,small b ,sorry forgot to change
29th Apr 2020, 11:59 AM
Abhay
Abhay - avatar
0
Is the p the one before a paragraph <p? Or I apply separately before a paragraph?
29th Apr 2020, 12:03 PM
Lesego Modise
Lesego Modise - avatar
0
You can do inline styling by applying the desired style in the opening tag eg.<p bgcolor="blue"></p> Or you do external css by giving the assigning an id or class to the <p> eg. <p id="1"></p>or<p class="1"></p>, then go to css and apply the styles. Remember for id use '#1' to identify the id and '.1' to identify class.
30th Apr 2020, 6:43 AM
Nchinda Boris