Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
  • ベストアンサー
※ ChatGPTを利用し、要約された質問です(原文:画像をずらしてhoverしたいのですがIE7では×)

画像をずらしてhoverしたいのですがIE7では×

このQ&Aのポイント
  • IE7以外の全ブラウザではうまくいきますが、唯一IE7だけはうまくいきません。
  • 他のページは普通にロールオーバーします。
  • Dreamweaverのテンプレートで編集不可能領域に含まれてますので、全ページのコードは同一です。

質問者が選んだベストアンサー

  • ベストアンサー
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.7

考えてみりゃHTMLは <body> _<div class="hedder" id="TOP"> __<h1>見出し</h1> __<p class="topLogo"> ___<a href="index.html"><img src="./images/Logo_small.jpg" width="48" height="33" alt="Logo" /></a> __</p> _</div> _<div class="nav"> __<h1>サイトマップ</h1> __<ol> ___<li><a href="index.html" title="トップへ">TOP</a></li> ___<li><a href="particular.html" title="こだわり">worry</a></li> ___<li><a href="goods-catalog.html" title="カタログ">catalog</a></li> ___<li><a href="product.html" title="製品">product</a></li> ___<li><a href="form.html" alt="コンタクト">Contuct Us</a></li> __</ol> _</div> _<div class="footer"> __<h2>文書情報</h2> __<dl> ___<dt>First Published</dt> ___<dd>2011-06-06</dd> __</dl> _</div> </body> </html> これだけのほうが、書き損じしようがないほど簡単だし、ベストですね。CSSも少し簡単になるし・・・。

すると、全ての回答が全文表示されます。

その他の回答 (6)

  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.6

CSSのファイル名を間違っています。 screen.css ご注意ください。  No.3のものは携帯電話用です。 <link rel="stylesheet" href="./CSS/handheld.css" media="handheld,tty" type="text/css" />

すると、全ての回答が全文表示されます。
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.5

