Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

Doubt using css and class and tag

Hello guys

I have this code:

<html>
	<head>
	</head>
	
	<style>
		h1    {color: blue}
		.book {background-color:yellow}
		.caneta {background-color:green}
		.book:h2 {background-color:pink} 
		body  {background-color:black}
	</style>
	
	<body>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1 class='book'> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1 class='book'> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1 class='caneta'> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1 class='caneta'> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>
	   <h1> Olá, esse é o meu primeiro código html com h1 </h1>	   
	   <h2 class='book'	> Olá, esse é o meu primeiro código html com h2 </h2>	   
	   <h2> Olá, esse é o meu primeiro código html com h2 </h2>

	</body>


</html>

Open in new window


How can I have the background-color of my class='book' and h2 only in pink without afecting the other class='book'?

I want to select it by class and tag

thanks
Alex
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hidrau

ASKER

yeah, you are totaly right. I made a mistake changing the order.
Thanks a lot