473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do you have coding for different kinds of buttons?

mariko
23
I have coding for one style of button, but I would like to add another kind of button. If the external CSS code for the first button is this, what coding would I add for the second button?

Expand|Select|Wrap|Line Numbers
  1. #button a {   
  2. display: block;   
  3. background:  url(rolloverimage.gif) top;
  4. width: 63px;
  5. height: 34px;  
  6. }
  7.  
  8. #button a:hover {   
  9. background:  url(rolloverimage.gif) bottom;   
  10. width: 63px;
  11. height: 34px;
  12. }
Jul 8 '10 #1

✓ answered by TheServant

I suggest reading up on CSS id's and names. What you have there is #button, which is referencing a button with the id='button'.
If you change that to class='button' then your CSS would be:
Expand|Select|Wrap|Line Numbers
  1. .button { ...
If you add a different ID or class to your second button, you can style it with:
Expand|Select|Wrap|Line Numbers
  1. .button2 { ...
  2. /* OR */
  3. #button2 { ...
Just remember, ID's are for unique elements (only one) whereas classes are for common elements.

4 1814
TheServant
1,168 Expert 1GB
I suggest reading up on CSS id's and names. What you have there is #button, which is referencing a button with the id='button'.
If you change that to class='button' then your CSS would be:
Expand|Select|Wrap|Line Numbers
  1. .button { ...
If you add a different ID or class to your second button, you can style it with:
Expand|Select|Wrap|Line Numbers
  1. .button2 { ...
  2. /* OR */
  3. #button2 { ...
Just remember, ID's are for unique elements (only one) whereas classes are for common elements.
Jul 8 '10 #2
Expand|Select|Wrap|Line Numbers
  1. #button1 a,
  2. #button2 a {   
  3. display: block;   
  4. background:  url(rolloverimage.gif) top;
  5. width: 63px;
  6. height: 34px;  
  7. }
  8. #button1 a:hover,
  9. #button2 a:hover {   
  10. background:  url(rolloverimage.gif) bottom;   
  11. width: 63px;
  12. height: 34px;
  13. }
Jul 9 '10 #3
mariko
23
@mariko
I ended up using all the code for a button, but instead of calling it a button I put in a different word. It worked. Is there any reason that I shouldn't do that?
Jul 9 '10 #4
TheServant
1,168 Expert 1GB
@mariko
The class and ID can be called what ever you want. Provided the ID is unique and there is no other element with that ID. There can me lots of elements with the same class.
Jul 10 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: news.hku.hk | last post by:
I would like to group different kinds of food. There are unknown number of kinds of food e.g. apple, orange, lemon, melon, ......... of course it's only a finite number but i don't know. also...
6
by: turnstyle | last post by:
Hi all, I'm hoping somebody here might be able to point me in the right direction. Basically, I'm looking for a "good" way to build tables such that different kinds of stuff can grouped. ...
2
by: Aravind | last post by:
Hi folks. I have a form, frmHistory, which has 4 command buttons: Sort Title (cmdSortTitle), Sort Name (cmdSortName), Due Today (cmdDueToday), and Due List (cmdDueList). Sort Title and Sort...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
6
by: pmud | last post by:
Hi, I have created a very simple ASP.NET application which has a couple of ImageButtons which go to different SQL reports on clicking them. I have used Response.Redirect to send the user to the ...
5
by: fff_afafaf | last post by:
Do you know is it possible to put different kinds of tuples to one container? E.g. to a vector? (The lengths of the tuples are different, and also the types in the tuples are different.. -Is it...
52
by: burgermeister01 | last post by:
First, let me say that this question is a rather general programming question, but the context is PHP, so I figured this group would have the most relevant insight. Anyways, this is also more of...
10
by: Thomas Guettler | last post by:
If you look at this code, you see there are two kind of ImportErrors: 1. app_name has no attribute or file managment.py: That's OK. 2. managment.py exists, but raises an ImportError: That's not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.