Skip to content

Latest commit

 

History

History
64 lines (56 loc) · 1.1 KB

ex_18.md

File metadata and controls

64 lines (56 loc) · 1.1 KB

Exercise 18

  • Create the following folder/file structure:
/ex_18
  |-- index.html

index.html

  • Create a basic HTML document
  • Create a script tag on the document head element
  • Add the following html code
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Attributes</title>
  <style>
    a {
      font-family: Arial, Helvetica, sans-serif;
    }

    .menu {
      display: block;
      width: 400px;
      border: 1px solid black;
      background-color: #eee;
      padding: 5px 0 5px 10px; 
    }

    a.menu {
      color: black;
      text-decoration: none;
    }

    a.menu:hover {
      background-color: #DDD;
    }

    a.green {
      color: green;
    }
    a.azul {
      color: blue;
    }
    a.rojo {
      color: red;
    }
  </style>
</head>
<body>
  <a href="#" class="menu">Link 1</a>
  <a href="#" class="menu">Link 2</a>
  <a href="#" class="menu">Link 3</a>
  <a href="#" class="menu">Link 4</a>
  <a href="#" class="menu">Link 5</a>
</body>
</html>
  • Select the first link element
  • Add the blue class if the element has the class attribute
  • If not, then add the red class