Firefoxでbackground-repeatが表示されない

このQ&Aのポイント
  • Firefoxでbackground-repeatが表示されない問題が発生しています。
  • contentボックスの中にsideとmainを配置した後、contentの背景にy軸にリピートしてメニュー用の画像を表示させようとしたが、うまくいきません。
  • 検索結果によると、clearfixを使用した回避方法があるようですが、この方法でも解決できませんでした。
回答を見る
  • ベストアンサー

Firefoxでbackground-repeatが表示されない

contentボックスの中に sideとmainを配置した後 contentの背景にy軸にリピートして メニュー用の画像を表示させようとしたのですが 画像が表示されずうまくいきません。 検索してclearfixで回避できるような感じのものを見つけたので とりあえず追加してみたのですが駄目でした。 うまく表示させる方法を教えてください。 #content { width: 800px; border: #333333; margin: auto; background-image: url(img/aaa.jpg); background-repeat: repeat-y; } #side { float:left; width: 200px; margin-right: 10px; } #main { float:left; width: 570px; padding-right: 0px; } .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix {display: inline-block;} /* Hides from IE-mac \*/ * html .clearfix {height: 1%;} .clearfix {display: block;} /* End hide from IE-mac */

  • CSS
  • 回答数1
  • ありがとう数1

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

  • ベストアンサー
  • leap_day
  • ベストアンサー率60% (338/561)
回答No.1

こんにちは clearfixは使用したことが無いので分かりませんが <style type="text/css"><!-- #content { width: 800px; border: 1px solid #333333; margin: auto; background-image: url(img/aaa.jpg); background-repeat: repeat-y; } #side { float:left; width: 200px; height:500px; margin-right: 10px; } #main { float:left; width: 570px; padding-right: 0px; } --></style> <div id="content"> <div id="side">side</div> <div id="main">main</div> <div style="clear:both;"></div> <div> ってことですよね?(#sideのheightは分かりやすくする為に付け加えているだけです) 違うのは#contentのborderのみです(線の太さと線種がいります) ほとんどそのままですが表示されているみたいですね(side部分に縦並びに画像が表示) 画像のパスや名前はあっていますか?違ってたら何も表示されていませんでした

yosakun
質問者

お礼

leap_dayさん ご回答ありがとうございます。 <div style="clear:both;"></div>をつけてませんでした うまく表示されましたありがとうございましたm(__)m

