Making a link hover background

I have a side navigation with six links. To each link I assinged a different class so it could have a separate background. (I used background images instead of making the links themselves into images, thus making the site easier to read for the visually impared.) Now I want to make a different background for each link upon mouse hover. What do I attach to the CSS code to do this? I know I need a compound rule, I just can't figure out what to specify to it. I'll give the line of code for one link if that helps:
.container .body .sidebar1 .nav li .videogallerylink

Torkuda1234 wrote:
"Or do you want every single individual link to have its own unique background on hover?"
Yes, that!
So use the technique shown in Nancy's link by applying a unique class to each link and applying the CSS
from the CSS
.nav li a.link1:link, .nav li alink1:visited {
    background-image: url(../images/photo%20link.jpg);
.nav li a.link1:hover, .nav li a.link1:active {
    background-image: url(../images/IMAGE-ON-HOVER.jpg);
.nav li a.link2:link, .nav li alink2:visited {
    background-image: url(../images/photo%20link.jpg);
.nav li a.link2:hover, .nav li a.link2:active {
    background-image: url(../images/SECOND-IMAGE-ON-HOVER.jpg);
from the HTML
<ul class="nav">
        <li><a href="#" class="link1">Photo Gallery</a></li>
        <li><a href="#" class="link2">Another link</a></li>
      </ul>

Similar Messages

  • Linked Image with CSS Hover background Color Jerks in IE8

    Please see http://www.rrmuseumpa.org/about/musviews/index.shtml and hover over any of the five slideshow images, using IE8. Note that the hover causes a jerk when the assigned background color for hover kicks in, apparently by adding some vertical margin at botton. It's fine in all other browsers.
    What I want is for any image that serves as a link to not have a border and to not pick up the default hover background color, and to not cause the "jerk" in IE8.
    CSS file is at http://www.rrmuseumpa.org/css/main.css . Specific css would be most appreciated.
    Thanks.
    Jim

    The very last style rule states
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
    ul.MenuBarHorizontal li.MenuBarItemIE
    display: inline;
    f\loat: left;
    background: #FFF;
    color: #FFF;
    This is a white backgorund and white text. Simply change the background colour to #2565B2
    Gramps

  • CS6 #nav links change hover background color based on its position in series

    First post from a complete DW CS 6 novice on Win7.  Not knowing JavaScript or JQuery, I thought I would add simplest animation to a website navigation based on the two col fixed header footer design. The navigation links on the left <sidebar1> have been increased to 24, with a common link background in the default state.  When the cursor is passed over the links they would change background color to one of five given in the image placed in the jpeg image loaded as the 1st list item.  The image itself only acts as a color key to the five catagories of links directly below it, and is not hyperlinked.  The idea is that someone looking for new tools would need to hover down the nav links and only be concerned with the Yellow background ones, even if they appear in any random position down the list.  To give each link a color to start with would make <sidebar1> appear too colorful.
    I have David Powers' two dvd titles and was thinking of using a nth-of-type() .  It does not work.  Perhaps there are two sets of colons required (  a:hover:nth-of-type(4), a:active:nth-of-type(4) {background-color:#f00;}   ).  There is surely a way that would work but I do not know enough of DW and CSS at present to figure this out.
    Many thanks.

    I don't what menu system you're using, but you might be able to create some CSS classes to use in your menu like so:
    <ul>
    <li>a href="some-link.html" class="about">about link</a></li>
    <li>a href="some-link.html" class="new">new link</a></li>
    <li>a href="some-link.html" class="new_proc">new procedures link</a></li>
    <ul>
    CSS:
    li a.about:hover {background-color:gray}
    li a:new:hover {background-color:forestgreen}
    li a:new_proc:hover {background-color:lawngreen}
    and so on...
    Nancy O.

  • A a:link has background image

    I have a bkg img in my nav and bottom nav. (navBkg.jpg) These navs are styled very specifically for the nav and bottom Nav in my css.  However all the a links are displaying this background, rather than just the nav and bottom Nav.  You can see it in the lower box (Eva prim's Snack of the Week Club) where it says "...read more."
    http://carriecoren.com/test/Sept9
    here's the css:
    @charset "UTF-8";
    #column3 img {
              margin-left: 10px;
    @font-face
    font-family: myFirstFont;
    src: url(Gondola_SD.ttf); 
              margin:0;
              padding:0;
    a, a:link, a:hover {
                        background-image: url(../images/whtBkg.jpg);
    body {
              font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
              font-size: 14px;
              color: #222;
              line-height: 18px;
              margin-right: auto;
              margin-left: auto;
              text-align: left;
              background-image: url(../images/blue_bg_vert.jpg);
              background-repeat: repeat-x;
              background-color: #000;
    #container {
              width: 960px;
              margin-right: auto;
              margin-left: auto;
              margin-top: 0px;
              margin-bottom: 0px;
              text-align: left;
              background-color: #FFF;
              background-image: url(../images/containerBkg.jpg);
              background-repeat: repeat-y;
    #content  {
              width: 920px;
              padding-right: 20px;
              padding-left: 20px;
    #header {
              background-image: url(../images/header.jpg);
              background-repeat: no-repeat;
              padding: 0px;
              height: 280px;
              width: 960px;
              text-indent: -9999px;
              margin-top: 0px;
              margin-right: 0px;
              margin-bottom: 0px;
              margin-left: 0px;
    /* column 1 */
    #column1 {
              width: 590px;
              margin-top: 30px;
              margin-right: 0px;
              margin-bottom: 20px;
              margin-left: 10px;
              border: medium solid #888;
              background-image: url(../images/column1art.jpg);
              padding-bottom:50px;
              float: left;
    #column1  p{
              font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
              font-size: 14px;
              color: #222;
              line-height: 22px;
              padding-left: 253px;
              padding-right:10px;
              padding-bottom:10px;
    #column1  h1{
              font-weight:normal
              font-family: Gondola_SD.ttf;
              font-family: "Gondola SD", "Gondola SD - Swash";
              padding-top: 20px;
              padding-left: 240px;
              padding-bottom:10px;
              font-size: 20px;
              word-spacing: 95%;
              text-transform: uppercase;
              line-height: 30px;
              text-align: center;
    /* column 2 */
    #column2 {
              background-color: #FFF;
              padding: 0px;
              width: 250px;
              margin-top:30px;
              margin-right: 20px;
              margin-bottom: 0px;
              margin-left: 10px;
              float: right;
              padding: 0px;
    #column2 li {
              list-style-type: none;
              display: inline;
              padding: 0px;
              margin-top: 0px;
              margin-right: 8px;
              margin-bottom: 0px;
              margin-left: 0px;
    #column2 a, a:link {
              margin-top: 0;
              margin-right: 0px;
              margin-bottom: 0;
              margin-left: 0;
              padding-top: 0;
              padding-right: 0;
              padding-bottom: 0;
              padding-left: 0;
    /* column 3 */
    #column3 {
              width: 550px;
              margin-right: 0px;
              margin-bottom: 20px;
              margin-left: 10px;
              border: medium solid #888;
              padding: 20px;
              float: left;
              height: px;
              background-color: #FFF;
    #column3  p{
              font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
              font-size: 14px;
              color: #222;
              line-height: 22px;
    #column3  h2{
              font-weight:normal
              font-family: Gondola_SD.ttf;
              font-family: "Gondola SD", "Gondola SD - Swash";
              padding-bottom:10px;
              font-size: 16px;
              word-spacing: 95%;
              text-transform: uppercase;
              line-height: 30px;
              text-align: left;
    #column3  a, a:link{
              color: #33C;
              background-color: #FFF;
              background-repeat: no-repeat;
    #column3  a:hover{
              color: #33C;
              font-weight: bold;
    h1{
              padding-bottom:10px;
              font-weight:normal
              font-family: Gondola_SD.ttf;
              font-family: "Gondola SD", "Gondola SD - Swash";
              padding-top: 20px;
              font-size: 20px;
              word-spacing: 95%;
              text-transform: uppercase;
              line-height: 30px;
              text-align: center;
    /* the main nav */
    #nav {
              width: 960px;
              height: 35px;
              margin-bottom: 10px;
              padding-top: 5px;
              padding-right: 0px;
              padding-bottom: 0px;
              padding-left: 0px;
              text-align: center;
              font-size: 14px;
              line-height: 30px;
              font-family: "Gondola SD", "Gondola SD - Swash";
              border-top-width:thin;
              border-color:#000;
              background-image: url(../images/navBkg.jpg);
              background-repeat: repeat;
    #nav ul { /* this is the main nav list */
              list-style:none;
              margin-bottom:0px;
              width:100%;
              margin-top: 0px;
    #nav li {
              display: inline;
              background-image: url(../images/navBkg.jpg);
              background-repeat: repeat-x;
    #nav li a, a:link {
              padding-right:25px;
              padding-left:15px;
              text-decoration:none;
              background-image: url(../images/navBkg.jpg);
              background-repeat: repeat-x;
              vertical-align: bottom;
              width: 100%;
              padding-top: 0px;
              padding-bottom: 0px;
              margin-top: 0px;
    #nav li a:hover{
              background-image: url(../images/navBkgHover.png);
              background-repeat: repeat-x;
              padding-top: 6px;
              margin-top: 0px;
              width: 100%;
    /* bottom nav */
    #bottomNav {
              width: 960px;
              background-color: #003399;
              margin: 0px;
              padding-top: 0px;
              padding-bottom: 0px;
              border-top-width: 9px;
              border-top-style: solid;
              border-top-color: #000;
              text-align: center;
              background-image: url(../images/navBkg.jpg);
              background-repeat: repeat-x;
              float: left;
              height: 25px;
    #bottomNav ul {
              list-style:none;
              font-weight:bold;
              margin-bottom:0px;
              margin-top: 0px;
              padding-top: 0px;
              padding-bottom: 0px;
    #bottomNav li {
              margin-right:0px;
              position:relative;
              padding-right: 10px;
              padding-left: 10px;
              padding-top: 0px;
              padding-bottom: 0px;
              display: inline;
    #bottomNav a, a:link {
              margin-right:0px;
              padding-right: 10px;
              padding-left: 10px;
              padding-top: 7px;
              padding-bottom: 7px;
              display: inline;
              margin-top: 10px;
              margin-bottom: 0px;
              color: #DDD;
    #bottomNav a:hover {
              color:#DDD;
              background:#660000;
    #pinterest {
              width: 250px;
              margin-right: 0px;
              margin-bottom: 20px;
              margin-left: 0px;
    #twitter {
              background-color: #FFF;
              width: 250px;
              margin-right: 0px;
              margin-bottom: 20px;
              margin-left: 0px;
              height: 100%;
              margin-top: 15px;
    #social {
              width: 250px;
              height: 58px;
              background-color: #FFF;
    #copyright {
              font-family: Arial, Helvetica, sans-serif;
              font-size: 9px;
              line-height: 20px;
              color: #222;
              text-align: center;
              width: 100%;
              float: left;
    #contact {
              margin: 0px;
              height: 140px;
              width: 50px;
              padding-right: 10px;
              padding-left: 20px;
              border: thin solid #222;
              padding-top: 40px;
    .clear {
              width: 900px;
              color: #EEE;
              margin-top: 100px;
              margin-right: 0px;
              margin-bottom: 0px;
              margin-left: 0px;
              clear: both;
    #container #content #clear {
              width: 700px;

    OK, you didn't need to post your CSS here, it's available on the page.
    But I am confused. Perhaps I am misreading you here.
    You have your bottom nav and your top nav. Then you have your "read more" which is not nav-it's just a link. Doesn't have your nav background.
    When you set the rules for links for Column 3, you set the way the "read more" would work:
    #column3  a, a:link{
              color: #33C;
              background-color: #FFF;
              background-repeat: no-repeat;
    #column3  a:hover{
              color: #33C;
              font-weight: bold;
    So when you hover, it turns bold and maintains the same color. And the background for links in Column 3 is white, which is the background for column 3. Really not needed.
    Additionally, the W3C Validator is finding problems with your page. Please fix those, then get back to us.

  • Table content hover, background color change

    How can I achieve this background color hover effect? Like the table on this page:
    http://uconn.edu/holiday/teams.html

    jr4292 wrote:
    How can I achieve this background color hover effect? Like the table on this page:
    http://uconn.edu/holiday/teams.html
    If you want all your links to have the same effect then put this code in your style sheet:
    a:hover {
        background:#73D5FC;
        border:1px solid #DDDDDD;
    Good luck.

  • Hover background bug in IE?

    I am going spare. At one point my code was looking pretty
    good. Now it is all completely in a muddle. By trying to put hover
    backgrounds on my links, the whole positioning is out.
    Problems:
    1. Why do my borders not line up in Safari, on my nav bar.
    2. Why does the side borders of my nav bar go to far down on
    IE
    3. Why does the hover background only work on MAC - is there
    a code to get around this for IE
    4. How can I make the text change color on hover when I am
    hovering the relevant li and not when I am just hovering the text.
    Many questions - someone needs to help a novice!!!! Anyone?
    http://www.lollypopsandpolkadots.com/
    Thank you in advance

    Hello,
    The IE will do some code compiling on page load and will
    remove some of the attributes that have an invalid syntax from the
    DOM. Because of this when the Spry will start evaluate the page the
    Spry placeholders don't exists anymore and Spry can't replace them
    with the actual data.
    I'm not yet very clear why the page works without that meta
    description. A thing yo can try is to change your code to this:
    <td style="background:url('{img}') repeat-x left
    top"><img src="{img}" /></td>
    because the {} are illegal in CSS
    Cristian

  • How do you make a navigation link hover?

    hi i built a sliding panel and placed hotspots on the navigation (next and previous) links which are in the form of arrows.And i am unable to make the next and previous links hover.
    please help

    Sorry, forgot to mention that an image must have a unique name
    So if we change the name of the first image to nav2, the hover effect will work.
    <a href="#" onclick="sp1.showNextPanel(); return false;"><img name="nav2" src="http://www.islamobec.com/images/box_arrow2.gif"class="arrow_" alt="arrow" width="30" height="50" border="0" onMouseOver="nav2.src='http://www.islamobec.com/images/box_arrow2_hover.gif'" onMouseOut="nav2.src='http://www.islamobec.com/images/box_arrow2.gif'" /></a>
    <a href="#" onclick="sp1.showPreviousPanel(); return false;"><img name="nav" src="http://www.islamobec.com/images/box_arrow.gif"class="arrow" alt="arrow" width="30" height="50" border="0" onMouseOver="nav.src='http://www.islamobec.com/images/box_arrow_hover.gif'" onMouseOut="nav.src='http://www.islamobec.com/images/box_arrow.gif'" /></a>
    Gramps

  • Link on background image

    I created and inserted a  background image in the Container. It includes "link buttons" built into the image in Photoshop, meaning images intended to be clicked in order to move to another page.  I can't create hotspots/image maps to use to create links because the image is a background image.
    How do I create the actual hyperlinks to make the "buttons" function as navigiation links?
    Thanks for your suggestions.
    Barry

    Google is your friend.
    Search term
    "Links on background images"
    First link in search result
    http://xavisys.com/css-trick-turning-a-background-image-into-a-clickable-link/
    #yourdiv {
        background-image:url(image.png);
        display:block;
        height:58px;
        text-indent:-9999px;
        width:200px;
    You will need to style the position of the div(s)
    Learn CSS
    Shane

  • Cmd + Click not opening links in background inside gmail

    When I attempt to open links on background inside gmail the Cmd + click is not working. It opens the link in the foreground.
    Though "Open Link in New Tab" in the right click context menu does open it in background.
    I am using Firefox 4 on mac book pro running 10.6.7

    It has now been solved over on the thread linked above !!!
    Open "about:config"
    Search for 'browser.tabs.loadDivertedInBackground'
    Then Toggle the value to TRUE !
    Thanks to @cor-el for the solution.

  • Replacing images used as a link with background image

    OK - I'm embarrassed to say that what I'm trying to do is
    blindingly
    obvious, and I've used Dw for several years - and do most of
    the work
    in code view but I'm having a senior moment and can't do what
    I want.
    I've read that when you use images on a page for background
    styling,
    for example the logo, or an image of a professional body such
    as IEE,
    it is more semantically correct to use CSS background images
    rather
    that a <img src=
    tag
    So I have a div in which I put the background, but then
    perhaps quite
    logically you can't directly put a link to it. So how do you
    do it.
    I've tried to ensure there was a block element so when you
    hover l
    mouse over it you get a block link - but no joy.
    maybe my dyslexia early is the sign of premature brain fade
    ~Malcolm N....
    ~

    You cannot place a link on a background image. However, you
    can place a
    link on a transparent image floated over the background.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Malcolm N_" <[email protected]> wrote in message
    news:[email protected]..
    >
    > OK - I'm embarrassed to say that what I'm trying to do
    is blindingly
    > obvious, and I've used Dw for several years - and do
    most of the work
    > in code view but I'm having a senior moment and can't do
    what I want.
    > !!!
    >
    > I've read that when you use images on a page for
    background styling,
    > for example the logo, or an image of a professional body
    such as IEE,
    > it is more semantically correct to use CSS background
    images rather
    > that a <img src=
    > tag
    >
    > So I have a div in which I put the background, but then
    perhaps quite
    > logically you can't directly put a link to it. So how do
    you do it.
    >
    > I've tried to ensure there was a block element so when
    you hover l
    > mouse over it you get a block link - but no joy.
    >
    > maybe my dyslexia early is the sign of premature brain
    fade ;-)
    >
    > --
    >
    > ~Malcolm N....
    > ~

  • Spry menu how to different hover background for submenu options??

    Hi
    CS4 dreamweaver, Spry menu.
    I am trying to design a spry horizontal menu such that the main menu bar boxes accross the top all share a background image and a hover image.
    I would like all the boxes in the dropdown area to share a diferent background and hover image.
    My problem is in the hover styles. In particular, when the main menu bar accross the top has an option that is not a submenu.
    The target css rule is "ul.MenuBarHorizontal a:hover" and is used for any link that resides on the menu bar as well as for links that reside in the dropdown area. I wish to distinguish (via background image, and background hover image) the two types of buttons.
    The other challenge is that my menu is dynamic and is using a spry dataset to drive it.
    I guess i need a  "ul.MenuBarHorizontal ul li a:hover" or something like that.
    I hope that i am explaining myself.
    Anyone run into this?
    Thanks
    Jerry C

    Hi - I just read
    The other challenge is that my menu is dynamic and is using a spry dataset to drive it.
    Some time back I did the same for a number of websites - and then realised that search engines dont read the data. ie - the links and they could not be followed since they needed to be generated on the fly in the browser.. So as a result, Google was not going thru my nav menu links.
    I then changed to another method (PHP / MySql) for my dynamic menus.
    My menu system has some extra CSS to style the subnavs and the currently selected page.
    Just my 2bobs worth. Hope it is of some use..

  • Open link in background when anchor's attribute "href" contains javascript

    Hi community,
    I support web enterprise-level application with some legacy parts, where some windows are opened by using window.open command inside of anchor's href attribute. (e.g. <a href="javascript:MyFunction('../someurl', '2')" ../> ... function MyFunction(url,
    id) { window.open(url, id) ...)
    Now I have to open link in the background by pressing ctrl + click (or middle click), but for IE (9, 10, 11) it always becomes focused.
    Are there any ways to open those new tabs in the background (only when ctrl is pressed)? 
    P.S. I know that it would be better to provide actual link inside of href attribute, but unfortunatelly I don't have such options, due to application specific.
    Thank you in advace for your help!

    Hi Rob,
    thank you a lot for reply!
    I think mine issue not related to security and popup blocker settings. What I try to achieve is similar behaviour as we have for links (<a>) with href attribute fullfilled with actual url. Specifically
    * by single click new tab should be opened focused (this is fine)
    * by shift + click it should be opened in new browser window (this is also fine)
    * by middle (ctrl + click) new tab should be opened in background. This feature doesn't work well, because new tab alway opens focused and this is what I'm trying to fix, or at least find official proof that IE works in this way with javascript
    inside href attribute
    Here is example:
    http://jsfiddle.net/hj3gud9j/
    It works as expected in chrome but not in IE
    Yours sincerely, 
    Eugene Novykov

  • Image map + link in background image

    Is it possible to put an image map and link to a background
    image of a table?

    no but you can put a 1px by 1 x blank transparent image over
    the background image and add an image map to that

  • Dynamic text link hover color change.

    I have some dynamic text in Flash and I have a link with the text. Is there a way I can change the hover color without CSS? Here is my code.
    thanks.
    data=EASTERN CANADIAN DISTRICT<br><a href='mailto:[email protected]'><font color="#51884B">Mike Linnen</font></a><br>905-430-0955<br>Cell: 905-409-7159

    Disable the "Show border around text" option of your dynamic
    text field.
    Draw a rectangle with the color you want, & locate it
    behind your dynamic text field.

  • Linked jpg background color?

    Is it possible to specify the background color of a linked jpg?
    I am linking directly to a jpg on my site and I think would like to keep it that way for sake of simplicity. The link looks something like this:
    http://my-domain.com/jpg-name.jpg
    I am getting the default color of the browser, but am hoping I can manipulate that color somehow.
    Thanks,
    Brian

    I'm not exactly sure what you are asking. You want the page's background color to be determined by the colors used in the JPG? Which colors?  You might try something like this:
    http://www.phpclasses.org/package/5577-PHP-Get-the-most-used-colors-in-an-image.html

Maybe you are looking for