IE5,IE6ではCSS2.1の属性セレクタに対応していないので ★別途CSS2.1に対応していないIE5,6のため、 HTMLの一部を書き直したもの・・ __<ol> ___<li class="top"><a href="index.html" title="トップへ">TOP</a></li> ___<li class="kodawari"><a href="particular.html" title="こだわり">worry</a></li> ___<li class="catalog"><a href="goods-catalog.html" title="カタログ">catalog</a></li> ___<li class="from_producer"><a href="index.html" title="製品">product</a></li> ___<li class="contact"><a href="form.html" alt="コンタクト">Contuct Us</a></li> __</ol> とCSSを書き直したもの div.nav li.top a:hover{background-position:0px -50px;} div.nav li.kodawari a{background-position:-190px 0px;} div.nav li.kodawari a:hover{background-position:-190px -50px;} div.nav li.catalog a{background-position:-380px 0px;} div.nav li.catalog a:hover{background-position:-380px -50px;} div.nav li.from_producer a{background-position:-570px 0px;} div.nav li.from_producer a:hover{background-position:-570px -50px;} div.nav li.contact a{background-position:-760px 0px;} div.nav li.contact a:hover{background-position:-760px -50px;} も合わせて調べてみた。  そこで、ひょっとしてと思って、 Another HTML-lint gateway ( http://openlab.ring.gr.jp/k16/htmllint/htmllint.html ) W3C CSS 検証サービス ( http://jigsaw.w3.org/css-validator/#validate_by_input ) もチェック・・  そしたら、ずうっと下のほうで・・ <a href="goods-catalog.html" /></a>  のエラーだと・・・・・思わず笑ってしまった。最初にそれをチェックすべきでした。 これって <a href="goods-catalog.html"></a></a>ということ。そりゃ閉じられていれば、CSSが機能するはずがない。  悔しいのでこうして、全部あげておきます。   HTMLが出来上がったら The W3C Markup Validation Service ( http://validator.w3.org/#validate_by_input ) Another HTML-lint gateway ( http://openlab.ring.gr.jp/k16/htmllint/htmllint.html ) でチェック。CSSができたら W3C CSS 検証サービス ( http://jigsaw.w3.org/css-validator/#validate_by_input ) でチェックを忘れないように なお、CSSはオーサリングツールに頼るのは無理です。カスケーディングスタイルシートの命ともいえるカスケーディングに対応したツールはありません。そのため、とんでもないCSSを作るし、そのためにHTMLもとてもいびつなものになる。シンプルなHTMLをツールで作成して、CSSは手で書きましょう。ある範囲内の設定は一画面で見渡せるようにしましょう。後日のメンテナンスが不可能になります。  例示したHTMLやCSSだと、極めて簡単で何をしているかもわかるでしょう。そして、それは携帯電話でも様々な幅のプレイに対応している。

すると、全ての回答が全文表示されます。
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.4

検閲を通過するのを待っていたら埒が明かないので、引っかかりそうな部分を削除して再投稿します。  あまりにも長大で、チェックする気がうせてしまいますが、興味がある現象なので調べてみることにした。  しかし、とても全体が見渡せるサイズではないので、HTMLとCSSを見比べながら期待されているデザインを想定しながら、コンパクトにして調べました。 [HTML] XHTML1.0 文字コードUTF-8 タブは全角の_に変換してある。 <?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" /> _<title>サンプル</title> _<meta name="author" content="ORUKA1951" /> _<meta http-equiv="Content-Style-Type" content="text/css" /> _<link rev="made" href="mailto:" title="send a mail" /> _<link rel="START" href="../index.html" /> _<link rel="stylesheet" href="./CSS/screen2.css" media="screen" type="text/css" /> _<link rel="stylesheet" href="./CSS/handheld.css" media="handheld,tty" type="text/css" /> </head> <body> _<div class="hedder" id="TOP"> __<p class="topLogo"> ___<a href="index.html"><img src="./img/Logo_s.jpg" width="48" height="33" alt="Logo" /></a> __</p> _</div> _<p class="main_image"> __<img src="./img/sample_s.jpg" width="230" height="72" alt="イメージ" /> _</p> _<div class="nav"> __<ol> ___<li><a href="index.html" title="トップへ">TOP</a></li> ___<li><a href="particular.html" title="こだわり">worry</a></li> ___<li><a href="goods-catalog.html" title="カタログ">catalog</a></li> ___<li><a href="product.html" title="製品">product</a></li> ___<li><a href="form.html" alt="コンタクト">Contuct Us</a></li> __</ol> _</div> </body> </html> [CSS screen.css] CSS2.1 文字コードUTF-8 /* 幅の設定 */ div.header,div,p.main_image,div.nav{width:100%;max-width:950px;margin:auto;} div.header{height:380px;} /* 文章に関係ない画像は背景 */ p.topLogo,p.main_image{margin-top:10px;} p.topLogo a img,p.main_image img{display:none;} /* 画像枠のサイズ */ p.topLogo a{display:block;width:240px;height:169px;background-image:url(../imags/Logo.jpg)} p.main_image{height:300px;background-image:url(../imageg/sample.jpg)} /* ナビゲーションリンク */ div.nav{margin-top:5px;min-width:240px;} div.nav li a:hover { color: #ff0000;} div.nav li{ height:50px;line-height:50px;width:19%;float:left; list-style:none;min-width:80px;margin:0 5px 5px 0; } /* アンカーをブロック化し、背景画像の設定 */ div.nav li a{ display:block;width:100%;height:100%; color:#473906;text-decoration:none;text-align:center; background-color:rgb(255,160,160);background-repeat:no-repeat; background-image:url("../images/navi/navi.gif");background-position:0px 0px; } /* :link,:hover,:actveの設定 */ div.nav li a[href="index.html"]:hover{background-position:0px -50px;} div.nav li a[href="particular.html"]{background-position:-190px 0px;} div.nav li a[href="particular.html"]:hover{background-position:-190px -50px;} div.nav li a[href="goods-catalog.html"]{background-position:-380px 0px;} div.nav li a[href="goods-catalog.html"]:hover{background-position:-380px -50px;} div.nav li a[href="product.html"]{background-position:-570px 0px;} div.nav li a[href="product.html"]:hover{background-position:-570px -50px;} div.nav li a[href="form.html"]{background-position:-760px 0px;} div.nav li a[href="form.html"]:hover{background-position:-760px -50px;} [その他の画像] ../images/sample.jpg   950px × 300px ../imageg/Logo.jpg    240px × 169px ../images/sample_s.jpg  230px × 72px ../imageg/Logo_s.jpg   48px × 33px "../images/navi/navi.gif 950px × 100px を用意して、色々条件を変えて調べました。

すると、全ての回答が全文表示されます。
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.3

追加] handheld.css @charset "UTF-8"; /* handheld用の全般的な設定 */ /* ナビゲーションリンク */ div.nav ol,div.nav ol li{display:block;list-style:none;} div.nav li{height:10px;width:100px;margin:0 2px 2px 0;} div.nav li a{display:block;width:10em;height:1.5em; text-decoration:none;text-align:center; background-color:rgb(255,160,160); }  最初の回答が表示されてから、わからないところは聞いてください。  本当を言うと、ナビゲーションリンク一つ一つにidやclass名すら不要なのですが、後方互換のため書いてあります。

すると、全ての回答が全文表示されます。
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.2

と言いながら、画像添付を忘れた。  本文はしばらく待ってくださいね。HTMLソースに「製品情報」と言う語句を入れてしまったので・・(^^)チェックにかかった。まったく成長しない検閲ロボットだ。

すると、全ての回答が全文表示されます。
  • ORUKA1951
  • ベストアンサー率45% (5062/11036)
回答No.1

