パソコンQ&A

テーブルレイアウトからスタイルシート(CSS)レイアウトに ソース[STEP12]

>説明のページへ戻る


>前のソース
>次のソース

a:hoverを使って、マウスオーバーしたときの画像を変える。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title>HTMLサンプル</title>
<meta http-equiv="content-style-type" content="text/css">
<style type="text/css">
<!--

  html {
    width: 100%;
  }
  body {
    background-color: #000;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  #allcontent {
    width: 760px;
    margin: 0 auto;
  }
  #head {
    width: 760px;
    margin: 0;
    padding: 0;
  }
  #contents {
    width: 760px;
    margin: 0;
    padding: 0;
  }
  #foot {
    width: 760px;
    margin: 0;
    padding: 0;
  }

  #head ul{
    list-style-type : none;
    margin: 0;
    padding: 0;
  }
  #head li{
    list-style-type : none;
    margin: 0;
    padding: 0;
    float:left;
    text-indent: -9999px;
    font-size:0;
    line-height: 0;
  }

  li#logo_top a {
    text-decoration: none;
    display: block;
    width: 135px;
    height: 65px;
    background: transparent url(img/logo.gif) 0 0 no-repeat ;
  }

  li#logo_top a:hover {
    background: transparent url(img/logo_o.gif) 0 0 no-repeat ;
  }


  li#menu1 a,li#menu2 a,li#menu3 a,li#menu4 a,li#menu5 a {
    text-decoration: none;
    display: block;
    width: 125px;
    height: 65px;
  }

  li#menu1 a {
    background: transparent url(img/menu_1.gif) 0 0 no-repeat ;
  }
  li#menu2 a {
    background: transparent url(img/menu_2.gif) 0 0 no-repeat ;
  }
  li#menu3 a {
    background: transparent url(img/menu_3.gif) 0 0 no-repeat ;
  }
  li#menu4 a {
    background: transparent url(img/menu_4.gif) 0 0 no-repeat ;
  }
  li#menu5 a {
    background: transparent url(img/menu_5.gif) 0 0 no-repeat ;
  }

  li#menu1 a:hover {
    background: transparent url(img/menu_1o.gif) 0 0 no-repeat ;
  }
  li#menu2 a:hover {
    background: transparent url(img/menu_2o.gif) 0 0 no-repeat ;
  }
  li#menu3 a:hover {
    background: transparent url(img/menu_3o.gif) 0 0 no-repeat ;
  }
  li#menu4 a:hover {
    background: transparent url(img/menu_4o.gif) 0 0 no-repeat ;
  }
  li#menu5 a:hover {
    background: transparent url(img/menu_5o.gif) 0 0 no-repeat ;
  }


  h2#mainimg {
    margin: 0;
    padding: 0;
    text-indent: -9999px;
    font-size:0;
    line-height: 0;

    display: block;
    width: 760px;
    height: 200px;
    background: transparent url(img/top_img.gif) 0 0 no-repeat ;
  }
  #info ul{
    list-style-type : none;
    margin: 0;
    padding: 0;
  }
  #info li{
    list-style-type : none;
    width: 380px;
    margin: 0;
    padding: 0;
    float:left;
    text-indent: -9999px;
    font-size:0;
    line-height: 0;
  }

  li#corp_outline a {
    text-decoration: none;
    display: block;
    margin-left: auto;
    width: 75px;
    height: 20px;
    background: transparent url(img/info_1_1.gif) 0 0 no-repeat ;
  }
  li#inq a {
    text-decoration: none;
    display: block;
    margin-right: auto;
    width: 97px;
    height: 20px;
    background: transparent url(img/info_2_1.gif) 0 0 no-repeat ;
  }

  li#corp_outline a:hover {
    background: transparent url(img/info_1_1o.gif) 0 0 no-repeat ;
  }
  li#inq a:hover {
    background: transparent url(img/info_2_1o.gif) 0 0 no-repeat ;
  }

  #copyright {
    clear:both;

    margin: 0;
    padding: 0;
    text-indent: -9999px;
    font-size:0;
    line-height: 0;
  }
  #copyright a {
    margin: 0 auto;
    display: block;
    width: 125px;
    height: 20px;
    background: transparent url(img/copyright_1.gif) 0 0 no-repeat ;
  }
  #copyright a:hover {
    background: transparent url(img/copyright_1o.gif) 0 0 no-repeat ;
  }

-->
</style>
</head>
<body>
<div id="allcontent">
  <div id="head">
    <ul>
      <li id="logo_top"><a href="#">kikkyのパソコンQ&A</a></li>
      <li id="menu1"><a href="#">メニュー1</a></li>
      <li id="menu2"><a href="#">メニュー2</a></li>
      <li id="menu3"><a href="#">メニュー3</a></li>
      <li id="menu4"><a href="#">メニュー4</a></li>
      <li id="menu5"><a href="#">メニュー5</a></li>
    </ul>
  </div>
  <div id="contents">
    <h2 id="mainimg">イメージ</h2>
  </div>
  <div id="foot">
    <div id="info">
      <ul>
        <li id="corp_outline"><a href="#">企業概要</a></li>
        <li id="inq"><a href="#">お問い合わせ</a></li>
      </ul>
    </div>
    <div id="copyright">
      <a href="#">コピーライト</a>
    </div>
  </div>
</div>
</body>
</html>

△上に戻る

このページはリンクフリーです。設定などは自己責任で…
Copy Right kikky

kikky.net