【CSS05】
背景色と余白
>以下ソース
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="ja"> <head> <title>【CSS05】</title> <meta http-equiv="Content-Type" content="text/html; charset=SHIFT-JIS" > <style type="text/css"> <!-- body {width:450px;} h2 {color:#ffffff; background-color:#00008b; font-size:24px; font-weight:bold; margin-top:0; margin-bottom:0; padding:1em; } p {background-color:#87cefa; font-size:16px; margin-top:0; margin-bottom:0; padding:1em; line-height:24px; } //--> </style> </head> <body> <h2>background-colorの設定</h2> <p>見出しには濃いめの色を背景に指定し、文字を白抜きにします。段落には見出しよりも薄い色を指定します。さらに見出しと段落の上下のマージンを0にして、ボックスの上下をくっつけ、パディングを1em指定します。</p> </body> </html>
>できたページ