あまりに膨大で、見ることをあきらめていたが、どなたからも回答がないので・・ HTML/CSSを書き直してチェックしてみた。 ★CSSは全体が見渡せるようにコンパクトにしないとメンテナンス不能になる。 ★HTMLは正しく書かないと・・<a href="mailto:>は認められていません。 ★今回は、携帯電話などでも表示されることにした  (すみません実は私のノートからは幅950pxじゃ、はみ出すので) ★CSSには問題がなく、HTMLを見直して、がっくり来たので最後に書いておきます。(ごめん) 注意)CSSはオーサリングツールじゃ無理です。グループ化も継承(カスケーディング)も、詳細度の計算もしてくれない。こんなに小さくてすむものが、あの量に肥大する。当然、それに対応させるため、HTMLもへんてこなものになる。 [CSS] @charset "UTF-8"; body { font-family:"MS ゴシック", "MS Gothic", "Osaka-等幅", Osaka-mono, monospace; color: #473906;background-color: #fafde1 ;} div.nav li a:hover { color: #ff0000;text-decoration:none;} div.header,div,p.main_image,div.nav{width:100%;max-width:950px;margin:auto;} div.header{height:380px;} p.topLogo,p.main_image{margin-top:10px;} p.topLogo a img,p.main_image img{display:none;} p.topLogo a{display:block;width:240px;height:169px;background-image:url(../img/sample1.jpg)} p.main_image{width:950px;height:300px;background-image:url(../img/hikaku.jpg)} div.nav{margin-top:5px;} div.nav li{height:50px;line-height:50px;width:19%;float:left;list-style:none;} div.nav li a{ display:block;width:100%;height:100%; color:#473906;text-decoration:none;text-align:center; background-color:rgb(255,160,160); background-image:url("../images/navi/navi.gif"); background-repeat:no-repeat; background-position:0px 0px; } div.nav li.kodawari a{background-position:-190px 0px;} div.nav li.catalog a{background-position:-380px 0px;} div.nav li.from_producer a{background-position:-570px 0px;} div.nav li.contact a{background-position:-760px 0px;} div.nav li.top a:hover{background-position:0px -50px;} div.nav li.kodawari a:hover{background-position:-190px -50px;} div.nav li.catalog a:hover{background-position:-380px -50px;} div.nav li.from_producer a:hover{background-position:-570px -50px;} div.nav li.contact a:hover{background-position:-760px -50px;} [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" /> _<title>サンプル</title> _<meta name="author" content="ORUKA1951" /> _<meta http-equiv="Content-Style-Type" content="text/css" /> _<link rev="made" href="mailto:orika1951@hoge.com" title="send a mail" /> _<link rel="START" href="../index.html" /> _<link rel="stylesheet" href="./CSS/screen.css" type="text/css" /> _<link rel="stylesheet" href="./CSS/handheld.css" media="handheld" type="text/css" /> <style type="text/css"> </style> </head> <body> _<div class="hedder" id="TOP"> __<p class="topLogo"> ___<a href="index.html"><img src="./img/sample1_s.jpg" width="48" height="33" alt="Logo" /></a> __</p> _</div> _<p class="main_image"> __<img src="./img/hikaku_s.jpg" width="230" height="72" alt="イメージ" /> _</p> _<div class="nav"> __<ol> ___<li class="top"><a href="index.html" title="トップへ">TOP</a></li> ___<li class="kodawari"><a href="particular.html" title="こだわり">worry</a></li> ___<li class="catalog"><a href="goods-catalog.html" title="カタログ">catalog</a></li> ___<li class="from_producer"><a href="index.html" title="製品">product</a></li> ___<li class="contact"><a href="form.html" alt="コンタクト">Contuct Us</a></li> __</ol> _</div> </body> </html> ★実は機能しない<a href=""></a>は、<a href=""/></a>と、内容の前に閉じられてました。  テストのために、CSSもHTMLもひとつずつ修正して出来上がっちゃったので、参考にあげておきます。ぜひ参考にしてください。  内容に直接関係ない画像は小さくしてあります。なお、使用したリンクの背景画像は添付のようなものです。:hoverで下側が表示される。  IE5~IE8、opera,firefox,safariで確認しました。 The W3C Markup Validation Service ( http://validator.w3.org/#validate_by_input ) W3C CSS 検証サービス ( http://jigsaw.w3.org/css-validator/#validate_by_input ) Another HTML-lint gateway ( http://openlab.ring.gr.jp/k16/htmllint/htmllint.html ) で検証済み、はじめに検証すれば答えは出るはずだけど、あまりにエラーが多くて無理だろうと考えたのが失敗。 アドバイス  HTMLができたら、The W3C Markup Validation Serviceなどでチェックしてください。 Another HTML-lint gateway ( http://openlab.ring.gr.jp/k16/htmllint/htmllint.html )

すると、全ての回答が全文表示されます。

関連するQ&A