Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Over here i learned how to do image transparency with onmouseover and onmouseout, but it only deals with inline coding. is there a way i can apply this to an external style sheet?
    I want to make a navigation bar that increases opacity when you put your cursor over it. Right now i applied a transparent background to a navigation cell from an external style sheet, like so:
    .navcell{
    width:150px;
    height:40px;
    text-align:center;
    background-image:url("images/test.jpg");
    opacity: 0.2;
    }
    i tried to add the onmouseover and onmouseout attributes to this style sheet, but it didnt seem to work. is this possible? can you suggest any other solutions?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Your .navcell is your "onmouseout" (which doesn't exist with CSS but since it's your frame of reference I'm using it.

    To apply "mouseover" attributes, you want .navcell:hover {and then your CSS goes here}.

    Edit: that particular example isn't a very good one. Translucency usually works best with images that are already translucent i.e. PNGs with an alpha transparency of some sort.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    So it's the same as the a:link, a:visited, a:hover, and a:active?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    The same, assuming .navcell refers to an anchor (there are differences if .navcell is say a div, although "hover" will also work in most browsers).
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    It's a table cell. I'm using a table for my navigation bar. What i was going to do is this:
    -Make a table with one row and 5 cells (for each of the nav items)
    -Insert an image into each of the cells.(Home, About, Contact etc.)
    -Attach links to the images
    -Make it so that the images become more transparent when you hover your cursor over them.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
      <title>Victoria's Massage Therapy</title>
    <link rel="stylesheet" type="text/css" href="styles.css" />
    <head>
    <body>
    <div id="container">
        <div id="banner">
    
        </div>
        <div id="navbar">
            <table border="1" align="center">
                <tr>
                    <td class="navcell"><a href="index.html">Home</a></td>
                    <td class="navcell"><a href="about.html">About Me</a></td>
                    <td class="navcell"><a href="types.html">Types of Massage</a></td>
                    <td class="navcell"><a href="prices.html">Prices</a></td>
                    <td class="navcell"><a href="contact.html">Contact Me</a></td>
                </tr>
            </table>
        </div>
    </div>
    </div>
    </body>
    </html>
    [CSS]
    body{
    background-color: #d4f7df;
    }
    #container{
    margin:0 10% 10px 10%;
    position:absolute;
    width:1000px;
    height:800px;
    z-index:-1;
    border: 2px dotted red;
    }
    #banner{
    width: 1000px;
    height: 200px;
    z-index:1;
    border: 1px dotted blue;
    }
    #navbar{
    width:1000px;
    height:50px;
    border:1px dotted green;
    }
    .navcell{
    padding: 0;
    width:150px;
    height:40px;
    text-align:center;
    background-color:#ededde;
    opacity: 1;
    }
    .navimage{
    }
    [/CSS]
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Well, kid, if you noticed in your "intro" thread, I mentioned that you might have to unlearn something you were taught in school. This is exactly what I was talking about.

    First of all, you should never...EVER...use a table for laying out anything other than...well, data. If it wouldn't be displayed in a spreadsheet or database table, it shouldn't be displayed in a table on a web page. Tables create messy code and can also cause other problems.

    For a menu, you should use a horizontal unordered list. Here's a simple example to get you started. What I would actually suggest as far as your images go is to create your "off" and "over" images in Photoshop (your "over" images containing the greater transparency) and use CSS to generate the "flip" effect.

    The bottom of this tutorial will give you the idea for the flip effect, except that you're going to be using an unordered list (because that's what a menu effectively is...a list of links) instead of a p tag.

    There's a more advanced technique that uses sprites, but you'll want to take this a small chunk at a time.
    George Dolidze likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  8. #7
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    Thanks a lot! I will try that method now
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  9. #8
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    I got another question while coding this.. How do you know the size of the image to create, since the size of the <li> box isn't directly controllable?
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  10. #9
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    li {width: (whatever you want)} <-- You can control the size.

    As far as what size of image to create, "whatever fits nicely". That depends on the menu item and the text inside it, though. There's no real universal answer.
    George Dolidze likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:58 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com