Photoshopのような金属の質感がある文字をCSSで作り出す
2008/11/26 23:14Update
HTML+CSSでPhotoshopのような金属の質感がある文字を作り出すサンプルです。
まずは、サンプルから。
サンプル1

サンプル2
Create Album Error.Could not find End Of Central Directory
上のような効果のテキストは、CSSでも簡単に作り出すことができます。
■手順:
サンプル1から説明します。
1)次のような背景画像を用意します。
Create Album Error.Zip file empty
2)HTMLコード
3)CSSコード
主要なCSSコードは次の通りです。
■HTMLソース
<html>
<head>
<style type="text/css">
<!--
body {
font: 75%/160% Arial, Helvetica, sans-serif;
width: 700px;
margin: 20px auto;
}
.pattern {
background:#000000 none repeat scroll 0 0;
margin:30px 0 50px;
padding:30px 0 30px 30px;
}
.pattern h1 {
-x-system-font:none;
color:#FFFFFF;
font-family:"Lucida Grande",Arial,sans-serif;
font-size:600%;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:bold;
letter-spacing:-6px;
line-height:100%;
margin:0;
position:relative;
text-transform:uppercase;
}
.pattern h1 span {
/* span要素に背景画像を設定します */
background:transparent url(pattern-zebra.png) repeat scroll 0 0;
/* ブロック要素として定義 */
display:block;
height:100px;
position:absolute;
/* 要素の幅を定義 */
width:100%;
}
-->
</style>
</head>
<body>
<div class="pattern">
<h1><span></span>Wow, Zebra</h1>
</div>
</body>
</html>
■ダウンロード:
pattern-zebra.png
photoshop-font-by-css.html
原文はこちら:http://rlog.cn/wp-content/uploads/2008/01/css-gradient-demo/
サンプル1
サンプル2
Create Album Error.Could not find End Of Central Directory
上のような効果のテキストは、CSSでも簡単に作り出すことができます。
■手順:
サンプル1から説明します。
1)次のような背景画像を用意します。
Create Album Error.Zip file empty
2)HTMLコード
<div class="pattern"> <h1><span/>Wow, Zebra</h1> </div>
3)CSSコード
主要なCSSコードは次の通りです。
.pattern h1 span {
/* span要素に背景画像を設定します */
background:transparent url(pattern-zebra.png) repeat scroll 0 0;
/* ブロック要素として定義 */
display:block;
height:100px;
position:absolute;
/* 要素の幅を定義 */
width:100%;
}
■HTMLソース
<html>
<head>
<style type="text/css">
<!--
body {
font: 75%/160% Arial, Helvetica, sans-serif;
width: 700px;
margin: 20px auto;
}
.pattern {
background:#000000 none repeat scroll 0 0;
margin:30px 0 50px;
padding:30px 0 30px 30px;
}
.pattern h1 {
-x-system-font:none;
color:#FFFFFF;
font-family:"Lucida Grande",Arial,sans-serif;
font-size:600%;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:bold;
letter-spacing:-6px;
line-height:100%;
margin:0;
position:relative;
text-transform:uppercase;
}
.pattern h1 span {
/* span要素に背景画像を設定します */
background:transparent url(pattern-zebra.png) repeat scroll 0 0;
/* ブロック要素として定義 */
display:block;
height:100px;
position:absolute;
/* 要素の幅を定義 */
width:100%;
}
-->
</style>
</head>
<body>
<div class="pattern">
<h1><span></span>Wow, Zebra</h1>
</div>
</body>
</html>
■ダウンロード:
pattern-zebra.png
photoshop-font-by-css.html原文はこちら:http://rlog.cn/wp-content/uploads/2008/01/css-gradient-demo/
Sponsored Link
Comments
- Relative Articles
- CSSフォント - フォントのスタイル設定 | font-style - (2008/05/28 18:12)
- CSSフォント - フォントの太さ設定 | font-weight - (2008/05/29 10:35)
- CSSフォント - フォントのサイズ設定 | font-size - (2008/05/29 11:39)
- CSSフォント - フォントのバリアント表示設定 | font-variant - (2008/05/29 22:36)
- 絶対に覚えておきたい便利なCSSチートシート - (2009/04/03 17:12)
- Curtis CSS Typeface - CSSによるアートなフォント - (2010/04/07 11:59)