フロートのクリアについて

このQ&Aのポイント
  • フロートのクリアについての他の方法を教えてください
  • 設定したフロートのクリアが効かない問題を解決する方法はありますか?
  • マージンとパディングを0に設定したい場合、class"mp0"を使用する方法があります
回答を見る
  • ベストアンサー

フロートのクリアについて

フロートのクリアについて 下記のように設定しているのですが、<p class="mp0" style="clear:both; "></p>でフロートをクリアしています。 このやり方以外でフロートを解除する方法はあるでしょうか? (dlの中でpを使うのはあまり良くない?ようなので) .blocks にclear:bothを設定しても、dl全体の高さが認識されないようで、ボーダーがボックスの下にきてくれません。 ちなみに、class"mp0"となっているのは下で記載はしていませんがマージンとパディングを0に設定しています。 <div id="special_area"> <p class="mp0"><img src="*****"></p> <dl class="blocks"> <dt class="blocks_ico"><a href="#"><img src="***"></a></dt> <dd class="blocks_text"> <p class="blocks_catch"><a href="#">あああ</a></p> <p class="blocks_title"><a href="#">いいい</a></p>   <p class="blocks_com"><a href="#">ううう</a></p> <p class="blocks_go"><a href="#"><img src="***"></a></p> </dd> <p class="mp0" style="clear:both; "></p> </dl><!-- blocks --> <dl class="blocks"> <dt class="blocks_ico"><a href="#"><img src="***"></a></dt> <dd class="blocks_text"> <p class="blocks_catch"><a href="#">かかか</a></p> <p class="blocks_title"><a href="#">ききき</a></p>   <p class="blocks_com"><a href="#">くくく</a></p> <p class="blocks_go"><a href="#"><img src="***"></a></p> </dd> <p class="mp0" style="clear:both; "></p> </dl><!-- blocks --> </div><!-- special end --> css #special_area{ float:right; width:390px; } .blocks{ padding:15px 20px; border-bottom:dotted 1px #bbb; } .blocks_ico{ float:left; width:85px; height:85px; padding:0; } .blocks_text{ float:right; margin:0; width:250px; } .blocks_catch{ margin:0; line-height:1.2; font-weight:bold; color:#333; } .blocks_title{ margin:0; font-weight:bold; font-size:160%; font-size:16px; color:#333; } .blocks_com{ margin:3px 0; line-height:1.1; color:#333; } .blocks_go{ margin:0; }

  • HTML
  • 回答数3
  • ありがとう数22

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

  • ベストアンサー
回答No.3

まず、<p class="mp0" style="clear:both; "></p>ですが位置的に絶対に書けません。これはアウトです。 dl要素をせっかく使っているので、 <dl> <dt></dt> <dd></dd> </dl> <dl> <dt></dt> <dd></dd> </dl> とするのではなく <dl> <dt></dt> <dd></dd> <dt></dt> <dd></dd> </dl> としましょう。 こうすればpの代わりの位置に丁度dtがきます。 なので、dtにclearを指定します。 dlにborder-bottomを指定されているので代わりにddにborder-bottomを指定されるとよいと思います。 蛇足ですが、dl要素はあくまで定義リストなのでdtの内の画像にはalt属性が必要だと思います。 もしかしたらdl要素ではなく、単純にul要素だったりh1~h6とp要素だけでマークアップする方が最適なマークアップなんじゃないでしょうか。

goaldast
質問者

お礼

ありがとうございます。非常に参考になりました!

その他の回答 (2)

  • fujillin
  • ベストアンサー率61% (1594/2576)
回答No.2

clearfix をキーにぐぐってみれば吉かも。

  • rurino
  • ベストアンサー率55% (38/68)
回答No.1

自分の場合ですが、普段は <br class="clr" /> (外部CSS:.clr { clear: both; }) を使っています。

