lunes, 6 de septiembre de 2021

CSS Walk 4 Links

CSS Walk  4 Links

 


 Let´s work with the following html file
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CSS course</title>
    <link rel="stylesheet" type="text/css" href="./css/styles.css" />
  </head>
  <body>
    <a href="https://jalbertomr.blogspot.com">Link to Page A</a>
    <a href="https://jalbertomr.blogspot.com">Link to Page A</a>
    <a href="https://jalbertomr.blogspot.com">Link to Page A</a>
    <a href="https://jalbertomr.blogspot.com">Link to Page A</a>
    <a href="https://jalbertomr.blogspot.xyz/notapage/xyz">Link to Page B</a>
  </body>
</html>

browser output
 

Once we access to one link, the color of the anchor link change from blue to darkpink
 

let's change the styles.css file

a {
  colordarkolivegreen;
  font-size20px;
  text-decorationnone;
}

browser output, size, color and underline changes
 

Let´s adjust the margins top, left, bottom, right

a {
  font-size25px;
  text-decorationnone;
  margin10px 20px 10px 0px;
}

If we do click and sustain it, the color of the link change to red, this is a click state.


So there are states for the links
 
- visited.
- not visited.
- onClick (link)
- over       (mouse over)
- active    (once clicked)

Pseudoclases


To change the anchor link we use pseudoclasses. a:link for the unvisited links, a:hover for the mouse over.

a {
  font-size25px;
  text-decorationnone;
  margin10px 20px 10px 0px;
}

a:link {
  colordarkorange;
}

a:hover {
  text-decorationunderline;
  backgroundroyalblue;
  colorskyblue;
}


browser output:

 Let´s adjust the padding and the left, right margin for the anchor link to the box to make it more bigger.

a {
  font-size20px;
  text-decorationnone;
  padding10px 20px;
  margin10px 0px 10px 0px;
}

a:link {
  colordarkorange;
}

a:hover {
  text-decorationunderline;
  backgroundroyalblue;
  colorskyblue;
}
 
browser output:
 
 

let's add the pseudoclases to active and visited
a {
  font-size20px;
  text-decorationnone;
  padding10px 20px;
  margin10px 0px 10px 0px;
}

a:link {
  colordarkorange;
}

a:hover {
  text-decorationunderline;
  backgroundroyalblue;
  colorskyblue;
}

a:visited {
  colordarkslategray;
}

a:active {
  backgroundrgb(2551020);
}

 
browser output:
 

Let's modify the css file to make the anchor look like a button

a {
  font-size20px;
  text-decorationnone;
  backgroundrgb(65134225);
  colorwhite;
  padding10px 20px;
  margin10px 0px 10px 0px;
  box-shadow0px 5px 0px rgba(11940.521);
}

a:hover {
  backgroundrgb(80149240);
  box-shadow0px 3px 0px rgba(11940.521);
}

a:active {
  backgroundrgb(90159250);
  colorlightgrey;
  box-shadow0px 0px 0px rgba(11940.521);
}

 
browser output:
 


Let´s adjust a little more, the space between anchors with margin and the box-shadow vertical, horizontal and size of shadow
 
a {
  font-size20px;
  text-decorationnone;
  backgroundrgb(65134225);
  colorwhite;
  padding10px 20px;
  margin10px 5px 10px 0px;
  box-shadow5px 5px 3px rgba(11940.521);
}

a:hover {
  backgroundrgb(80149240);
  box-shadow3px 3px 3px rgba(11940.521);
}

a:active {
  backgroundrgb(90159250);
  colorlightgrey;
  box-shadow0px 0px 0px rgba(11940.521);
}


browser output:
 



 
 
eot

No hay comentarios:

Publicar un comentario