在CSS中如何设置一个按钮鼠标划过变颜色。

html-css014

在CSS中如何设置一个按钮鼠标划过变颜色。,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:button {background-color: #00a7d0}

button:hover {background-color: #ff7701}。

3、浏览器运行index.html页面,此时显示出了蓝色背景颜色的按钮。

4、将鼠标移入按钮,此时按钮的背景颜色变成了橙色。

css如何设置按钮大小

发布时间:2022-03-08 14:03:18 作者:小新

来源:亿速云 阅读:928

前端开发者专用服务器,限时0元免费领!查看>>

这篇文章主要为大家展示了“css如何设置按钮大小”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“css如何设置按钮大小”这篇文章吧。

按钮大小

我们可以使用 font-size 属性来设置按钮大小:

实例

.button1 {font-size: 10px}

.button2 {font-size: 12px}

.button3 {font-size: 16px}

.button4 {font-size: 20px}

.button5 {font-size: 24px}

圆角按钮

我们可以使用 border-radius 属性来设置圆角按钮:

实例

.button1 {border-radius: 2px}

.button2 {border-radius: 4px}

.button3 {border-radius: 8px}

.button4 {border-radius: 12px}

.button5 {border-radius: 50%}

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:

button {border:0width: 200pxheight: 80pxbackground-color: gainsborocursor: not-allowed}

3、浏览器运行index.html页面,此时通过css实现了按钮的禁用样式。