Old 11-07-2006   #1 (permalink)
Intermediate User
 
Neil_8_24_93's Avatar
 
Join Date: May 2006
Posts: 96

Send a message via AIM to Neil_8_24_93 Send a message via MSN to Neil_8_24_93
Exclamation CSS Help Please Read!

Hello, I was wondering if anyone knew the CSS code to change the alpha/opacity of an object e.g button. Because I want my button to be in front of an image so when people click on that image it makes it look as if the image is the button.
Neil_8_24_93 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-07-2006   #2 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,069

Send a message via MSN to notjustgraphics
I'm not sure exactly what your trying to explain here...

You may be able to do what you're asking with a roll-over... you would have to make the first image opaque, and the second image would have to be a transparent image (.GIF or .PNG).

You can set the background to be transparent using a tag such as this:
background: transparent url(imagename.gif);

You would have to place your buttons in a DIV or TD but they will be partially transparent all the time.

You might also be able to do what you want simply using an image map over top of the area of the image you want to operate as a button.

Well, that's three solutions... I hope one of them helps you... If not, try explaining in a little more detail so I can understand better what your are trying to achieve....

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-08-2006   #3 (permalink)
Intermediate User
 
Neil_8_24_93's Avatar
 
Join Date: May 2006
Posts: 96

Send a message via AIM to Neil_8_24_93 Send a message via MSN to Neil_8_24_93
Yes I want the image to operate as a button. How do I do this?
Neil_8_24_93 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-09-2006   #4 (permalink)
Registered User
 
Join Date: Oct 2006
Posts: 22

Here Ya Go:

#one { float: left; background-image: url(YOUR IMAGE #1); background-repeat: no-repeat; }

#one:hover { float: left; background-image: url(YOUR IMAGE #2); background-repeat: no-repeat; }

#one:active { float: left; background-image: url(YOUR IMAGE #3); background-repeat: no-repeat; }

Just make sure you specify an <a> tag with the right id and edit the CSS to fit your image width and height. =)

Hope this helped!
__________________
I like smilies... what?
Krazy3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-09-2006   #5 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,069

Send a message via MSN to notjustgraphics
Sorry Neil_8_24_93... I'm not really sure what you're trying to do...

Let me see if I have it correctly: You have a large background image over which you want to place a button... and when someone clicks on the button you want it to be transparent so they see the image beneath?

OR

You have a large image and you want one section of it to operate as a button that does not change when clicked?

Are either of these close?

If it is the first one, you need to define a DIV to hold the button image, but placing it becomes more complex... I can help you if this is what you need...

If it is the second, you can easily use an image map to make a section of a larger image operate as a button... (You can have many image maps over your larger image)

I can help you with this too if this is what you need.

If I am wrong in both assumptions, you will have to be more clear about what you want so I or other BioRUSTers can help.

If all you need is the CSS tag for transparency, it's:

background: transparent url(imagename.gif);

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-13-2006   #6 (permalink)
Registered User
 
jbiljr's Avatar
 
Join Date: Nov 2006
Location: Philadelphia Area
Posts: 2

Hey Neil,

As a CSS designer I would tell you to scrap the use of an image for a button. If you are going to use an image it is always good practice to use a tiled gradient so you can keep the file and load time down. If you have to use an image, and believe me I use them a lot my self, using a transparent GIF will work fine. You can get really decent effects if you use a good CSS code to complement it. Here is a CSS that I use to get the effect.

Code:
<style type="text/css">
<!-- 
/* This is the background image */
#bg {
	width: 400px;
	height: 300px;
	background: url(yourimage.gif) repeat;
	border: 2px solid black;
	}
	
/* This is the transparent box */
#transbox {
	width: 300px;
	margin: 0 50px;
	background-color: #fff;
	border: 2px solid black;
	filter:alpha(opacity=50);
	opacity: 0.5;
	-moz-opacity:0.5;
	}
	
/* This is the container which set text to solid color.
position: relative used for IE */	
#transbox div {
	padding: 20px;
	font-weight: bold;
	color: #000;
	filter:alpha(opacity=100);
	opacity: 1;
	-moz-opacity:1;
	position: relative;
	}
-->
</style>
Here is the HTML to bring it all together
Code:
<div id="bg">
  <div id="transbox">
    <div>50% Lorem ipsum dolor sit amet, consectetuer adipiscing etc. etc.</div>
  </div>
</div>
This example will create a small 400 x 300 box with a transparent box over it including some text inside. Edit the code to suit your needs.

This should work in IE, Firefox, Safari, and Konqueror. You will notice that the transparency is declared 3 times so that it will work in all browsers.

Hope that helped
jbiljr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CCC aka Triple C's (m0g, read) Young Spartan General Discussions 28 12-09-2006 10:23 AM
PHP BB Question (Please Read) Neil_8_24_93 HTML / PHP / ASP / JS 5 08-01-2006 10:17 PM
Want to make a website? Read this. Young Spartan HTML / PHP / ASP / JS 16 06-30-2006 02:12 AM
interesting read Milkdrop General Discussions 3 08-07-2004 04:27 AM
Help: Making images links (it isn't what you think...read) kp606-Epsilon Adobe Photoshop 2 07-15-2004 02:14 PM


All times are GMT +1. The time now is 08:48 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT