Hey Daniwebs members :)

Was wondering if any one could tell me how to add the mouseover to links? because i've tried applying the style sheet, but it doesnt seem to be working :( Can someone tell me how to do this pleaseeeeeeeeeeeee :)

Recommended Answers

All 7 Replies

a:hover
{
  background-color: blue;
  color: white;
}
a:hover
{
  background-color: blue;
  color: white;
}

Thanks for the info, but where in the coding do i apply this? :S

external stylesheet

<html>
<head>
<link rel="stylesheet" type="text/css" href="http://www.yoursite.com/style.css">
</head>
<body>
bla bla bla
</body>
</html>

with style.css containing amid the other styles

a:hover { background-color: blue; color: white; }

header styles

<html>
<head>
<style type='text/css'>
<!--
a:hover { background-color: blue; color: white; }
-->
<style>
</head>
<body>
bla bla bla
</body></html>

inline styles

<html>
<head>
</head>
<body>
<a href='thisfile' style="hover { background-color: blue; color: white; }" > thisfile </a>
</body>
</html>

most use external stylesheets
only one file need be altered to update the whole site
header styles, contain the full stylesheet in every page
inline styles contain the full style in every link on every page
they get exponentially bigger
each has a purpose
external stylesheet to style a site
header style to make a single page different
inline style to make a single element different

external stylesheet[code=html]
<html>
<head>
<style type='text/css'>
<!--

There is no need to comment out the style rules, and hasn't been since Netscape 4.

<a href='thisfile' style="hover { background-color: blue; color: white; }" > thisfile </a>

Where did you come up with that? It's nonsense! Did you even try it?

never left out a colon?
its a typo, Human error <a href="http://www.w3.org/style/CSS" style="{color: blue; background: white} :visited {color: green} :hover {background: yellow} :visited:hover {color: purple} "> Example of a hyperlink to the CSS home page with special one-off visited and hover effects. </a>

never left out a colon?
its a typo, Human error <a href="http://www.w3.org/style/CSS" style="{color: blue; background: white} :visited {color: green} :hover {background: yellow} :visited:hover {color: purple} "> Example of a hyperlink to the CSS home page with special one-off visited and hover effects. </a>


That even more bizarre. Does it work anywhere?

Thanks for all the help guys, but can someone classify which is the best to implement on a site, because its confusing as people are saying some are really old, dont work at all etc.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.