css中按钮怎么做

admin 轻心小站 关注 LV.19 运营
发表于前端技术学习版块 css,教程

CSS中的按钮制作一般有两种方法,一种是使用input标签加上type属性为button的按钮,另一种是使用button标签。/* 使用input标签制作按钮 */ input[type= butto

CSS中的按钮制作一般有两种方法,一种是使用input标签加上type属性为button的按钮,另一种是使用button标签。

/* 使用input标签制作按钮 */
input[type="button"] {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

/* 使用button标签制作按钮 */
button {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
} 

上述代码中,两种方法的CSS样式基本相同,都包括背景色、边框、文字颜色、内边距、对齐方式、字体大小、外边距和光标形状等。

使用CSS制作按钮可以让按钮的样式变得更加美观,同时也方便了页面的布局。可以根据实际需求进行适当的修改,例如更改背景色或文字颜色。

文章说明:

本文原创发布于探乎站长论坛,未经许可,禁止转载。

题图来自Unsplash,基于CC0协议

该文观点仅代表作者本人,探乎站长论坛平台仅提供信息存储空间服务。

评论列表 评论
发布评论

评论: css中按钮怎么做

粉丝

0

关注

0

收藏

0

已有0次打赏