The links are the elements that helped build the network that we know today. It seems that now other technologies are helping “the network” grow, such as asynchronous data requests AJAX, application mashups,… Although in the background we will always continue to have links. And all this stuff, for what? Well, the truth is that I didn’t know how to enter the links either. The idea of this example is to highlight the links with CSS. To make them more visible.
To do this we are going to rely on the style sheets and more specifically on the property
background-color
, which we can apply to almost any element on the page.
In our case we will apply the style on the element a
, which represents the links. In this way we will have the following style CSS:
a {
background-color:#ff0
}
The code used #ffff00 is the color yellow. This code is RGB where the first two hexadecimal values reflect the color red, the second the color green and the last the color blue. Their mixture generates a color.
It must be taken into account that the element a
Several behaviors are known:
- link, when the link has not yet been visited
- hover, when we are above the link
- visited, when the link has been visited
So for our example of highlighting links with CSS we will assign a highlight color when we hover over the link. Although we could do it with the other two behaviors.
The code to highlight links with CSS would finally look like this:
a:hover {
background-color:#ff0;
}
The code of element style
of the CSS will go inside the header of the page HTML.
