适用
css-demos
声明:资源链接索引至第三方,平台不作任何存储,仅提供信息检索服务,若有版权问题,请https://help.coders100.com提交工单反馈
CSS3 是 CSS(层叠样式表)的最新版本,它提供了许多新的功能和特性,使得网页设计更加灵活和丰富。以下是一个简单的 CSS3 实例代码,用于创建一个带有动画效果的按钮:
这个示例中,我们创建了一个名为 "button" 的 CSS 类,它具有以下属性:
- `display`: `inline-block`,使按钮在一行内显示。
- `padding`: 10px 20px,设置按钮的内外边距。
- `font-size`: 16px,设置按钮的字体大小。
- `cursor`: `pointer`,设置鼠标悬停时指针的形状。
- `background-color`: `4CAF50`,设置按钮的背景颜色。
- `color`: `white`,设置按钮的文字颜色。
- `border`: `none`,隐藏按钮的边框。
- `border-radius`: `5px`,为按钮添加圆角。
- `text-align`: `center`,设置按钮文本的对齐方式。
- `text-decoration`: `none`,移除按钮上的下划线。
- `transition-duration`: `0.4s`,设置按钮的过渡时间。
当用户悬停在按钮上时,背景颜色会变为 `45a049`;当用户点击按钮时,背景颜色会变为 `3e8e41`;当用户按下按钮时,背景颜色会变为 `3e8e41`。css +css3学习时的实例代码
CSS3 Button with Animation
.button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: 4CAF50;
color: white;
border: none;
border-radius: 5px;
text-align: center;
text-decoration: none;
transition-duration: 0.4s;
}
.button:hover {
background-color: 45a049;
}
.button:active {
background-color: 3e8e41;
}
Click me
这个示例中,我们创建了一个名为 "button" 的 CSS 类,它具有以下属性:
- `display`: `inline-block`,使按钮在一行内显示。
- `padding`: 10px 20px,设置按钮的内外边距。
- `font-size`: 16px,设置按钮的字体大小。
- `cursor`: `pointer`,设置鼠标悬停时指针的形状。
- `background-color`: `4CAF50`,设置按钮的背景颜色。
- `color`: `white`,设置按钮的文字颜色。
- `border`: `none`,隐藏按钮的边框。
- `border-radius`: `5px`,为按钮添加圆角。
- `text-align`: `center`,设置按钮文本的对齐方式。
- `text-decoration`: `none`,移除按钮上的下划线。
- `transition-duration`: `0.4s`,设置按钮的过渡时间。
当用户悬停在按钮上时,背景颜色会变为 `45a049`;当用户点击按钮时,背景颜色会变为 `3e8e41`;当用户按下按钮时,背景颜色会变为 `3e8e41`。css +css3学习时的实例代码
-
discussion
- 2025-07-09 00:14:40
-
cnode
- 2025-07-09 00:15:13
-
mobile-fixed-table
- 2025-07-09 00:16:40
-
mobile-table
- 2025-07-09 00:17:15
-
auth-code-font-end
- 2025-07-09 00:31:37
-
ml_platform
- 2025-07-09 00:33:34
-
springboot-vue2350
- 2025-07-09 00:38:47
-
springboot-vue1510
- 2025-07-09 00:39:19
-
clearslake.com
- 2025-07-09 00:47:51
-
2019hz_trans
- 2025-07-09 00:48:12
-
Stu-ClubMS
- 2025-07-09 00:54:45
-
sokoban
- 2025-07-09 01:11:47
-
X-Music
- 2025-07-09 01:24:38
-
dream-world
- 2025-07-09 01:25:02
-
springboot447
- 2025-07-09 01:29:34
-
springboot290
- 2025-07-09 01:30:05
-
short-url-nuxt
- 2025-07-09 01:33:34
-
CMSsystem
- 2025-07-09 01:38:40
-
kaoyanzhan
- 2025-07-09 01:41:37
-
2025MCS
- 2025-07-09 01:42:04
-
springboot-vue1500
- 2025-07-09 01:50:33
访问申明(访问视为同意此申明)
2.如有索引链接发生失效情况请【联系客服】自助退回)
3.是否访问均为用户自主行为,本站只提供搜索服务不提供技术支持,感谢您的支持