関連するQ&A

  • css: IEでsidebarが表示されない

    cssで2カラムのページを左右を両方floatさせて作っています。 firefoxでは表示されるsidebar(背景、画像、テキストを含むすべて)がIE7では表示されません。clearfixの問題かと思いclearfixを入れてみましたがうまくいきませんでした。 どうしたらよいかご存知の方がいたら教えてください。よろしくお願いします。 ちなみにCSSの主要部分は以下のとおりです。 /*--- container ---*/ #container {position: relative;     background:url(images/background.jpg) repeat-y; width: 800px; hight: 600px; padding: 0; margin-left: auto; margin-right: auto; text-align: left; border: 0; } /*--- header ---*/ #header {width: 800px; height: 107px; margin:0;} /*--- side-bar ---*/ #side-bar{position:absolute; background: transparent url(images/menu_bckgrnd.png) center center no-repeat; width: 150px; padding:0; float:left;} #side-bar ul { margin: 0; padding: 50px 50px 50px 50px;    ist-style: none;         width:30px;} #side-bar li { margin: 0; padding: 0;} #side-bar li a{ display:block;} #side-bar a:hover{position: relative; top: 1px; left: 1px;} /*--- main-nav: content area ---*/ #main-nav {background: url(images/design.png) top left no-repeat; width: 610px; margin-top: 0 0 0 150px; padding: 0 10px 0 30px; float:right;} #main-nav a:hover {position: relative; top: 1px; left: 1px; } #content1{ float:left; width:200px; margin: 0 2px 20px -20px; background:#fff;} #content2{ float:left; width:200px; margin: 0 2px 20px 2px; background:#fff;} #content3{ float:left; width:200px; margin: 0 2px 20px 2px; background:#fff;} /*--- footer ---*/ #footer {width: 800px; height: 100px; background: transparent; margin: -100px 0 0 0; clear: both; text-align:center; padding-top:50px;} /* -- clearfix -- */ .clearfix{ zoom:1; } .clearfix:after{content:'.'; display:block; visibility:hidden; height:0; clear:both;}

    • ベストアンサー
    • CSS
  • IE8で印刷時に背景が出ない(Floatを内包する要素)

    IE8で印刷時に背景が出ない(Floatを内包する要素) 以下の内容のページを印刷の際、IE8で#wrapの内容が複数ページにまたがるときだけ#wrapの背景画像がうまく表示されません(最終ページのみ背景が出ます)。 firefox、IE6、IE7では問題なく印刷されます。 clearfixの仕方に問題があるのかと削除して試しても結果は同じでした。 他に原因が思い当たらず困ってるのですが、アドバイスをいただけないでしょうか? ※css #wrap { width: 850px; background-image: url(../_images/common/wrap_bg.gif); background-repeat: repeat-y; margin-right: auto; margin-left: auto; margin-top: 0px; } #main_contents { width: 600px; float: right; } #side { width: 250px; float: left; } .clearfix:after { content: " "; display: block; visibility: hidden; clear: both; height: 0.1px; font-size: 0.1em; line-height: 0; } .clearfix { display: inline-table; min-height: 1%; } @media print{ .clearfix:after{ content:"."; display:block; height:0; clear:both; visibility:visible; } } ※HTML (前略) <div id="wrap" class="clearfix"> <div id="main_contents">~</div> <div id="side">~</div> </div> (後略)

  • IE6での表示がうまくいかず困っています

    すみません!先ほど同様の質問をしたのですが、文字数オーバーで途中で切れてしまっていたので本当に恐縮ですが再度お願いいたします。 コーディングを勉強中なのですが、どうしてもIE6での表示がうまくいかず、大変困っています。色々ググって調べてみたのですが、決定的な原因がわからず本当にどうすればよいのかわかりません・・・。どなたかご教示いただけませんでしょうか。 他のFireFOX,Safari,IE8では多少のズレはあるものの普通に表示されました。IE6では背景画像とフッターのみしか表示されない。という状況です。 CSSは以下です。 /* generated by csscreator.com */ html{ height:100%; } body{ margin:0; padding:0; text-align:center; color: #fff; background: #000000 url("../images/back-right.gif") repeat-x; position: relative; text-decoration: none; height:100%; } body > #pagewidth { height: auto; } img { border-style:none; } ul{ margin:0; padding:0; text-align:left; } li{ list-style-type: none; line-height:100%; } p{ margin:0; padding:0; text-align:right; } #bg_wrap { height: 423px; width: 50%; top: 0px; background: url(../images/back-left.gif) repeat-x; position: absolute; } #pagewidth{ width: 918px; height: 100%; min-height: 100%; text-align:left; margin: 0px auto; position: relative; background: url(../images/left-col.gif) left repeat-y; } #left-container{ width: 130px; height: 100%; float:left; position:relative; padding-left: 23px; } #header{ width: 100%; height: 266px; color: #000; background-color: #fff; } #navigation{ width: 100%; color: #fff; padding-bottom: 5em; } #main-container{ width: 764px; float: right; display:inline; position: relative; } #maincontents{ padding-right: 21px; } #footer{ height: 50px; width: 100%; text-align:left; padding-left: 95px; clear: both; } /* *** Float containers fix: http://www.csscreator.com/attributes/containedfloat.php *** */ .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix{display: inline-block;} /* Hides from IE-mac \*/ * html .clearfix{height: 1%;} .clearfix{display: block;} /* End hide from IE-mac */ /*printer styles*/ @media print{ /*hide the left column when printing*/ #leftcol{display:none;} #twocols, #maincol{width:100%; float:none;} } 以上です、よろしくお願いいたします。

    • ベストアンサー
    • HTML
  • 画像をずらしてhoverしたいのですがIE7では×

    一枚の画像をずらしてロールオーバーさせてナビをつくったのですが、IE7以外の全ブラウザではうまくいきますが、唯一IE7だけはうまくいきません。 5つのナビボタンのうち、左3つがポイントしても矢印と画像が変わりません。 ですが、それはトップページのナビだけの話で、他のページは普通にロールオーバーします。 ナビの部分はDreamweaverのテンプレートで編集不可能領域に含まれてますので、全ページのコードは同一です。 以下、コードです。 <!--HTML--> <body> <div id="container"> <div id="hedder"> <div id="toprogo"><a href="index.html"><img src="○○"/></a></div> <div id="main_image"><img src="○○"/></div> <div id="navi"> <div id="top"><a href="index.html"/></a></div> <div id="kodawari"><a href="particular.html" /></a></div> <div id="catalog"><a href="goods-catalog.html" /></a></div> <div id="from_producer"><a href="index.html" /></a></div> <div id="contact"><a href="mailto:" /></a></div> </div> </div> </div> </body> <!--ここからcss--> body { font-family:"MS ゴシック", "MS Gothic", "Osaka-等幅", Osaka-mono, monospace; color: #473906; background-color: #fafde1 ; } img { border: none; } a { color: #473906; text-decoration: none; } a:hover { color: #ff0000; } #container { width: 950px; margin: auto; } #hedder { widht: 950px; height: 380px; } #top_logo {margin-top: 10px; } #main_image { width: 950px; height: 300px; margin-top: 10px; } #navi { margin-top: 20px; /margin-top: 0 ; } #top a { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: 0px 0px; display: block; float: left; } #top a:hover { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: 0px -50px; display: block; float: left; } #kodawari a { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -190px 0px; display: block; float: left; } #kodawari a:hover { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -190px -50px; display: block; float: left; } #catalog a { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -380px 0px; display: block; float: left; } #catalog a:hover { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -380px -50px; display: block; float: left; } #from_producer a { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -570px 0px; display: block; float: left; } #from_producer a:hover { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -570px -50px; display: block; float: left; } #contact a { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -760px 0px; display: block; float: left; } #contact a:hover { width: 190px; height: 50px; margin-top: 30px; background-image: url(images/navi/navi.gif); background-repeat: no-repeat; background-position: -760px -50px; display: block; float: left; } つめて見にくくなっていますが、お願いいたします。

    • ベストアンサー
    • CSS
  • firefoxでfloatの調整の仕方CSS

    CSSで下記(div)のなかにBOXを3つ並べました、 ie6以上では思い通りに表示されるのですがFireFox(バージョン3.5.3)では一番右端にくるBOXが左端のBOXの下に入ってしまいます。 どなたか解決策を教えていただけますでしょうか? ----ソース部分--- <div class="setbox1"> <div id="rent1"><a href="eee.html"><img src="img/trans_rent.gif" width="234" height="69" /></a></div> <div id="rent2"><a href="aaa.html"><img src="img/trans_rent.gif" width="234" height="69" /></a></div> <div id="rent3"><a href="ccc.html"><img src="img/trans_rent.gif" width="234" height="69" /></a></div> </div> ----以下CSS---- .setbox1{ margin-left : 25px; width : 750px; } #rent1{ margin-top : 20px; margin-left : 0px; float : left; width : 234px; } #rent1 a{ background-image : url(img/rent1.gif); display : block; line-height : 0px; background-repeat : no-repeat; width : 234px; height : 69px; } #rent1 a:hover{ background-position : left bottom; } #rent1 img{border-width : 0px 0px 0px 0px; } #rent2{ margin-left : 0px; float : left; margin-right : 22px; padding-left : 22px; width : 234px; margin-top : 20px; } #rent2 a{ background-image : url(img/rent2.gif); display : block; background-repeat : no-repeat; line-height : 0px; width : 234px; height : 69px; } #rent2 a:hover{ background-position : left bottom; } #rent2 img{border-width : 0px 0px 0px 0px; } #rent3{ margin-top : 20px; margin-left : 0px; padding-left : 0px; } #rent3 a{ background-image : url(img/rent3.gif); line-height : 0px; background-repeat : no-repeat; width : 234px; height : 69px; display : block; } #rent3 a:hover{ background-position : left bottom; } #rent3 img{border-width : 0px 0px 0px 0px; }

  • firefoxでcssを使った時背景画像が表示されない

    CSSでfloatを設定し、その中のそれぞれに背景画像を表示しようとすると、上手くいきません。 背景画像も背景色も表示されません。 構文に間違いがあるのでしょうか? それともそのような仕様なのでしょうか? よろしくお願いいたします。 ###CSS### #container { width: 900px; background-image: url(images/back.jpg); background-repeat: no-repeat; } #header { width: 900px; } #contents { width: 748px; background-color: #FFFFFF; background-image: url(images/image.jpg); background-repeat: no-repeat; background-position: top; padding: 0px; margin-left: 76px; } #footer { clear: both; width: 748px; margin-left: 76px; } #sidebar { float: left; background-image: url(images/side.jpg); width: 180px; margin-top: 14px; background-color: #FFFFFF; } #main { float: right; width: 568px; padding: 0px; background-color: #FFFFFF; background-image: url(../images/image2.jpg);

  • xml宣言をするとIE6で右サイドがカラム落ちしてしまいます。

    http://www.infofx.jp/ 上記のサイトをアップしたばかりなのですが、 xml宣言をすると右サイドがカラム落ちしてしまいます。 SEOを考えてxml宣言は外したくないのですが、良い方法があればどなたか教えて頂けますでしょうか?宜しくお願い致します。ちなみに以下がcssです。 @charset "shift_jis"; body { color: #666666; margin: 0px; padding: 0px; text-align: center; font: 75%/1.8 "メイリオ", "MS Pゴシック", Osaka, "ヒラギノ角ゴ Pro W3"; background: #e9f3ff url(images/kabe.gif) repeat-x top; } h1,h2,h3,p,ul,li{ margin: 0px; padding: 0px; } ul{ list-style-type: none; } img { border: none; vertical-align: bottom; } #container { background-image: url(images/container_bg.gif); width: 896px; text-align: left; background-repeat: repeat-y; background-position: center; margin-top: 0px; margin-right: auto; margin-left: auto; padding-right: 4px; padding-left: 4px; } *.float { float: left; margin-right: 1em; } /*コンテンツ ----------------------------------------------------------------*/ #contents { float: left; width: 706px; } /*メイン ----------------------------------------------------------------*/ #main { float: right; width: 498px; margin-right: 9px; margin-left: 9px; display: inline; } #main h2 { background-image: url(images/midashi_bg.gif); background-repeat: no-repeat; background-position: left top; font-size: 100%; padding-left: 10px; height: 30px; padding-top: 4px; padding-right: 5px; color: #FFFFFF; letter-spacing: 0.5em; } #main p { padding-right: 10px; padding-left: 10px; padding-bottom: 15px; } /*右側 ----------------------------------------------------------------*/ #side { float: right; width: 181px ; display: inline; margin-right: 4px; margin-left: 5px; font-size: 90%; text-align:center; } #side p { margin-bottom: 10px; color: #666666; } .side-table { border: 1px solid #cccccc; padding: 2px; line-height: 2; text-align: center; background: #f7faff; } .side-table h3 { background-color: #ffffff; padding-top: 3px; padding-bottom: 2px; color: #666666; text-align: center; font-weight: normal; font-size: 100%; letter-spacing: 0.5em; margin-bottom: 10px; border: 1px solid #cccccc; } /*メニュー他 ----------------------------------------------------------------*/ #sub { float: left; width: 181px; display: inline; margin-right: 5px; margin-left: 4px; color: #666666; } #sub li { background-image: url(images/menu_arrow.gif); background-repeat: no-repeat; background-position: left center; padding-left: 25px; } #sub ul { margin-bottom: 20px; } #sub li a { color: #666666; text-decoration: none; display: block; width: 100%; } #sub li a:hover { color: #FF3B33; } .arrow-last { background-image: url(images/menu_arrow_last.gif) !important; background-repeat: no-repeat; background-position: left center; } .menu-midashi { border: 1px solid #cccccc; background-image: none !important; background-color: #ffffff; color: #666666; padding-top: 3px; padding-bottom: 2px; } /*clearfix ------------------------------------------------------------------*/ #container:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } #container { display: inline-block; } /* Hides from IE-mac \*/ *html #container { height: 1%; } #container { display: block; } /* End hide from IE-mac */*/

    • 締切済み
    • XML
  • ブラウザ間のCSSの表示違いにつきまして

    現在、趣味のホームページを作成しているのですが、IEでは意図したとおり表示されるのですが、firefoxではCONTENT内上部(float boxの上)に隙間のようなものができてしまって困っています・・・ CSSは以下になります。 #content { width: 680px; margin: 0 10px; padding: 0; background-image: url(../img/content-back.jpg); background-repeat: repeat-y; text-align: center; overflow: auto; text-align: center; } #left { float: left; width: 456px; margin: 0; padding: 50px 0; text-align: center; } #right { float: right; width: 224px; margin: 0; padding: 50px 0; background-color: #000000; text-align: center; } #footer { height: 60px; margin: 0 10px; padding: 0; background-image: url(../img/footer-back.jpg); background-repeat: repeat-x; text-align: center; clear: both; } CONTENTを親要素として、その中にleftとrightボックスを作成しました。 なお、overflow: auto;をなくしてcontent・left・rightに高さを指定したら隙間はなくなるのですが、共に内容に準じた高さ(auto)にしたくて・・・ どなたか解る方いらしたらご教示お願いします!

    • ベストアンサー
    • HTML
  • WordPress レスポンシブテーマのCSS

    http://atsumare.wp.xdomain.jp/ 上記のURLでWordPressを使ってレスポンシブデザインの自作テーマを構築中です。 クラス「glay」でくくったボックスがスマホだと本文に食い込んでしまって困っています。 下記のものがスマホ用スタイルシートです。 /**************************************** スマホ用 ****************************************/ @media screen and (max-width:640px){ #main-1 { max-width: 100%; width: 100%; } /* ページヘッダー */ body.home header { background-size:cover; background-image:url("http://atsumare.wp.xdomain.jp/wp-content/uploads/2019/09/bg.jpg"); width:100%; height:200px; } header img{ background-size:cover; display:inline-block; margin-left:auto; margin-right:auto; } h1 { position:absolute; top:0; left:0; margin-left:50px; margin-top:100px; color:#fff; font-size:24pt; } header img { background-size:cover; /* width:640px; height:200px; */ } .right-dw { display:inline-block; position:relative; width:100%; float:left; } header nav { display: none; } /* コンテンツエリア */ article { width:100%; display:block; padding-left: 5px; padding-right: 5px; box-sizing: border-box; } img { max-width:100%; height:auto; margin: 5px 5px 5px 5px; float:left; background-size:cover; } .right-dw { clear:both; display:block; position:relative; width:100%; height:auto; float:left; } .glay { border:dotted 2px #696969; display:block; color:#696969; padding:2px; margin:15px 15px 15px 15px; position:absolute; } /* フッターエリア */ footer { max-width:100%; width:500px; display:block; text-align:center; margin-left:auto; margin-right:auto; } .footer { width:130px; display:inline-block; text-align:left; color: #000; font-size: 10pt; margin-left:auto; margin-right:auto; } small { font-size:10pt; } } どなたかご教示ください。

    • 締切済み
    • CSS
  • fire foxでリスト番号が表示されてしまう

    プルダウンメニューを使っていてリストマークを表示しない設定にしていますが、firefox(ver3.0)で確認するとリスト番号(1のみ)が表示されます。原因が分かる方いらっしゃいましたら解決方法を教えてください。(下記は5つメニューがある中の3つ分のHTMLとCSSです。) <==HTML==> <div id="menu"> <ul class="main"> <li class="off"onMouseOver="this.className='on'" onMouseOut="this.className='off'"> <a href="#">トップ</a> </li> </ul> <ul class="main2"> <li class="off"onMouseOver="this.className='on'" onMouseOut="this.className='off'"> <a href="#">メニューのご紹介</a> <ol class="sub"> <li><a href="#">トップ</a></li> </ol> <ol class="sub2"> <li><a href="#">メニューのご紹介</a></li> </ol> </li> </ul> <ul class="main3"> <li class="off"onMouseOver="this.className='on'" onMouseOut="this.className='off'"> <a href="#">店舗のご案内</a> <ol class="sub3"> <li><a href="#">店舗のご案内</a></li> </ol> <ol class="sub4"> <li><a href="#">当店の歴史</a></li> </ol> <ol class="sub5"> <li><a href="#">ご予約</a></li> </ol> </li> </ul> </div> <==CSS==> /****全体位置の決定****/ #menu{ width:630px; height: 89px; float: left; z-index: 1000; margin-top: 20px; margin-left: 0px; padding-left: 0px; list-style-type: none; left: 4px; top: -12px; font-size: 0.8em; position:relative; } /****メインメニュー用スタイル****/ ul.main{ margin:0px; padding:0px; list-style:none; text-align:center; width: 126px; float: left; height: 40px; } ul.main2{ margin:0px; padding:0px; list-style:none; text-align:center; width: 126px; float: left; height: 40px; } ul.main3{ margin:0px; padding:0px; list-style:none; text-align:center; width: 126px; float: left; height: 40px; } /*通常時*/ .main li.off{ position:relative;/*×*/ float:left;/*×*/ height:40px;/*○*/ width:126px;/*○*/ overflow:hidden;/*○*/ } .main2 li.off{ position:relative;/*×*/ float:left;/*×*/ height:40px;/*○*/ width:126px;/*○*/ overflow:hidden;/*○*/ } .main3 li.off{ position:relative;/*×*/ float:left;/*×*/ height:40px;/*○*/ width:126px;/*○*/ overflow:hidden;/*○*/ } /*展開時*/ .main li.on{ float:left;/*×*/ overflow:hidden;/*×*/ width:126px;/*○*/ list-style:none; } .main>li.on{ overflow:visible;/*×*/ } .main2 li.on{ float:left;/*×*/ overflow:hidden;/*×*/ width:126px;/*○*/ list-style:none; } .main2>li.on{ overflow:visible;/*×*/ list-style-type:none; } .main3 li.on{ float:left;/*×*/ overflow:hidden;/*×*/ width:126px;/*○*/ list-style:none; } .main3>li.on{ overflow:visible;/*×*/ } /*リンクスタイル*/ .main a{ display:block; text-decoration:none; background-image: url(images/m_top.jpg); background-repeat: no-repeat; height: 40px; width: 126px; text-indent:-2000px; } .main a:hover{ background-image: url(images/m_top-on.jpg); } .main2 a{ display:block; text-decoration:none; background-image: url(images/m_menu_list.jpg); background-repeat: no-repeat; height: 40px; width: 126px; text-indent:-2000px; } .main2 a:hover{ background-image: url(images/m_menu_list-on.jpg); } .main3 a{ display:block; text-decoration:none; background-image: url(images/m_store.jpg); background-repeat: no-repeat; height: 40px; width: 126px; text-indent:-2000px; } .main3 a:hover{ background-image: url(images/m_store-on.jpg); } /****サブメニュー用スタイル****/ ol.sub{ text-align:left; margin: 0px; padding: 0px; height: 40px; width: 126px; }