html怎么改变按钮颜色

html怎么改变按钮颜色,第1张

html怎么改变按钮颜色

html改变按钮颜色的方法:1、给按钮元素添加“button{background-color:颜色值}”样式改变按钮的背景颜色;2、给元素按钮添加“button{color:颜色值}”样式改变按钮的字体颜色。

本教程 *** 作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

html改变按钮颜色的方法

1、html改变背景颜色的方法

代码如下:

button{background-color:颜色值}

设置背景颜色:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    button{background-color:#FF0000}
</style>
<body>
    <button>按钮</button>
</body>
</html>

输出结果:

2、html改变按钮字体颜色的方法

代码如下:

button{color:颜色值}

设置字体颜色:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    button{color:#FF0000}
</style>
<body>
    <button>按钮</button>
</body>
</html>

输出结果:

更多编程相关知识,请访问:编程视频!!

以上就是html怎么改变按钮颜色的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/690340.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-21
下一篇 2022-04-21

发表评论

登录后才能评论

评论列表(0条)

保存