見やすく、操作しやすくするためCSSで装飾していきます。
Contents
/* style.css */
/* style.css */
* {
box-sizing: border-box;
font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
scroll-behavior: smooth;
}
body {
background: linear-gradient(to right, #f0f4ff, #e8f1ff);
color: #2c3e50;
margin: 0;
padding: 0;
line-height: 1.6;
}
h1 {
text-align: center;
background: linear-gradient(to right, #007bff, #0056b3);
color: #fff;
margin: 0;
padding: 1.5rem;
font-size: 2rem;
box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4);
}
nav {
display: flex;
overflow-x: auto;
background-color: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(8px);
padding: 10px;
gap: 12px;
justify-content: center;
border-bottom: 1px solid #ccc;
}
nav button {
background: linear-gradient(to bottom right, #007bff, #3399ff);
color: #fff;
border: none;
padding: 10px 18px;
font-size: 1rem;
border-radius: 12px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
transition: background 0.3s, transform 0.2s;
flex-shrink: 0;
}
nav button:hover {
background: #0056b3;
transform: translateY(-2px);
}
.tab {
display: none;
padding: 1.5rem;
animation: fadeIn 0.3s ease-in-out;
}
.tab.active {
display: block;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.section-content {
margin: 20px auto;
padding: 20px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 16px rgba(0,0,0,0.05);
max-width: 800px;
}
input, select, textarea {
margin-top: 6px;
margin-bottom: 14px;
padding: 10px;
border-radius: 6px;
border: 1px solid #ccc;
width: 100%;
font-size: 1rem;
transition: border-color 0.3s;
}
input:focus, select:focus, textarea:focus {
border-color: #007bff;
outline: none;
}
button {
background: linear-gradient(to bottom right, #007bff, #3399ff);
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 8px;
cursor: pointer;
font-size: 1rem;
box-shadow: 0 3px 6px rgba(0,123,255,0.2);
transition: background 0.3s, transform 0.2s;
}
button:hover {
background: #0056b3;
transform: scale(1.02);
}
#requestResult, #result {
margin-top: 1rem;
font-weight: bold;
color: #007bff;
}
.icon {
font-size: 1.3rem;
}
label {
display: block;
margin-bottom: 6px;
font-weight: bold;
color: #333;
}
@media screen and (max-width: 600px) {
h1 {
font-size: 1.5rem;
padding: 1rem;
}
nav {
justify-content: flex-start;
padding: 8px;
}
nav button {
font-size: 0.9rem;
padding: 8px 14px;
}
.section-content {
padding: 16px;
margin: 10px;
}
input, select, textarea, button {
font-size: 1rem;
}
}
■ 基本設定
* {
box-sizing: border-box;
font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
scroll-behavior: smooth;
}
box-sizing: border-box;
:幅や高さに padding や border を含めてレイアウトしやすくします。font-family
: モダンなサンセリフ体で統一。scroll-behavior: smooth;
:ページ内リンクをスムーズにスクロール。
■ ページ全体のスタイル
body {
background: linear-gradient(to right, #f0f4ff, #e8f1ff);
color: #2c3e50;
margin: 0;
padding: 0;
line-height: 1.6;
}
- 背景に淡いグラデーション。
- テキストカラーは濃いめのグレーで読みやすく。
- 行間(line-height)を1.6で可読性アップ。
■ ヘッダー(h1)
h1 {
text-align: center;
background: linear-gradient(to right, #007bff, #0056b3);
color: #fff;
padding: 1.5rem;
font-size: 2rem;
box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4);
}
- 青のグラデ背景+白文字で視認性とインパクト。
- box-shadow で立体感を演出。
■ ナビゲーションバー(nav)
nav {
display: flex;
overflow-x: auto;
background-color: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(8px);
padding: 10px;
gap: 12px;
justify-content: center;
border-bottom: 1px solid #ccc;
}
display: flex
で横並び。backdrop-filter: blur(8px)
:背景をぼかして透明感のあるおしゃれな見た目。overflow-x: auto
:ボタンが多いと横スクロールに。
■ ナビボタン(nav button)
nav button {
background: linear-gradient(to bottom right, #007bff, #3399ff);
color: #fff;
...
}
- グラデの青背景+白文字で目立つ。
- ホバー時に暗めの青&浮き上がるようなアニメーション。
■ タブ切り替え部分
.tab {
display: none;
padding: 1.5rem;
animation: fadeIn 0.3s ease-in-out;
}
.tab.active {
display: block;
}
- タブは非表示が基本、
.active
クラスが付くと表示。 - アニメーションで表示が滑らかに。
■ アニメーション
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
- フェードイン+少し下からスライドで視覚効果をプラス。
■ コンテンツセクション(.section-content)
.section-content {
margin: 20px auto;
padding: 20px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 16px rgba(0,0,0,0.05);
max-width: 800px;
}
- 中央揃えの白いカード。
- 丸みと影でカードっぽく、おしゃれ&読みやすい。
■ フォーム部品(input, select, textarea)
input, select, textarea {
margin: 6px 0 14px;
padding: 10px;
border-radius: 6px;
border: 1px solid #ccc;
...
}
input:focus {
border-color: #007bff;
}
- 使いやすいサイズ感。
- フォーカス時は青枠でアクセント。
■ ボタン(共通)
button {
background: linear-gradient(...);
...
}
button:hover {
background: #0056b3;
transform: scale(1.02);
}
- 他のボタンとデザイン統一。
- ホバーで拡大アニメーションがあり、視覚的フィードバックを強化。
■ 結果表示
#requestResult, #result {
margin-top: 1rem;
font-weight: bold;
color: #007bff;
}
- 青色で強調し、結果が見やすい。
■ ラベル(label)
label {
display: block;
margin-bottom: 6px;
font-weight: bold;
color: #333;
}
- 各フォームのラベルを見やすく配置。
■ レスポンシブ対応
@media screen and (max-width: 600px) {
h1 { font-size: 1.5rem; ... }
nav { justify-content: flex-start; ... }
...
}
- スマホサイズでフォントやパディングを調整。
- レイアウト崩れを防ぎ、スマホでも快適に。