Joseph Duffy
Joseph Duffy

Reputation: 4836

Remove part of background/make transparent

I'm making a menu that follows down the page, and has an 85% transparency. As it goes down the page, or an item is clicked, there will be an arrow below the name of the current DIV.
I would like this arrow to be transparent, so the user can read what is behind it. If I make it an image, and make it transparent, it just shows what is below it (The menu, obviously).
So, my question is, how do I make that part transparent?
Here's my current code:
HTML:

<div class="menu">
    <ul class="navigation">
       <li><a href="#home">Home</a></li>
       <li><a href="#aboutme">About Me</a></li>
       <li><a href="#portfolio">Portfolio</a></li>
       <li><a href="#services">Services</a></li>
       <li><a href="#contact">Contact</a></li>
    </ul>
</div>

CSS:

    .menu {
    position: fixed;
    width: 100%;
    height: 60px;
    background-image: url('images/menubg.png');

}

ul.navigation {
    list-style: none;
    text-align: center;
    font-family: 'Allerta', serif;
    text-transform: uppercase;
    font-size: 22px;
    margin: 0px;
    padding-top: 19px;
}

ul.navigation li {
    display: inline;    
}

ul.navigation a {
    color: #dcdcdc;
    margin-right: 30px;
    margin-left: 30px;
    text-decoration: none;
    padding-bottom: 35px;
}

ul.navigation a:hover {
    background-image: url('images/hover2.png');
    background-repeat: no-repeat;
    background-position: center;
}

Upvotes: 5

Views: 2436

Answers (2)

Hussein
Hussein

Reputation: 42818

Assuming transparent arrow is what you need, Use the following CSS properties to achieve cross browser transparency support.

#arrow {
 -khtml-opacity:.50; 
 -moz-opacity:.50; 
 -ms-filter:”alpha(opacity=50)”;
  filter:alpha(opacity=50);
  filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.5);
  opacity:.50; 
}

Upvotes: 1

Jon Gauthier
Jon Gauthier

Reputation: 25602

If I understand your question correctly, you're trying to display an image with some level of transparency?

You can use the CSS opacity property, like so:

#transparent {
    background-image: url('images/hover2.png');

    opacity: 0.5;
    filter: alpha(opacity=50);
}

JSFiddle example

W3Schools reference link

Upvotes: 1

Related Questions