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制作按钮可以让按钮的样式变得更加美观,同时也方便了页面的布局。可以根据实际需求进行适当的修改,例如更改背景色或文字颜色。
粉丝
0
关注
0
收藏
0