Menu
×
×
Correct!

Exercise:

Change the color of all <p> elements, that are descendants of <div> elements, to "red".

Hint: To select descendants, separate the selectors with space.

Edit This Code:
x
 
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<div>
  <p>This is a paragraph inside a div element.</p>
  <p>This is another paragraph inside a div element.</p>
  <span><p>This a paragraph inside a span element, inside a div element.</p></span>
</div>
<p>This is a paragraph, not inside a div element.</p>
<p>This is another paragraph, not inside a div element.</p>
</body>
<!-- Mirrored from www.w3schools.com/css/exercise.asp?filename=exercise_combinators1 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 13:17:03 GMT -->
</html>
Result:
Correct Code:
xxxxxxxxxx
Result:
Go to w3schools.com
Reset Score
Close This Menu

Completed 0 of 138 Exercises:

CSS Syntax
CSS How To...
CSS Background
CSS Border
CSS Margin
CSS Padding
CSS Height/Width
CSS Box Model
CSS Outline
CSS Text
CSS Font
CSS Links
CSS Lists
CSS Tables
CSS Display/Visibility
CSS Positioning
CSS Overflow
CSS Align
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Opacity
CSS Attribute Selectors
CSS Rounded Corners
CSS Border Images
CSS Backgrounds
CSS Colors
CSS Gradients
CSS Shadow Effects
CSS Text
CSS Web Fonts
CSS 2D Transforms
CSS 3D Transforms
CSS Transitions
CSS Animations





×

Reset the Score?

This will reset the score of ALL 138 exercises.

Are you sure you want to continue?



×

Congratulations!

You have finished all 138 CSS exercises.

Share your score on facebook:



Get Certified!

Take our CSS Developer Certificate to prove that you have fundamental knowledge of web development using CSS.