Coloured Buttons

V

Venkat

Hi,

I am writing this piece of html code
<input type = button value ="BookmarkedPage" id=button name =
BookmarkedPage>
to show the following button, i want to know if this button can be shown in
a coloured way.

if i put a parameter in input tag as color = red it doesn't work.

Is there anyway to do it?

Regards
Venkat
 
S

Steve Pugh

Venkat said:
I am writing this piece of html code
<input type = button value ="BookmarkedPage" id=button name =
BookmarkedPage>
to show the following button, i want to know if this button can be shown in
a coloured way.

input type="button" is only useful in conjunction with client side
scripting, I hope your pages make provision for when such scripting is
not supported or enabled.
if i put a parameter in input tag as color = red it doesn't work.

You can't just invent attributes and expect them to work.

Changing the presentation of anything is best done with CSS.

#button { color: red;}

Steve
 
L

Leif K-Brooks

Steve said:
Changing the presentation of anything is best done with CSS.

#button { color: red;}

He probably wants to change the colour of the button, not its text. If
so, use:

#button { background-color: red;}
 
S

Steve Pugh

Leif K-Brooks said:
He probably wants to change the colour of the button, not its text.

Maybe, but the analogy was with a fictional HTML color attribute. Not
a fictional HTML bgcolor attribute.
If so use:

#button { background-color: red;}

To avoid clashes with user stylesheets or just with browser defaults
(black on red, or red on grey are both hard to read) both should be
specified:

#button {
color: yellow;
background: red;
}

The background property is favoured over background-color because (a)
it's shorter and (b) it sets background-image to none thus over riding
any user stylesheet.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,342
Messages
2,571,407
Members
48,796
Latest member
katerack

Latest Threads

Top