+ 1

Need help for paragraph background color.

Hi guys. This is my code: <body background="http://7wallpapers.net/wp-content/uploads/2_Hearthstone-League-of-Explorers.jpg" > <div> <h1>The Inn</h1> </div> <div> <ul> <li><a href="https://theinnweb.wordpress.com/">Home</a></li> <li><a href="https://theinnweb.wordpress.com/2017/05/23/hearthstone-quiz-part-5/">Quizzes</a></li> <li><a href="https://theinnwild.wordpress.com/">Wild Decks</a></li> <li><a href="News">News</a></li> </ul> </div> <div> <p> Welcome to "The Inn"! Home for all gamers! </p> <h2><strong>About</strong></h2> <p> This website is about "Blizzard" games, but mainly for Hearthstone. There will be alot of World of Warcraft,Overwatch and Heroes of the Storm posts aswell</p> </div> </body> So what i want is to make my second paragraph to have background color. Can you tell me what code should i type on CSS? Thank you.

30th May 2017, 11:20 AM
Edmon Belchev
Edmon Belchev - avatar
4 Antworten
+ 1
div > p:nth-of-type(2) { background-color: red; }
30th May 2017, 11:35 AM
Madera Oxidada
Madera Oxidada - avatar
+ 1
No probs
30th May 2017, 11:46 AM
Madera Oxidada
Madera Oxidada - avatar
+ 1
But you should be aware that this will put background color to EVERY second p inside a div. To make it special you should add an id or class to the div and change accordingly in the CSS.
30th May 2017, 11:47 AM
Madera Oxidada
Madera Oxidada - avatar
0
Thank you!
30th May 2017, 11:38 AM
Edmon Belchev
Edmon Belchev - avatar