10/13 Illustratorでボタンを作る
サイズ 横800px 縦60px
- Illustratorの線分は両側に太るので、線を使う場合は必ず線分をアウトラインにする。
- 長方形を作るときは線の位置を指定の内側にする。
- 日本語は、「カーニング:オプティカル」で自動文字詰めをする。詰める部分は拗促音。拗音=節が仮名2文字で表されるもの 促音=「つ」「ツ」を小さく書いて表すもの(カット等)
- 全体をひとつの画像で作って、「background-position」で数値を指定して表示させる。
- JavaScriptの場合はそれぞれ別に作る。
右と下の線が細いのが気になる。多分画像の作り方で問題があったかもしれない。
HTML
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www:w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <mrta http-equiv="Content-Style-Type" content="text/css" /> <title></title> <link href="css/base.css" rel="stylesheet" type="text/css" media="screen,print" /> </head> <body> <div id="nav"> <ul> <li id="home"><a herf="#"><em>Home</em></a></li> <li id="cafefood"><a herf="#"><em>Cafe Food</em></a></li> <li id="drinkcafe" ><a herf="#"><em>Drink Cafe</em></a></li> <li id="infomation"><a herf="#"><em>Infomation</em></a></li> <li id="contact"><a herf="#"><em>Contact</em></a></li> </ul> </div> </body> </html>
@charset"UTF-8"; /*reset*/ html,body,div,ul,li, { margin: 0; padding: 0; } body { background-color: #fff; } ul { list-style-type: none; } a { text-decoration: none; } img { border: 0; } em { visibility: hidden; } /*nav*/ #nav { width: 800px; height: auto; margin: 50px 0 0 50px; } #nav li { float: left; display: inline; } #nav li a { width: 160px; height: 60px; display: block; background-color: #fff; background-image: url(../images/b.jpg); background-repeat: no-repeat; } #nav li#home a { background-position: left 0; } #nav li#home a:hover,li#home a:active { background-position: left -80px; } #nav li#cafefood a { background-position: -160px 0; } #nav li#cafefood a:hover,li#cafefood a:active { background-position: -160px -80px; } #nav li#drinkcafe a { background-position: -320px 0; } #nav li#drinkcafe a:hover,li#drinkcafe a:active { background-position: -320px -80px; } #nav li#infomation a { background-position: -480px 0; } #nav li#infomation a:hover,li#drinkcafe a:active { background-position: -480px -80px; } #nav li#contact a { background-position: right 0; } #nav li#contact a:hover,li#contact a:active { background-position: right -80px; }