関連するQ&A

  • 画像の様なテーブルレイアウトにするには?

    画像の様なテーブルレイアウトにするにはどうすればいいのでしょうか IE9なら正しく表示されます。 何処を修正したかも教えて下さい **************index.html*********** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <title>無題ドキュメント</title> <link rel="stylesheet" type="text/css" href="css/base.css" > </head> <body> <div id="page"> <div id="header"> <p>header</p> <!-- /#header--></div> <div id="contents"> <!--メインコンテンツ(商品リスト)--> <div id="main"> <ul id="products-list"> <!-- 商品情報 --> <li class="products"> <dl> <dt><a href="#"><img src="img/1.jpg" alt="" class="product-img" /></a></dt> <dd>商品名</dd> <dd>価格:&yen;200,000</dd> <dd><a href="#">商品詳細ページ</a></dd> <dd><a href="#"><img src="cart.jpg" alt="ショッピングカート" width="" height="" /></a></dd> </dl> </li> <!-- // 商品情報 --> <!-- 商品情報 --> <li class="products"> <dl> <dt><a href="#"><img src="img/1.jpg" alt="" class="product-img" /></a></dt> <dd>商品名</dd> <dd>価格:&yen;200,000</dd> <dd><a href="#">商品詳細ページ</a></dd> <dd><a href="#"><img src="cart.jpg" alt="ショッピングカート" width="" height="" /></a></dd> </dl> </li> <!-- // 商品情報 --> <!-- 商品情報 --> <li class="products"> <dl> <dt><a href="#"><img src="img/1.jpg" alt="" class="product-img" /></a></dt> <dd>商品名</dd> <dd>価格:&yen;200,000</dd> <dd><a href="#">商品詳細ページ</a></dd> <dd><a href="#"><img src="cart.jpg" alt="ショッピングカート" width="" height="" /></a></dd> </dl> </li> <!-- // 商品情報 --> <!-- 商品情報 --> <li class="products"> <dl> <dt><a href="#"><img src="img/1.jpg" alt="" class="product-img" /></a></dt> <dd>商品名</dd> <dd>価格:&yen;200,000</dd> <dd><a href="#">商品詳細ページ</a></dd> <dd><a href="#"><img src="cart.jpg" alt="ショッピングカート" width="" height="" /></a></dd> </dl> </li> <!-- // 商品情報 --> <!-- 商品情報 --> <li class="products"> <dl> <dt><a href="#"><img src="img/1.jpg" alt="" class="product-img" /></a></dt> <dd>商品名</dd> <dd>価格:&yen;200,000</dd> <dd><a href="#">商品詳細ページ</a></dd> <dd><a href="#"><img src="cart.jpg" alt="ショッピングカート" width="" height="" /></a></dd> </dl> </li> <!-- // 商品情報 --> </ul> <!-- /#main--></div> <!--メインコンテンツ(商品リスト)--> <div id="sub"> <p>sub</p> <!-- /#sub--></div> <!-- /#contents--></div> <div id="footer"> <p>footer</p> <!-- /#footer--></div> <!--/#page --></div> </body> </html> *************base.css**************** /* CSS Document */ body{ text-align:center; } #page{ width:860px; height:600px; margin:0 auto; background:#690; text-align:left; } #header{ width:860px; height:100px; background:#D1D1DE } #contents{ width:840px; height:380px; margin:10px; padding-left:0; background:#690; } #main{ float:right; width:570px; height:380px; background:#fff; } #sub{ float:left; width:260px; height:380px; background:#fff; } #footer{ width:860px; height:100px; clear:both; background:#fff; background:#D1D1DE } .products{ list-style-type:none; float:left; width:130px; margin:10px 0px 0px 10px; padding:0px; height:170px; background:#F3F59C } .product-img{ margin:0px; padding:0px; width:50px; height:50px; text-align:center; border:none; } #products-list{ margin:0px; padding:0px; }

    • 締切済み
    • CSS
  • 横並びしたいのですが

    横並びしたいのですがdd.sub内のテキストがwidthサイズを超えて2段になった場合や 改行(<br>)を入れた場合それ以降のclear: both;が効かない状態になってしまいます。 dl, dl dd { padding-left: 20px; padding-bottom: 15px; } dl dd.sub { float: left; clear: both; width: 55em; } dl dd.page { margin-left: 55em; margin-bottom: 10px; } <dl> <dt>1 あああ</dt> <dd class="sub">サブ1</dd> <dd class="page">p1</dd> <dt>2 いいい</dt> <dd class="sub">サブ2</dd> <dd class="page">p2</dd> <dt>3 ううう</dt> <dd class="sub">サブ3</dd> <dd class="page">p3</dd> </dl> 理想の並びとしては 1 あああ  サブ1 p1 2 いいい  サブ2 p2 3 ううう  サブ3 p3 のようにしたいのですがCSSをどのようにすれば可能でしょうか? 仮に<dd class="clear"></dd>を追加すれば回り込みの解除はできるのですが 無駄に要素を入れたくないもので他にいい方法はないものかと悩んでおります。

    • ベストアンサー
    • HTML
  • IE7だけに出る謎の空白(CSS)の解決方法

    以前も似たような症状が出たのですが・・・ IE7でだけ、謎の空白が約3px程度出てしまいます。場所は<dl></dl>と<img>の間です。 イメージとしては上から3段をくっつけて中身(<dl></dl>)だけ高さを可変にしてひとつの枠のように見せたいと考えています。 ですがIE7でだけ空白ができてしまうのです。 原因と解決方法を教えていただけないでしょうか? <div id="right"> <img class="top" src="img/bg-rtop.gif" /> <dl> <dt><img src="img/right-tit1.gif" /></dt> <dd>ああああああああああああああああああああああああああああああ</dd> <dt><img src="img/right-tit2.gif" width="200" height="20" /></dt> <dd>ああああああああああああああああああああああああ</dd> <dt><img src="img/right-tit3.gif" width="200" height="20" /></dt> <dd>ああああああああああああああああああああああああああああああああ</dd> <dt><img src="img/right-tit4.gif" width="200" height="20" /></dt> <dd>あああああああああああああああああああああああああ</dd> </dl> <!-- ここで空白ができてしまう・・・--> <img class="under" src="img/bg-runder.gif" /> </div> ■CSS @charset "shift_jis"; body { text-align: center; margin: 0px; background-image: url(img/bg.gif); vertical-align: bottom; line-height: 165%; letter-spacing: 1px; font-size: 12px; } /* 右側の設定*/ #right{ width:200px; float:right; } #right .top { margin: 20px 0 0 0; } #right dl { background-image: url(img/bg-rmiddle.gif); margin: 0px; padding: 0 0 20px 0; } #right dt { padding: 10px 0 0 0; } #right dd { margin: 10px 0 0 12px; padding: 0 0 0 0; } #right .under { margin: 0px; } 一部省略してます・・・ どうかよろしくお願いいたします。

    • ベストアンサー
    • HTML
  • 定義リスト dl dd dt

    困っています。お願いします。 このソースのレイアウトとしましては、 dl1、dl2、dl3と横に並んでいます。 各dtに画像、ddにテキストです。 このカタチが2行続いています。 3行目は、三列の一番左にdl7が置かれるかたちです。 全体としては、 dl1 dl2 dl3 dl4 dl5 dl6 dl7 という感じです。 dl1~dl7まで全て、同じサイズの画像とddにテキストが入っています。 問題はレイアウトではなく、リンクです。 dl1~dl7のdtの中の画像には全てリンクがはれるのですが、 dd部分の一部テキストにはリンクがはれません。 リンクがはれるのは、dl5、dl6、dl7です。 後はリンクを設定しても、リンクがはれない状態です。 いろいろ試してみたのですが、原因がわかりません。 一つ思うことは、dl1、dl2、dl3、dl4の下にはdl4、dl5、dl6があるわけなので、何か下にあるとリンクが効かないのかなあとも思います。 どなたか、教えて頂きたいです。 分かりづらい説明で申し訳ないのですが、宜しくお願い致します。 <dl id="dl1">   <dt id="dt1">     <a href="#"><img src="img/image1.jpg" /></a>   </dt>   <dd class="dd1">     <a href="#">ああああ</a>   </dd> </dl> <dl id="dl2">   <dt id="dt2">     <a href="#"><img src="img/image1.jpg" /></a>   </dt>   <dd class="dd1">     <a href="#">いいいい</a>   </dd> </dl> このカタチをdl7まで繰り返し、htmlに記述します。 次にcssです。 #dl1 { position: relative; width: 170px; height: 170px; padding: 10px 10px 0px 35px; margin: 0px 0px 0px 0px; float: left; } #dt1 a img { text-decoration: none; border-style: none; } #dt1 a:hover img { visibility: hidden; text-decoration: none; border-style: none; } #dt1 a { display: block; width: 170px; height: 170px; background-position:left top; background-repeat:no-repeat; text-decoration: none; } #dt1 a:hover { background-image: url(img/image1-2.jpg); text-decoration: none; } こちらも同様に、dt7まで繰り返しcssを指定。 cssの中身は、画像にホバーしたら、画像が切り替わるようになっています。 次に、テキストのdd部分のcssです。 こちらはクラス指定で、dl1~dl7までの各dd使用。 .dd1 { width: 170px; height: 40px; margin: 0px; color: #ffffff; font-size: 12px; line-height: 16px; padding: 0; } .dd1 a { padding: 0; margin: 0; text-decoration: none; color: #ffffff; } .dd1 a:hover { text-decoration: underline; color: #ffffff; } 長々と失礼いたしました。

    • ベストアンサー
    • HTML
  • firefoxで背景が表示されません

    こちらのQAを見て、floatを消してみたりclear入れてみたりしてみましたが一向に変化しません、 navで指定した背景画像がIEでは出てforefoxでは出ません・・どこをどう直したらよいのでしょうか・・・ ------css----------- body{ background:url(img/bg.jpg); padding:0; width: 775px; margin: 0 auto; } wrapper{ padding:0; width:755px; position:relative; } #head { margin: 0px; height: 54px; padding: 0px; } h1{ margin: 0px; padding: 0px; width: 177px; height: 59px; position: relative; top: 0px; right: 0px; background: url(img/logo.jpg) no-repeat; text-indent: -9999px; text-decoration: none; } #head strong { margin: 0px; padding: 0px; height: 15px; font-size: 12px; color: #FFFFFF; position: absolute; top: 3px; line-height: 15px; text-indent: 350px; } #head img { height: 33px; width: 335px; position: relative; top: -44px; float: right; padding: 0px; margin: 0px 10px 0px 0px; } .main_img { background: url(../img/main_img_bg.jpg) no-repeat; width: 755px; height: 390px; display: block; clear: both; margin: 0px; padding: 0px; position: relative; top: -35px; } .main_img .nav { background: url(img/nav_img.png) no-repeat; height: 369px; width: 208px; margin: 0px; padding: 0px; } .clear { clear: both; } .box01 { margin: 0px; padding: 0px; clear: both; width: 755px; } ---------------html----------------- <body> <!-----------------------wrapper(S)------------------------------------> <div id="wrapper"> <!-----------------------head(S)------------------------------------> <div id="head"> <h1>Bar TRACY バートレイシー</h1> <strong>心斎橋・アメ村barのバー</strong> <img src="css/img/head_tel.jpg" alt="06" /></div> <!-----------------------head(E)------------------------------------> <!-----------------------main_img(S)------------------------------------> <div class="main_img"> <!-----------------------menu(S)------------------------------------> <div class="nav"> <ul> <li class="home"><a href="index.html">ホーム</a></li> <li class="menu"><a href="menu.html">メニュー</a></li> <li class="access"><a href="access.html">アクセス</a></li> <li class="staff"><a href="staff.html">スタッフ紹介</a></li> <li class="event"><a href="event">イベント情報</a></li> <li class="contact"><a href="event">お問い合わせ</a></li> </ul> mixi <p>mixiコミュニティ良かったら コミュに遊びに来てください!</p> </div> <!-----------------------nav(E)------------------------------------> </div> <!-----------------------main_img(E)------------------------------------> <div class="clear"></div> <!-----------------------cont(S)------------------------------------> <div class="cont"> <!-----------------------box01(S)------------------------------------> <div class="box01"> <!-----------------------news(S)------------------------------------> <div class="news"> <h2>ニュース</h2> 画像 <p>サンプルテキスト</p> </div> <!-------news(E)--------> <!-----shop_com(S)------> <div class="shop_com"> <p> ショップインコメント</p> </div> <!-----shop_com(E)----> </div> <!---box01(E)---> <!--box01(S)--> <div class="box01"> <!---bana01(S)---> <div class="bana01"> チケット </div> <!--bana01(E)--> <!---shop_info(S)----> <div class="shop_info"> <h2>ショップ情報</h2> 地図 <dl> <dd>TEL:</dd><dt>06-0000-0000</dt> <dd>住所:</dd><dt>大阪市中央区 </dt> </dl> <dd>mail:</dd><dt>m@00000</dt> <!-----shop_info(E)---> </div> <!--box01(S)--> <!----footer(S)----> <div id="footer"> <p>Homeホーム | Menuメニュー | Accessアクセス | Staffスタッフ | Eventイベント | Contactotお問い合わせ</p> </div> <!---footer(E)--> </div> <!--wrapper(E)--> </body> </html>

  • IE6にてずれる

    こんにちは html超初心者です。 headとcontentsを隙間なく表示したいのですが、IEではコンテンツがずれてしまい うまく表示されません。 コードを記載します。 ================================== --------html------------ <div id="all"> <div id="head"> <h1><a href="../index.html"><img src="img/logo.gif"></a></h1> <div id="guide"> <a href="../index.html">ホーム</a> <a href="index.html">プロフィール</a> <a href="#">リンク</a></div> <p class="clear-both">&nbsp;</p> </div> <div id="contents"> コンテンツ内容 </div> </div> --------css------------ body,a,div,p,h1,h2,h3,ul,li,img,dl,dd,dt,ol{ margin:0; padding:0; text-decoration: none; } #all{ width:650px; } .clear-both{ font-size:0; height:0px; clear:both; line-height:0%; } #head{ width:650px; background:url('../img/main_img.gif') no-repeat; height:90px; } #guide{ float:right; margin:60px 0px 0px 0px; } #contents{ background:url('../../common/img/back_img.gif') repeat-y ; } ================================== headにてボックスを二つ挿入し、それらをそれぞれfloat:left・rightで左右に表示しています。 その下に<p class="clear-both">&nbsp;</p> を挿入し、cssにてそのクラスに対し、 clear:both; line-height:0%; 等を入力しています。 IEにて確認すると、その下のコンテンツが 右にずれてしまっています。 line-height:0%;がcssに記載されていなければ ずれずに表示されますが、headとcontentsの間に 隙間ができてしまいます。 line-height:0%を記載していてもfirefox・operaではcontentsはずれず、隙間もありません。 どなたか教えてください。 よろしくお願いします。

    • ベストアンサー
    • HTML
  • floatさせたdtの内容が多い場合、ddの背景と高さが合いません

    サイトの新着情報を<dl><dt><dd>で組んでいます。 罫線の上に左に画像、右に日付と新着内容が並んでいるように 見せたいのですが、<dt>を左にfloatし<dd>を回り込ませ、 <dd>に罫線の画像を背景で設定た場合、<dd>の内容が少ない時、 罫線画像が左の<dt>の画像と高さが合いません。 <dd>にClearfixを設定すると、モダンブラウザでは<dt>の高さと <dd>の罫線画像の高さが合い、希望通りの表示になりました。 しかし、IE6と7ではモダンブラウザと同じ表示にはなりません。 float以外の方法でも構いませんので、IE6以降とモダンブラウザ ともに<dl><dt><dd>で上記希望の表示を実現させる方法がありましたら、 アドバイス頂けないでしょうか、よろしくお願いしますm(__)m ソースは以下になります。 [HTML] <dl class="news"> <dt><img src="img/photo.jpg" width="50" height="50" /></dt> <dd><span>2009.01.01</span><br /> <a href="#">新着情報のテキストが入ります。</a></dd> <dt><img src="img/photo.jpg" width="50" height="50" /></dt> <dd><span>2009.01.01</span><br /> <a href="#">新着情報のテキストが入ります。</a></dd> <dt><img src="img/photo.jpg" width="50" height="50" /></dt> <dd><span>2009.01.01</span><br /> 新着情報のテキストが入ります。</dd> </dl> [CSS] #index dl.news { padding: 8px 15px; border: #999 1px solid; } #index dl.news dt { width: 50px; float: left; clear: left; } #index dl.news dd { margin: 0 0 6px; padding: 0 0 8px 57px; background: url(../img_cmn/linet.gif) repeat-x bottom; line-height: 125%; } #index dl.news dd:after {/* clearfix */ content: "."; display: block; visibility: hidden; height: 0.1px; font-size: 0.1em; line-height: 0; clear: both; }

    • ベストアンサー
    • HTML
  • 定義リストの横並びと<DIV>要素の改行

    スタイルシートでテーブルのように横並びでレイアウトさせた定義リストの<dt>の内容にリンクを張っているのですが、 FirefoxとOperaで確認すると、リンク1とリンク2にカーソルを持っていってもカーソルの形が変わらず、クリックしても飛べません。 文字色はリンク用のスタイルシートを反映した色になっています。 スタイルシートの記述に問題があるのだと思うのですが、どこが悪いのかが分かりません。 アドバイス頂けると幸いです。 <dl id="sample"> <dt><a href="aaa.html">リンク1</a> <dd>説明 <dt><a href="bbb.html">リンク2</a> <dd>説明 <dt><a href="ccc.html">リンク3</a> <dd>説明 <dt><a href="ddd.html">リンク4</a> <dd>説明 </dl> dl#sample { margin-left: 1.5em; float: left; width: 450px; padding: 1px 1px 0; color: #000; } dl#sample dt { float: left; clear: both; width: 70px; margin-right: 10px; margin-bottom: 1px; padding: 2px 0 2px 2px; } dl#sample dd { float: left; width: 350px; margin-bottom: 1px; padding: 2px; } --------------------------------------- それともう一つ、 http://jquery.andreaseberhard.de/toggleElements/ このJavascriptを利用してDIV要素を開閉しているのですが、 DIV要素を以下のように二つ並べた場合 <div class="toggler-c" title="タイトル1"> <p>内容</p> </div> <div class="toggler-c" title="タイトル2"> <p>内容</p> </div> 二つとも閉じた状態の時、改行せずに タイトル1タイトル2 と表示されるのですが、これはスタイルシートの記述に問題があるからなのでしょうか。

    • ベストアンサー
    • HTML
  • cssの画像切り替え

    宜しくお願いします。 cssでのhoverを使った画像の切り替えを教えてください。 ○html <dl id="dl">  <dt id="dt"><a href="#"><img src="img/image1.jpg" alt="" /></a></dt>  <dd>あ</dd> </dl> ○css #dl     {     width: 170px;     height: 170px;     margin: 0;     } #dt a     {     text-decoration: none;     } #dt a:hover { background-image: url(img/image2.jpg); text-decoration: none;     } というソースで、cssを使い画像を切り替えたいのですが、できません。 html指定で、<img src="~">で画像を表示させておき、 切り替える方法としましては、hoverを使いbackground-imageを使うしかないと思います。 background-imageからbackground-imageへの切り替えは、できるのですが、今回の場合は、どうしてもhtml指定で、<img src="~">からの切り替えを行いたいです。 そもそも、html指定の、<img src="~">で画像を表示する場合、cssで切り替えれるものなのでしょうか? 出来る限り、cssでの切り替えをしたいと考えています。 どなたか、分かる方お願いします。

    • ベストアンサー
    • HTML
  • javascriptのアコーディオンメニューについ

    アコーディオンナビゲーションの作成しておりましたがfirefoxでは問題なく反映されるのですが IEで見るとtop,bottom,leftの三方に枠みたいなものが出てしまいます。原因がわからず困っています。誰かわかる方いらっしゃったらご回答お願い致します。 ※IEの画像データを添付しております。 ※jsはhttp://lab.komadoya.com/blog/2008/08/waterfall-js.phpよりダウンロードしました。 【CSS】 *{ margin:0; padding:0; } h1{ margin:30px 0; font-size:150%; } h2{ margin-bottom:3px; font-size:125%; color:#9ac1c9; } #contents{ margin-bottom:20px; } #localNav{ float: left; width: 180px; } #alphaBlock{ float:left; width:590px; margin-top:20px; } #footer{ margin-bottom:5px; padding-top:5px; border-top:1px solid #000; } #footer address{ font-style:normal; font-size:87.5%; text-align:center; } /*-------------------- accordion --------------------*/ .accordionBox{ width: 180px; font-family: "MS Pゴシック", Osaka, "ヒラギノ角ゴ Pro W3"; font-size: 73%; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; } .accordion{ width:180px; } .accordion dt{ width:180px; border-top:none; font-weight:bold; cursor:pointer; } .accordion dd{ overflow:hidden; display:none; background:#FFF; } .accordion ul{ width:180px; list-style:none; border-top:none; } .accordion a, .accordion a:active, .accordion a:visited{ display:block; color:#333; text-decoration:none; background:#eaf0f2; width:180px; } .accordion a:hover{ background-color:#d9e1e4; color:#000; } /*-------------------- float clear --------------------*/ #contents, .dropdownBox, .accordionBox, .clearFix{ overflow:hidden; } #contents:after, .dropdownBox:after, .accordionBox:after, .clearFix:after{ content:""; display:block; clear:both; height:0px; overflow:hidden; } /*\*/ * html #contents, * html .dropdownBox, * html .accordionBox, * html .clearFix{ height:1em; overflow:visible; } /**/ /* or */ .clear{ clear:both; } 【html】(一部) <dl class="accordion" title="eight"> <dt id="ddheader-eight"><a href="A"><img src="images/common/left_nav_04.gif" width="180" height="40"></a></dt> <dd id="ddcontent-eight"> <ul> <li><a href="a">お茶</a></li> <li><a href="b">酢</a></li> <li><a href="c">滋養強壮・栄養ドリンク</a></li> </ul> </dd> </dl> <dl class="accordion" title="nine"> <dt id="ddheader-nine"><a href="B"><img src="images/common/left_nav_05.gif" width="180" height="40"></a></dt> <dd id="ddcontent-nine"> <ul> <li><a href="a" target="_top">シェイク・ドリンク</a></li> <li><a href="b">代替食</a></li> <li><a href="c">サプリメント</a></li> <li><a href="d">ダイエットインナー・ウェア</a></li> <li><a href="e">甘味料</a></li> </ul> </dd> </dl>

    • ベストアンサー
    • CSS

専門家に質問してみよう