Become a webdsign master


Using Hyperlinks and CSS in Your Website

A class is the blueprint from whichlink rules in the CSS so they work together.
individual objects are created. In Java, aThe way that it is designed to work in CSS,
class  is  used  to show a set of like items.each selector has specificity. So just like
anything else in the cascade, if there are
Here is an example of a hyper link going to atwo selectors that are both applied to one
site using a class: Elite Web Strategieselement, the one with the higher specificity
a:link { color: #000000; background-color:is applied. If you put them in the wrong
#ffffff } a:visited { color: #0000ff;order, you could end up with a page that
background-color: #ffffff } a:hover { color:isn't showing your style rules as you
#0000ff; background-color: #ffffff } a:activeintended  them.
{ color: #ff0000; background-color: #ffffff }
So  what  is  each  part  used  for?The only two that you can change the order on
are the a:link and a:visited (primarily
* "a:link" will specify what the hyperlinkbecause a link is only either or, never
looks like on the page. * "a:visited" willboth). You can change many things with links,
specify what the hyperlink looks like once itbut always keep in mind that specificity so
has been visited (clicked on). * "a:hover"that  they  show  properly  on  your  page.
shows what the hyperlink will look like when
hovered and * "a:active" specifies what theHere is an example of a potential problem and
active  link  will  look  like.how  it  is  corrected.
In the above example you'll also notice bothProblem Ordera:link { color: #000000;
color and background colors are designated.background-color: #ffffff } a:visited {
Color indicates the actual color of the font,color: #0000ff; background-color: #ffffff }
followed by the hex code for the color youa:active { color: #ff0000; background-color:
want. The background color is the color#ffffff } a:hover { color: #0000ff;
behind the text itself, followed by the hexbackground-color:  #ffffff  }
code  for  that  color.
If you use the above CSS, all of it will work
It's important that these hyperlinks areexcept the active rules. Those will not show.
written in the proper order which is why theyThis is because the active has to come after
are  put  in  a  class  such  as  above.the hover to follow the LVHA format. If the
active is placed before the hover, it breaks
CSS Link Specificity - How to Put Your Linksthat  part  of  the  class.
in  Order
Simply swapping the places of the active and
There is an acronym to help you remember thehover will fix the order of the cascade and
proper order to place your links in. Youallow  it  to  all  work.
might think of something to help you remember
it easier but some people simply rememberCorrect Ordera:link { color: #000000;
LVHA. This simple acronym, LVHA will help youbackground-color: #ffffff } a:visited {
get your hyperlinks in the right order everycolor: #0000ff; background-color: #ffffff }
time.a:hover { color: #0000ff; background-color:
#ffffff } a:active { color: #ff0000;
LVHA  stands  for:background-color:  #ffffff  }
1. a:link 2. a:visited 3. a:hover 4. a:activeFollowing the LVHA rules will help you keep
your CSS hyperlinks in the right order to
LVHA is the order you should designate yourcomply with W3C.



1 A B C D E 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128