CSSを使ってアプリをスタイリッシングする
要件:
styles.css
に、アプリをスタイリッシングするためのCSSルールを追加する。
- CSSを使って現代的でカラフルなデザインを作成する。
機能:
CSSスタイルを適用して、アプリを視覚的に魅力的にする。
手順:
styles.css
を開き、以下のCSSコードを追加する。
body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #ff7f50, #ff3399);
margin: 0;
padding: 0;
color: #333;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
padding: 20px;
}
h1 {
font-size: 2rem;
margin: 20px 0;
color: #fff;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}
.input-card,
.expense-card,
.summary-card {
background: rgba(255, 255, 255, 0.9);
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
border-radius: 10px;
padding: 20px;
margin: 20px 0;
width: 100%;
max-width: 400px;
text-align: left;
}
.input-card h2,
.expense-card h2,
.summary-card h2 {
color: #007bff;
font-size: 1.5rem;
margin-bottom: 15px;
}
.input-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="number"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
background: linear-gradient(135deg, #ff3399, #ff7f50);
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
transition: background 0.3s ease;
}
button:hover {
background: linear-gradient(135deg, #ff7f50, #ff3399);
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
margin-bottom: 10px;
}
/* カード用のアニメーション */
@keyframes fade-in {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.input-card,
.expense-card,
.summary-card {
animation: fade-in 0.5s ease;
}