样式设计(App.css)
要求:
- 为应用程序应用基本样式,以获得视觉上令人愉悦的界面。
功能:
步骤:
- 创建一个
App.css
文件,并为应用组件应用基本样式。使用提供的 CSS 代码对应用进行样式设计。
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
max-width: 800px;
width: 100%;
padding: 20px;
box-sizing: border-box;
}
.header {
background-color: #343a40;
color: #fff;
padding: 20px 0;
text-align: center;
font-size: 32px;
margin-bottom: 20px;
border-radius: 10px;
}
.note-form {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
.note-form input[type="text"],
.note-form textarea {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: none;
border-bottom: 2px solid #007bff;
background-color: transparent;
font-size: 16px;
transition: border-bottom 0.3s;
}
.note-form input[type="text"]:focus,
.note-form textarea:focus {
border-bottom: 2px solid #0056b3;
outline: none;
}
.note-form button {
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.note-form button:hover {
background-color: #0056b3;
}
.note-list {
display: flex;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
}
.note {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
width: 300px;
transition:
transform 0.3s,
box-shadow 0.3s;
}
.note:hover {
transform: scale(1.03);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}
.note-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.note-header h3 {
margin: 0;
font-size: 24px;
color: #007bff;
}
.note-actions {
display: flex;
gap: 10px;
}
.note-actions button {
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
padding: 5px 10px;
font-size: 14px;
cursor: pointer;
transition: background-color 0.3s;
}
.note-actions button:hover {
background-color: #0056b3;
}