<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  xmlns="http://www.w3.org/1999/xhtml"  
  url="/viewsource/2003/missing-link/"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en">

  <nde:header>
    <nde:title>The Search for the Missing Link</nde:title>
    <nde:category>Article</nde:category>
    <nde:pubdate year="2003" month="05" day="30" />
    <nde:channels>
      <nde:channel id="viewsource" />
      <nde:channel id="css" />
    </nde:channels>
    <nde:keywords>
      css, css2, xhtml, link, hover
    </nde:keywords>
    <nde:summary>
Sometimes, a Web design can make links look so much like regular text that it's hard to see a difference between the two.  Contributor Stuart Robertson shows how to take advantage of CSS hover styles to make the links stand out.
    </nde:summary>  
    <nde:authlist>
      <nde:author>
        <nde:authname>Stuart Robertson</nde:authname>  
        <nde:authaffil>DesignMeme</nde:authaffil>
      </nde:author>
    </nde:authlist>
  
  </nde:header>

  <nde:head>
<style type="text/css">
#nde-pubmod, #nde-author {margin-bottom: 0 !important;}

.example {
   border: 1px solid #CCC;
   background: #EEE;
   padding: 1em;}
}
.example p {
	color: #333333;
	padding-right: 100px;
	padding-left: 100px;
	}
.example p a {
	color: #666666;
	text-decoration: none;
	}
.example p:hover a { 
	color: blue;
	text-decoration: underline;
	}
.example p a:hover { 
	color: red;
	}
	
.copyright{
	font-size: 10px;
	color: #999999;
	text-align: right;
</style>
  </nde:head>

  <nde:content>
     <ul class="nde-metadata">
       <li>© Copyright 2003 Stuart Robertson.  <a href="http://www.designmeme.com/articles/missinglink.shtml">Reprinted</a> with permission.</li>
     </ul>
  

<h2>The Problem</h2>
  
    <p>Cascading Style Sheets (CSS) give designers greater control over the appearance 
      of web pages, allowing them to easily change the default colour and remove 
      the underlines from a page's links to more closely blend with the rest of 
      the text on a page. With thoughtful use of colour and typography, links 
      can be made less of a visual disruption, creating pages that are more aesthetically 
      pleasing and text that is easier to read. </p>
    <p>However, if the style of a page's links is too close to that of the text 
      on the rest of the page, it can be difficult for users to see the links 
      at all. In particular, users who have poor eyesight or are colour blind might have 
	  trouble finding the links on an otherwise well designed page. </p>

<h2>The Solution</h2>
    <p>The pseudo-class selector <code>:hover</code> is commonly 
      used to create a rollover effects on links, often changing them from a subtle 
      to more obvious contrast with the surrounding text. While this can be helpful 
      for users looking for hard to find links on a page, it still requires they 
      move their cursor over the link before it is revealed. </p>
    <p>Modern browsers are now beginning to support the <code>:hover</code> 
      pseudo-class to create rollover effects on other elements as well. This 
      lets us create a rollover effect on a paragraph, or other section of 
      text. Being able to set the style for an element's rollover state also allows 
      us to control the style of elements <i>within</i> the element that is being 
      rolled over. The links within a paragraph which might be subtle and unobtrusive, 
      can be revealed by moving the cursor over the entire paragraph. </p>

<h3>Example</h3>

    <p>As of this writing most web browsers, including all versions of Internet 
      Explorer, only supports the <code>:hover</code> pseudo-element 
      on links. Hopefully this will change in future versions. Until then, the 
      following example will work in <a href="http://www.mozilla.org/">Mozilla</a>, 
	  <a href="http://www.netscape.com">Netscape 6+</a>, <a href="http://www.opera.com">Opera 7</a>, 
	  <a href="http://www.apple.com/safari">Safari</a>, 
      and <a href="http://www.konqueror.org/">Konqueror</a>.</p>
    <p>Mouse over the paragraph below to reveal the links:</p>

    <div class="example"> 
      <p><b>human evolution</b></p>
      <p>theory of the origins of the human species, <i>Homo sapiens.</i> Modern 
        understanding of human origins is derived largely from the findings of 
        <a href="http://www.bartleby.com/65/pa/paleonto.html">paleontology</a>, 
        <a href="http://www.bartleby.com/65/an/anthrpgy.html">anthropology</a>, 
        and <a href="http://www.bartleby.com/65/ge/genetics.html">genetics</a>, 
        and involves the process of natural selection (see <a href="http://www.bartleby.com/65/da/Darwinis.html">Darwinism</a>). 
        Although gaps in the fossil record due to differential preservation prevent 
        the complete specification of the line of human descent, <i>H. sapiens</i> 
        share clear anatomical, genetic, and historic relationships to other <a href="http://www.bartleby.com/65/pr/primate.html">primates</a>. 
        Of all primates, humans bear particularly close affinity to other members 
        of a group known as hominoids, or <a href="http://www.bartleby.com/65/ap/ape.html">apes</a>, 
        which includes <a href="http://www.bartleby.com/65/or/oranguta.html">orangutans</a>, 
        <a href="http://www.bartleby.com/65/gi/gibbon.html">gibbons</a>, <a href="http://www.bartleby.com/65/go/gorilla.html">gorillas</a>, 
        <a href="http://www.bartleby.com/65/ch/chimpanz.html">chimpanzees</a>, 
        and humans. Humans and their immediate ancestors, known as hominids, are 
        notable among hominoids for their bipedal locomotion, slow rate of maturation, 
        large brain size, and, at least among the more recent hominids, the development 
        of a relatively sophisticated capacity for language, tool use, and social 
        activity.</p>

      <p class="copyright"><ent:copy/> 2003 <ent:mdash/> The Columbia Encyclopedia, Sixth 
        Edition</p>
    </div>

    <h3>Code</h3>
    <p>Here is an example of the CSS used to create this effect:</p>
    <div class="code">
      <p>/* Paragraph text */<br />

        p {<br />
        color: #333333<br />
        }</p>
      <p>/* Links within paragraphs (subtle) */<br />
        p a {<br />
        color: #666666;<br />

        text-decoration: none;<br />
        }</p>
      <p>/* Links within paragraphs (revealed) */<br />
        p:hover a { <br />
        color: blue;<br />
        text-decoration: underline;<br />

        }</p>
      <p>/* Rollover effect for links within paragraphs */<br />
        p a:hover { <br />
        color: red;<br />
        }</p>
    </div>

    
</nde:content>

<nde:related area="nde">
 <nde:item url="/central/css/">CSS Central</nde:item>
 <nde:item url="/viewsource/2003/arbitrary-hover/">Issues Arising From Arbitrary-Element Hover</nde:item>
</nde:related>

<nde:related area="ext">
 <nde:item url="http://www.designmeme.com/">DesignMeme</nde:item>
</nde:related>

</nde:article>
