独自タグ[[CALENDAR]]で出力されるHTMLを装飾するCSS
実際にCSSを適用したカレンダーは下の画像の通り。

土日は文字色・背景色が変化
今日の日付の背景色が変化
投稿した日はマークがつく
自動で出力されるクラスで装飾を指定しているので、ユーザー側でクラスを追加したりしなくても大丈夫です。
[[CALENDAR]]タグの挿入→CSSに下記のコードをコピペでOK!
改変はご自由に。使用報告、著作権表記など不要です。
ご自身でカレンダーを装飾する場合の、ひな形としてご利用いただいても問題ありません。
/*----------カレンダー要素全体----------*/
.calendar {
box-sizing: border-box;
width: 250px;
border-collapse: collapse;
text-align: center;
font-size: 12px;
line-height: 2.5;
}
/*-----投稿のある日-----*/
.calendar a {
position: relative;
display: inline-block;
width: 100%;
text-decoration: none;
font-weight: bold;
}
.calendar a::after {
position: absolute;
top: calc(50% + 0.5em);
left: calc(50% - 0.2em);
display: block;
width: 0.4em;
height: 0.4em;
border-radius: 50%;
background-color: hsl(300, 100%, 60%);
content: "";
}
/*-----●●年●月の部分-----*/
.calendar caption {
text-align: center;
letter-spacing: 2px;
font-weight: bold;
font-size: 1.4em;
}
/*-----曜日の見出し行-----*/
.calendar tr.daysofweek th {
border-bottom: 2px solid;
text-align: center;
font-size: 1.2em;
line-height: 2.3;
}
/*-----カレンダー内の境界線-----*/
.calendar tr {
border-bottom: 1px solid;
}
.calendar tr:last-child {
border-bottom: none;
}
/*-----日付セルごとの設定-----*/
.calendar td {
vertical-align: middle;
}
/*-----土曜日の設定-----*/
.calendar th:nth-child(7) {
color: hsl(200, 70%, 40%);
}
.calendar tr td.sat {
background-color: hsl(200, 100%, 90%);
}
/*-----日曜日の設定-----*/
.calendar th:nth-child(1) {
color: hsl(0, 70%, 40%);
}
.calendar tr td.sun {
background-color: hsl(0, 100%, 90%);
}
/*-----今日の日付-----*/
.calendar tr td.today {
background-color: hsl(50, 100%, 90%);
}
/*-----空の日付-----*/
.calendar td.empty::after {
content: "-";
}
畳む
コピー&ペーストしてご利用ください。
参考:てがろぐ公式 ▼カレンダー表示の装飾方法
実際にCSSを適用したカレンダーは下の画像の通り。

土日は文字色・背景色が変化
今日の日付の背景色が変化
投稿した日はマークがつく
自動で出力されるクラスで装飾を指定しているので、ユーザー側でクラスを追加したりしなくても大丈夫です。
[[CALENDAR]]タグの挿入→CSSに下記のコードをコピペでOK!
改変はご自由に。使用報告、著作権表記など不要です。
ご自身でカレンダーを装飾する場合の、ひな形としてご利用いただいても問題ありません。
/*----------カレンダー要素全体----------*/
.calendar {
box-sizing: border-box;
width: 250px;
border-collapse: collapse;
text-align: center;
font-size: 12px;
line-height: 2.5;
}
/*-----投稿のある日-----*/
.calendar a {
position: relative;
display: inline-block;
width: 100%;
text-decoration: none;
font-weight: bold;
}
.calendar a::after {
position: absolute;
top: calc(50% + 0.5em);
left: calc(50% - 0.2em);
display: block;
width: 0.4em;
height: 0.4em;
border-radius: 50%;
background-color: hsl(300, 100%, 60%);
content: "";
}
/*-----●●年●月の部分-----*/
.calendar caption {
text-align: center;
letter-spacing: 2px;
font-weight: bold;
font-size: 1.4em;
}
/*-----曜日の見出し行-----*/
.calendar tr.daysofweek th {
border-bottom: 2px solid;
text-align: center;
font-size: 1.2em;
line-height: 2.3;
}
/*-----カレンダー内の境界線-----*/
.calendar tr {
border-bottom: 1px solid;
}
.calendar tr:last-child {
border-bottom: none;
}
/*-----日付セルごとの設定-----*/
.calendar td {
vertical-align: middle;
}
/*-----土曜日の設定-----*/
.calendar th:nth-child(7) {
color: hsl(200, 70%, 40%);
}
.calendar tr td.sat {
background-color: hsl(200, 100%, 90%);
}
/*-----日曜日の設定-----*/
.calendar th:nth-child(1) {
color: hsl(0, 70%, 40%);
}
.calendar tr td.sun {
background-color: hsl(0, 100%, 90%);
}
/*-----今日の日付-----*/
.calendar tr td.today {
background-color: hsl(50, 100%, 90%);
}
/*-----空の日付-----*/
.calendar td.empty::after {
content: "-";
}
畳む
コピー&ペーストしてご利用ください。
参考:てがろぐ公式 ▼カレンダー表示の装飾方法
2023/03/26
- ユーザ「かんりにん」の投稿だけを見る (※時系列順で見る)
- この投稿と同じカテゴリに属する投稿:
- この投稿日時に関連する投稿:
- この投稿を再編集または削除する