ヘッダのh2を編集する
h2やh3などをヘッダと呼びますが、せっかく賢威を使っているのにデフォルトの人が多い気がします。もちろんデフォルトでも十分に見た目はよいのですが、ヘッダデザインを変えるとサイトの印象はガラッと変わり個性がでます。他サイトとの差別化にもなりますので、よかったら参考にしてください。
CSSの編集方法
WordPressダッシュボード→外観→テーマの編集→base.cssの順に開く
ctrl+Fで”main-body h2″で検索
“{“と”}”の中身を下に書いたどれか一つと置き換える。
賢威子テーマ対応
子テーマを使用している人が子テーマのbase.cssに下で紹介するコードを適用しても親テーマの文字色の影響を受けないようにしております^^
それでも気になる人は”color:#カラーコード”で修正しよう!
h2のCSSデザインパターン集
背景色なしの場合
下線を引く
aa;
-webkit-box-shadow: 0 1px 0 #aaaaaa;
-moz-box-shadow: 0 1px 0 #aaaaaa;
text-shadow: #999999 0px 1px 1px;
}
先頭に四角をつける
.main-body h2{ position: relative; color: #111; background: none; font-size: 1.143em; font-weight: bold; margin: 0 0 1.5em; padding: 0.5em 0.5em 0.5em 1.7em; border-bottom: 3px solid #499d48; } .main-body h2:before{ content: ""; position: absolute; background: #00ff00; top: 0; left: 0.4em; height: 12px; width: 12px; transform: rotate(45deg); -moz-transform: rotate(45deg); -webkit-transform: rotate(45deg); -o-transform: rotate(45deg); -ms-transform: rotate(45deg); } .main-body h2:after{ content: ""; position: absolute; background: #32cd32; top: 1.0em; left: 0; height: 8px; width: 8px; transform: rotate(15deg); -moz-transform: rotate(15deg); -webkit-transform: rotate(15deg); -o-transform: rotate(15deg); -ms-transform: rotate(15deg); }
左バーと点線をつける
.main-body h2{ margin: 0 0 1.5em; padding: 0.8em; background: none; color: #111; border-left: 7px solid #499d48; border-bottom: 1px dashed #499d48; font-size: 1.143em; font-weight: bold; }
先頭に斜めの線を入れる
.main-body h2{ background: none; color: #111; position: relative; padding-left: 30px; border-bottom: 2px solid #ccc; font-weight: bold; font-size: 22px; line-height: 38px; } .main-body h2:after, .heading2:before{ content: ''; height: 18px; width: 4px; display: block; background: #499d48; position: absolute; top: 8px; left: 15px; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; transform: rotate(45deg); -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); -ms-transform: rotate(45deg); } .main-body h2:before{ height: 10px; transform: rotate(-45deg); -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); -ms-transform: rotate(-45deg); top: 16px; left: 7px; }
最初の1文字を大きくする
.main-body h2{ background: none; color: #111; font-size: 1.143em; font-weight: bold; margin: 0 0 1.5em; border-bottom: 2px solid #499d48; box-shadow: 0 1px 0 #aaaaaa; -webkit-box-shadow: 0 1px 0 #aaaaaa; -moz-box-shadow: 0 1px 0 #aaaaaa; text-shadow: #999999 0px 1px 1px; } .main-body h2:first-letter{ font-size:3.0em; }
先頭に中抜きの四角を入れる
.main-body h2{ background: none; color: #111; position: relative; font-size: 1.143em; font-weight: bold; margin: 0 0 1.5em; padding: 0.5em 0.5em 0.5em 2.0em; border-bottom: 2px solid #499d48; } .main-body h2:before{ content: "□"; font-size: 200%; position: absolute; color: #32cd32; top: -0.8em; left: 0.3em; height: 12px; width: 12px; } .main-body h2:after{ content: "□"; font-size: 200%; position: absolute; color: #00ff00; top: -0.5em; left: 0; height: 12px; width: 12px; }
先頭にグラデーションの四角を入れる
.main-body h2{ background: none; position: relative; margin: 0 10px; padding: 0 10px 0 55px; font: bold 22px/40px Arial, Helvetica, sans-serif; color: #333333; background: #fff; z-index: 1; border-bottom: 3px solid #499d48; } .main-body h2:before{ content: " "; position: absolute; top: 0; left: 0; width: 40px; height: 40px; border-right: #fff solid 2px; background: #499d48; background-image: -webkit-gradient(linear, left top, left bottom, from( rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.6)), to( rgba(255, 255, 255, 0.6)) ); background-image: -webkit-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -moz-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -o-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: linear-gradient(to bottom, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); z-index:-1; } .main-body h2:after{ content: " "; position: absolute; top: 0; left: 0; width: 40px; height: 40px; background-image: -webkit-gradient(linear, left top, right top, from( rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.6)), to( rgba(255, 255, 255, 0.6)) ); background-image: -webkit-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -moz-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -o-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: linear-gradient(to right, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); z-index:-1; }
上下に線を入れる
.main-body h2{ background: none; color: #111; margin: 0 0 1.5em; padding: 0.8em; border-top: 3px double #499d48; border-bottom: 3px double #499d48; font-size: 1.143em; font-weight: bold; }
上下に線を入れる(吹き出し風)
.main-body h2{ background: none; position: relative; padding: 5px 20px; font: bold 28px/1.6 Arial, Helvetica, sans-serif; color: #333; background: #fff; text-shadow: 1px 1px 0 #fff, 2px 2px 0 #999; border-top: #499d48 solid 3px; border-bottom: #499d48 solid 3px; background-image: -webkit-gradient(linear, left top, right bottom, from( rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(255, 255, 255, 0.0)), to( rgba(255, 255, 255, 0.0)) ); background-image: -webkit-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -moz-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -o-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: linear-gradient(to bottom -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-size: 4px 4px; } .main-body h2:before{ content: " "; position: absolute; top: 100%; left: 24px; width: 0; height: 0; border-width: 12px; border-style: solid; border-color: transparent; border-top-color: #499d48; } .main-body h2:after{ content: " "; position: absolute; top: 100%; left: 28px; width: 0; height: 0; border-width: 8px; border-style: solid; border-color: transparent; border-top-color: #499d48; z-index: 1; }
角丸の枠で囲む
.main-body h2{ background: none; color: #111; margin: 0 0 1.5em; padding: 0.8em; border: 2px solid #499d48; font-size: 1.143em; font-weight: bold; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; }
角丸の枠で囲み、影をつける
.main-body h2{ background: none; color: #111; margin: 0 0 1.5em; padding: 0.8em; font-size: 1.143em; font-weight: bold; border: 2px solid #499d48; border-radius: 18px; box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -moz-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -webkit-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -o-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -ms-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); }
四角枠で囲み、影をつける
.main-body h2{ background: none; color: #111; margin: 0 0 1.5em; padding: 0.8em; font-size: 1.143em; font-weight: bold; border: 2px solid #499d48; box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -moz-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -webkit-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -o-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); -ms-box-shadow: 3px 3px 3px rgba(0,0,0,0.4); }
四角枠で囲み、先頭に縦線を入れる
.main-body h2{ background: none; color: #111; position: relative; margin: 0 0 1.5em; padding: 0.8em 0 0.8em 1.5em; border: 2px solid #499d48; font-size: 1.143em; font-weight: bold; } .main-body h2:before{ content: ""; position: absolute; background: #499d48; top: 50%; left: 0.5em; margin-top :-15px; height: 30px; width: 8px; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; }
角丸枠で囲み、先頭に丸をつける
.main-body h2{ background: none; color: #111; position: relative; margin: 0 0 1.5em; padding: 0.8em 0 0.8em 2.5em; border: 1px solid #499d48; font-size: 1.143em; font-weight: bold; border-radius: 20px; -webkit-border-radius: 20px; -moz-border-radius: 20px; } .main-body h2:before{ content: ""; position: absolute; background: #499d48; top: 50%; left: 0.5em; margin-top :-10px; height: 20px; width: 20px; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; box-shadow: 1px 1px 1px #499d48 inset; -moz-box-shadow: 1px 1px 1px #499d48 inset; -webkit-box-shadow: 1px 1px 1px #499d48 inset; -o-box-shadow: 1px 1px 1px #499d48 inset; -ms-box-shadow: 1px 1px 1px #499d48 inset; }
吹き出しで囲み、背景をつける
.main-body h2{ background: none; color: #111; position: relative; padding: 0.8em; margin: 0 0 1.5em; font-size: 1.143em; font-weight: bold; color: #333; background: #fff; text-shadow: 1px 1px 0 #fff, 1px 1px 0 #999; border: #499d48 solid 2px; background-image: -webkit-gradient(linear, left top, right bottom, from( rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(255, 255, 255, 0.0)), to( rgba(255, 255, 255, 0.0)) ); background-image: -webkit-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -moz-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -o-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: linear-gradient(to bottom -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-size:4px 4px; } .main-body h2:before{ content: " "; position: absolute; top: 100%; left: 24px; width: 0; height: 0; border-width: 12px; border-style: solid; border-color: transparent; border-top-color: #499d48; } .main-body h2:after{ content: " "; position: absolute; top: 100%; left: 28px; width: 0; height: 0; border-width: 8px; border-style: solid; border-color: transparent; border-top-color: #F0F0F0; z-index:1; }
吹き出し(塗りつぶし)で囲み、背景をつける
.main-body h2{ background: none; color: #111; position: relative; padding: 0.8em; margin: 0 0 1.5em; font-size: 1.143em; font-weight: bold; border-radius: 5px; color: #333; background: #fff; text-shadow: 1px 1px 0 #fff, 1px 1px 0 #999; border: #499d48 solid 2px; background-image: -webkit-gradient(linear, left top, right bottom, from( rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(255, 255, 255, 0.0)), color-stop(0.4, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(0, 0, 0, 0.1)), color-stop(0.6, rgba(255, 255, 255, 0.0)), to( rgba(255, 255, 255, 0.0)) ); background-image: -webkit-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -moz-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: -o-linear-gradient(top -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-image: linear-gradient(to bottom -45deg, transparent 40%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0.1) 60%, transparent 60% ); background-size:4px 4px; } .main-body h2:before{ content: " "; position: absolute; top: 100%; left: 24px; width: 0; height: 0; border-width: 12px; border-style: solid; border-color: transparent; border-top-color: #499d48; } .main-body h2:after{ content: " "; position: absolute; top: 100%; left: 28px; width: 0; height: 0; border-width: 8px; border-style: solid; border-color: transparent; border-top-color: #499d48; z-index:1; }
背景色ありの場合
先頭に縦線を入れる
.main-body h2{ position:relative; padding:10px; padding-left:15px; font-weight: bold; font-size: 18px; background-color: #499d48; color: #fff; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; } .main-body h2:before{ content:''; height:25px; width:4px; display:block; position:absolute; top:10px; left:4px; background-color:#fff; border-left: 4px solid #fff; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; }
マーカーを引く
.main-body h2{ position: relative; margin: 0 0 1.5em; padding: 0.8em; font-size: 1.143em; font-weight: bold; color: #fff; background: #499d48; box-shadow: 12px 0 0 0 #499d48, 0 12px 0 0 #499d48, 1px 15px 4px -3px rgba(0,0,0,0.2); -moz-box-shadow: 12px 0 0 0 #499d48, 0 12px 0 0 #499d48, 1px 15px 4px -3px rgba(0,0,0,0.2); -webkit-box-shadow: 12px 0 0 0 #499d48, 0 12px 0 0 #499d48, 1px 15px 4px -3px rgba(0,0,0,0.2); -o-box-shadow: 12px 0 0 0 #499d48, 0 12px 0 0 #499d48, 1px 15px 4px -3px rgba(0,0,0,0.2); -ms-box-shadow: 12px 0 0 0 #499d48, 0 12px 0 0 #499d48, 1px 15px 4px -3px rgba(0,0,0,0.2); } .main-body h2:before{ content: " "; position: absolute; top: 100%; left: 100%; width: 0; height: 0; border-width: 12px 12px 0 0; border-style: solid; border-color: transparent; border-top-color: #00ff00; } .main-body h2:after{ content: " "; position: absolute; padding: 0 20px; bottom: 0; left: 0.8em; width: 10.0em; height: 1.5em; background: rgba(255,244,244,0.4); transform: rotate(-1deg); -webkit-transform: rotate(-1deg); -moz-transform: rotate(-1deg); -o-transform: rotate(-1deg); }
吹き出しで囲む
.main-body h2{ position: relative; margin: 0 0 1.5em; padding: 0.8em; background: #499d48; color: #fff; font-size: 1.143em; font-weight: bold; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; } .main-body h2:after{ position: absolute; bottom: -15px; left: 10%; z-index: 90; margin-left: -15px; border-top: 15px solid #499d48; border-left: 15px solid transparent; border-right: 15px solid transparent; border-bottom: 0; content: ""; }
帯っぽくする
.main-body h2{ position: relative; color: #fff; background: #499d48; font-size: 1.143em; font-weight: bold; margin: 0 -2.8em 1.5em -2.8em; padding: 0.8em; box-shadow: 0 1px 3px #777; -moz-box-shadow: 0 1px 3px #777; -webkit-box-shadow: 0 1px 3px #777; -o-box-shadow: 0 1px 3px #777; -ms-box-shadow: 0 1px 3px #777; } .main-body h2:after, .main-body h2:before{ content: ""; position: absolute; top: 100%; height: 0; width: 0; border: 5px solid transparent; border-top: 5px solid #333; } .main-body h2:before{ right: 0; border-left: 5px solid #333; } .main-body h2:after{ left: 0; border-right: 5px solid #333; }
リボン風にする
.main-body h2{ position: relative; color: #fff; background: #499d48; font-size: 20px; line-height: 1; margin: 30px 20px 10px -10px; padding: 14px 5px 10px 50px; border-radius: 22px 0 0 22px; } .main-body h2:before{ content: ""; position: absolute; background: #fff; top: 50%; left: 14px; margin-top :-10px; height: 20px; width: 20px; border-radius: 50%; box-shadow: 1px 1px 1px #777 inset; } .main-body h2:after{ content: ""; position: absolute; top: 0; right: -22px; height: 0; width: 0; border: 22px solid #499d48; border-right-color: transparent; }
先頭に二重丸をつける
.main-body h2{ position: relative; color: #fff; background: #32cd32; font-size: 20px; line-height: 1; margin: 30px 0 10px 0; padding: 14px 5px 10px 40px; box-shadow: 0 1px 3px #777; border-radius: 0 10px 10px 0; } .main-body h2:before{ content: ""; position: absolute; background: #499d48; top: 50%; left: -20px; margin-top : -22px; height: 44px; width: 44px; box-shadow: 1px 1px 1px #777; border-radius: 50%; } .main-body h2:after{ content: ""; position: absolute; background: #006400; top: 50%; left: -15px; margin-top: -15px; height: 24px; width: 24px; border-radius: 50%; }
奥行きのあるボックス風にする
.main-body h2{ position: relative; padding: 10px; color: #fff; background: #006400; box-shadow: 0 -10px 0 0 #499d48, 10px 0 0 0 #006400, -10px 0 0 0 #006400, 0 3px 3px 0 rgba(0,0,0,0.1); } .main-body h2:before{ content: " "; position: absolute; top: -10px; left: -10px; width: 0; height: 0; border-width: 0 0 10px 10px; border-style: solid; border-color: transparent; border-bottom-color: #499d48; } .main-body h2: after{ content: " "; position: absolute; top: -10px; left: 100%; width: 0; height: 0; border-width: 0 10px 10px 0; border-style: solid; border-color: transparent; border-bottom-color: #499d48; }
上下で色分けする
.main-body h2{ width: auto; padding: 3px 0 3px 10px; color: #fff; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0.48, #32cd32), color-stop(0.52, #499d48)); text-shadow: 0px -1px 1px #000; }
旗っぽく見せる
.main-body h2{ position: relative; margin: 0 0 1.5em; padding: 0.8em; font-size: 1.143em; font-weight: bold; color: #fff; background: #499d48; } .main-body h2:before{ content: "<"; position: absolute; top: middle; left: -10px; width: 0; height: 0; font-size: 25px; line-height: 1.0; color: #c96; } .main-body h2:after{ content: " "; position: absolute; top: -2px; left: -10px; width: 0; height: 130%; border: #600 solid 2px; border-radius:2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; transform: rotate(-2deg); -webkit-transform: rotate(-2deg); -moz-transform: rotate(-2deg); -o-transform: rotate(-2deg); }
斜めのラベル風にする
.main-body h2{ position: relative; padding: 0.8em; margin: 0 0 1.5em; font-size: 1.25em; font-weight: bold; text-align: center; color: #fff; background: #499d48; vtransform: rotate(-1deg) skew(-1deg); -webkit-transform: rotate(-1deg) skew(-1deg); -moz-transform: rotate(-1deg) skew(-1deg); -o-transform: rotate(-1deg) skew(-1deg); -ms-transform: rotate(-1deg) skew(-1deg); box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 1.0em 0 0 0 #499d48, -1.0em 0 0 0 #499d48; -moz-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 1.0em 0 0 0 #499d48, -1.0em 0 0 0 #499d48; -webkit-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 1.0em 0 0 0 #499d48, -1.0em 0 0 0 #499d48; -o-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 1.0em 0 0 0 #499d48, -1.0em 0 0 0 #499d48; -ms-box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2), 1.0em 0 0 0 #499d48, -1.0em 0 0 0 #499d48; }
斜めの帯のようにする
.main-body h2{ position: relative; margin: 0 -10px; padding: 5px; font: normal 28px/1.6 "Times New Roman", Times, serif; text-align: center; color: #ffe8e8; background: #499d48; -webkit-transform: rotate(-3deg) skew(-3deg); -moz-transform: rotate(-3deg) skew(-3deg); -o-transform: rotate(-3deg) skew(-3deg); transform: rotate(-3deg) skew(-3deg); box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2); background-image: -webkit-gradient(linear, left top, left bottom, from( rgba(0, 0, 0, 0.0)), color-stop(0.08, rgba(255, 255, 255, 0.5)), color-stop(0.12, rgba(255, 255, 255, 0.5)), color-stop(0.12, rgba(0, 0, 0, 0.0)), color-stop(0.88, rgba(0, 0, 0, 0.0)), color-stop(0.88, rgba(255, 255, 255, 0.5)), color-stop(0.92, rgba(255, 255, 255, 0.5)), color-stop(0.92, rgba(0, 0, 0, 0.0)), to( rgba(0, 0, 0, 0.0)) ); background-image: -moz-linear-gradient(top, transparent 8%, rgba(255, 255, 255, 0.5) 8%, rgba(255, 255, 255, 0.5) 12%, transparent 12%, transparent 88%, rgba(255, 255, 255, 0.5) 88%, rgba(255, 255, 255, 0.5) 92%, transparent 92% ); background-image: -o-linear-gradient(top, transparent 8%, rgba(255, 255, 255, 0.5) 8%, rgba(255, 255, 255, 0.5) 12%, transparent 12%, transparent 88%, rgba(255, 255, 255, 0.5) 88%, rgba(255, 255, 255, 0.5) 92%, transparent 92% ); background-image: linear-gradient(to bottom, transparent 8%, rgba(255, 255, 255, 0.5) 8%, rgba(255, 255, 255, 0.5) 12%, transparent 12%, transparent 88%, rgba(255, 255, 255, 0.5) 88%, rgba(255, 255, 255, 0.5) 92%, transparent 92% ); } .main-body h2:before{ content: " "; position: absolute; top: -5px; left: 0; width: 0; height: 0; border-width: 0 0 5px 10px; border-style: solid; border-color: transparent; border-bottom-color: #006400; } .main-body h2:after{ content: " "; position: absolute; top: 100%; right: 0; width: 0; height: 0; border-width: 5px 10px 0 0; border-style: solid; border-color: transparent; border-top-color: #006400; }
変わったパターン
先頭にグラデーションと塗りつぶし
.main-body h2{ position: relative; margin: 0 0 1.5em; padding: 0.6em 0.4em 0.6em 4.0em; font-size: 1.143em; font-weight: bold; color: #fff; background: #333333; z-index: 1; } .main-body h2:before{ content: " "; position: absolute; top: 0; left: 0; width: 40px; height: 40px; border-right: #fff solid 2px; background: #499d48; background-image: -webkit-gradient(linear, left top, left bottom, from( rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.6)), to( rgba(255, 255, 255, 0.6)) ); background-image: -webkit-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -moz-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -o-linear-gradient(top, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: linear-gradient(to bottom, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); z-index:-1; } .main-body h2:after{ content: " "; position: absolute; top: 0; left: 0; width: 40px; height: 40px; background-image: -webkit-gradient(linear, left top, right top, from( rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.0)), color-stop(0.20, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.1)), color-stop(0.40, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.3)), color-stop(0.60, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.5)), color-stop(0.80, rgba(255, 255, 255, 0.6)), to( rgba(255, 255, 255, 0.6)) ); background-image: -webkit-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -moz-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: -o-linear-gradient(left, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); background-image: linear-gradient(to right, transparent 20%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.3) 40%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.5) 80%, rgba(255, 255, 255, 0.6) 80%, rgba(255, 255, 255, 0.6) 100% ); z-index:-1; }
先頭に縦線、上下に点線をつける
.main-body h2{ color: #111; position:relative; padding:9px; padding-left:15px; font-weight: bold; font-size: 18px; background-color: #ccc; border: 1px dashed #499d48; border-left: 5px solid #499d48; }
メタル調にする
.main-body h2{ position: relative; margin: 0 10px; padding: 10px 10px 10px 30px; font: bold 22px/1.2 Arial, Helvetica, sans-serif; color: #666; background: #ccc; border-top: #ccc solid 1px; border-right: #999 solid 1px; border-bottom: #999 solid 1px; border-left: #ccc solid 1px; text-shadow: 1px 1px 0 rgba(255,255,255,1); box-shadow: 0 0 0 1px rgba(255,255,255,0.5) inset; background-image: -webkit-gradient(linear, left top, left bottom, from( rgba(220, 220, 220, 1.0)), color-stop(0.25, rgba(240, 240, 240, 1.0)), color-stop(0.30, rgba(235, 235, 235, 1.0)), color-stop(0.36, rgba(240, 240, 240, 1.0)), color-stop(0.50, rgba(235, 235, 235, 1.0)), color-stop(0.80, rgba(215, 215, 215, 1.0)), to( rgba(210, 210, 210, 1.0)) ); background-image: -webkit-linear-gradient(top, rgba(220, 220, 220, 1.0), rgba(240, 240, 240, 1.0) 25%, rgba(235, 235, 235, 1.0) 30%, rgba(240, 240, 240, 1.0) 36%, rgba(235, 235, 235, 1.0) 50%, rgba(215, 215, 215, 1.0) 80%, rgba(210, 210, 210, 1.0) ); background-image: -moz-linear-gradient(top, rgba(220, 220, 220, 1.0), rgba(240, 240, 240, 1.0) 25%, rgba(235, 235, 235, 1.0) 30%, rgba(240, 240, 240, 1.0) 36%, rgba(235, 235, 235, 1.0) 50%, rgba(215, 215, 215, 1.0) 80%, rgba(210, 210, 210, 1.0) ); background-image: -o-linear-gradient(top, rgba(220, 220, 220, 1.0), rgba(240, 240, 240, 1.0) 25%, rgba(235, 235, 235, 1.0) 30%, rgba(240, 240, 240, 1.0) 36%, rgba(235, 235, 235, 1.0) 50%, rgba(215, 215, 215, 1.0) 80%, rgba(210, 210, 210, 1.0) ); background-image: linear-gradient(to bottom, rgba(220, 220, 220, 1.0), rgba(240, 240, 240, 1.0) 25%, rgba(235, 235, 235, 1.0) 30%, rgba(240, 240, 240, 1.0) 36%, rgba(235, 235, 235, 1.0) 50%, rgba(215, 215, 215, 1.0) 80%, rgba(210, 210, 210, 1.0) ); } .main-body h2: before{ content: " "; position: absolute; top: 0; left: 15px; width: 0; height: 100%; border-left: #ccc solid 1px; } .main-body h2: after{ content: " "; position: absolute; top: 0; left: 16px; width: 0; height: 100%; border-right: #eee solid 1px; }
まとめ
いかがでしょうか?
サイトの印象がガラッと変わり、メンテナンスするあなたのモチベーションも上がれば幸いです^^