Sa-6ren">
gpt4 book ai didi

html - 突出显示按钮 Dreamweaver CC

转载 作者:行者123 更新时间:2023-11-28 10:42:52 25 4
gpt4 key购买 nike

当我点击一个按钮时,我想让它改变颜色,怎么做?

目前基本都是黑底白字。

例如,为了方便起见,我希望它在我单击时变成蓝色和白色文本。

我该怎么做?

提前致谢

html代码

<form method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<table>
<tr><td>
<button onClick="btnSave" id="btnOnclick">Save</button>
</td></tr>
</table>
</form>

CSS代码

#btnOnclick
{
color:#CCC;
width: 75;
margin-left: 50px;
margin-right:auto;
border: 1px outset #FFF;
margin-bottom:20px;
margin-top:10px;
font-size:15px;

/*gradient*/
background:-moz-linear-gradient(top, #000, #333);
background:-webkit-gradient(linear, left top , left bottom, from(#000), to(#333));

border-radius:15px;
-moz-border-radius:15px;
-webkit-border-radius:15px;

/*shadows*/
box-shadow:3px 3px 10px #000;
-moz-box-shadow:3px 3px 10px #000;
-webkit-box-shadow:3px 3px 10px #000;


}

最佳答案

你应该为这个元素使用 CSS 选择器 :active : JS Fiddle example

你应该在这里阅读更多相关信息: w3schools

链接的所有 CSS 选择器:

a:link    {color:green;}
a:visited {color:green;}
a:hover {color:red;}
a:active {color:yellow;}

关于html - 突出显示按钮 Dreamweaver CC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23083003/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com