要使用CSS3实现表单样式美化,可以遵循以下步骤:
/* 重置浏览器默认样式 */
input, button, textarea, select {
margin: 0;
padding: 0;
border: none;
font-family: inherit;
font-size: inherit;
}
body {
font-family: 'Arial', sans-serif;
color: #333;
background-color: #f5f5f5;
}
form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input, button, textarea, select {
display: block;
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}
input:focus, button:focus, textarea:focus, select:focus {
outline: none;
border-color: #007bff;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}
:hover和:active来增加交互效果。button {
background-color: #007bff;
color: #fff;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
button:active {
background-color: #004085;
}
.error-message {
color: #d9534f;
font-size: 12px;
margin-top: 5px;
}
@media (max-width: 480px) {
form {
padding: 10px;
}
}
通过以上步骤,你可以使用CSS3实现表单样式的美化。当然,你可以根据自己的需求和喜好进一步调整和优化样式。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。