/* CSS 样式模板代码 */
/* 1. 重置默认样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* 2. 全局字体和背景设置 */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
}
/* 3. 容器布局 */
.container {
width: 80%;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
/* 4. 标题样式 */
h1, h2, h3, h4, h5, h6 {
color: #2c3e50;
margin-bottom: 10px;
}
/* 5. 段落文本样式 */
p {
line-height: 1.6;
margin-bottom: 15px;
}
/* 6. 链接样式 */
a {
color: #3498db;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* 7. 按钮样式 */
.button {
display: inline-block;
padding: 10px 20px;
background-color: #3498db;
color: #fff;
text-align: center;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #2980b9;
}
/* 8. 表格样式 */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th, td {
padding: 10px;
border: 1px solid #ddd;
text-align: left;
}
th {
background-color: #f5f5f5;
}
/* 9. 响应式设计 */
@media (max-width: 768px) {
.container {
width: 95%;
}
h1 {
font-size: 24px;
}
}
* 选择器将所有元素的 margin 和 padding 设置为 0,并使用 box-sizing: border-box 确保内边距和边框包含在元素的总宽度和高度中。上一篇:css第几个元素
下一篇:css字体样式大全
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站