Course: Selectors

Life isn't easy without selectors [1/18]

Using selectors, you can point CSS properties at specific elements very precisely. Selectors are our sniper scope, and in this course you will learn how to use it.

Since the purpose of the course is to teach you to "shoot at elements using properties", the biathlon theme could not have been more befitting. In each task, you'll use selectors to flip targets.

But let's imagine, just for a moment, that there is no such mechanism as selectors available. How could we have assigned CSS properties to elements in such a case? Well, we have the style attribute, ultimately. For example:

<p style="color: red;">...</p>

Do it
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Life isn't easy without selectors</title> <link rel="stylesheet" href="/assets/course8/course-1.css"> </head> <body> <ul class="target"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> </body> </html>
HTML Academy
  1. Flip all targets by adding to each list item the style attribute with background-color: white;.
Theory Check Next