カレンダーを作成しています。
上の写真の黄色で囲っている部分の色(土曜日と日曜日)を変更したいです。
コードにリンクを設定したところ自動でカレンダーの日にちの色が紫になりました。
styleで!importantを設定してみても色が変わりません。
リセットCSSは使っていません。
どなたか教えていただけると幸いです。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>予約</title> </head> <body> <style> .cal td{border-bottom: 1px solid silver; padding: 20px} .cur {font-size: 20px; color: black;} .oth {font-size: 9px; color: silver;} .sat {color: blue !important;} .sun {color: red !important;} a {text-decoration: none;} a:hover {color: red;} </style> <?php echo make_calender(date('Y'),date('n')); function make_calender($year,$month){ $t=new DateTime(); $t->setDate($year,$month,1); $t->modify("Mon this week"); $end_t=new DateTime(); $end_t->setDate($year,$month,1); $end_t->modify("last day of this month"); $end_t->modify("Sun"); $html="<p>{$year}年 {$month}月</p>"; //カレンダーのテーブルをつくる $html .="<table class='cal'>"; $html .="<tr>月</tr>"; for(;;){ $d=$t->format("d"); $w=$t->format("w"); $c_week=($w==0) ? "sun" : (($w == 6) ? "sat" :""); $c_mon=((int)$t->format("m")==$month) ? 'cur' : 'oth'; if($w == 1) { $html .="<tr>"; } //ここのコードに<a href=....></a>を設定しました。 $html .="<td class='$c_mon $c_week'><a href='yoyaku-top.html'>$d</a></td>"; // if($w==0){ $html .="</tr>"; } $diff=$end_t->diff($t); if($diff->days==0) break; $t->modify("+1 days"); } $html .="</table>"; return $html; } ?> </body> <html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。