• 締切済み

safariだけ、cssが効きません!

こんばんは。css入門者です。 Firefoxなどは大丈夫なのですが、safariだけ、 .staffのmargin-bottom:20px;が効きません。 どこが間違ってるのかわからず、困っています。 どうぞよろしくお願いいたします。 <div class="staff"> <p class="staff_name"><img src="img/name_shige.gif" width="107" height="85" alt="ああ)" /></p><br /> <p class="staff_word">いいいいいい</p> <div class="clearfix"><hr /></div> </div><!-- staff end --> ------------------------ .staff { width:670px; margin-bottom:20px; background-color:#d1ece6; line-height:150%; } .staff_name { float:left; margin:0px; } .staff_word { background-color:#FFF; margin:0px 20px 20px 107px; padding:7px; }

  • CSS
  • 回答数3
  • ありがとう数2

みんなの回答

noname#158634
noname#158634
回答No.3

こんばんは#1です。 帰宅したので検証しました。 使用ブラウザはIE8、FF3.6、Opera11.51、Chreome14、Safari5.1です。 <結論> marginしっかり取れています。 なのでですね、質問文と#1の補足以外の部分に原因があると考えられます。それがどこかまでは私からではさすがにわかりませんが。

molybdenite
質問者

お礼

ご丁寧にありがとうございます。 なにか根本的に間違っているのかもしれません…。 もう一度、しっかり見直してみます。 ありがとうございました。

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

floatされている画像がある。 ?画像の縦サイズに比較して文章量が少ない? そのため、画像がブロックをはみ出しているのではないか? floatを含むコンテナブロックに仮にボーダーを設定するとどうなりますか?

noname#158634
noname#158634
回答No.1

いやいやちょっと待った。 そこより下の部分がどうなってるか書いてくれないとmargin-bottomが本当に効いてないのかどうかわからないですよ。 というか、間違った記述でもしてない限り「効かない」はありえない。 とりあえず、その外側に<div></div>を一枚だけかませたソースをこちらで用意したところ、IE8、Chrome、Opera、FF、Safariでmargin-bottom:20pxが聞いていることが確認されました。なのでその部分には問題ありません(HTML、CSS的にどうなんだというツッコミどころはあるが、それは詳しい人が後で現れるし今の本題ではないので割愛)。 ということで、その部分の下と、外側にボックスがあるならその部分を捕捉してください。

molybdenite
質問者

補足

すみません >< 補足します! g_naviは長いので入りきりませんでした。 <!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=UTF-8" /> <title>ああ</title> </head> <body> <div id="wrapper"> <div id="contents"> <img src="img/header01.gif" alt="" width="750" height="21" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="589,4,719,21" href="contact.html" /> </map> <h1><a href="index.html"><img src="img/title.gif" width="292" height="53" alt="あ" /></a></h1> <div id="g_navi"> <ul> <li class="g_navi01"><a href="index.html" title="あ">home</a></li> <li class="g_navi02"><a href="about.html" title="い">about</a></li> <li class="g_navi03"><a href="event.html" title="う">event</a></li> <li class="g_navi04"><a href="action.html" title="え">action</a></li> <li class="g_navi05_on"><a href="staff.html" title="お">staff</a></li> <li class="g_navi06"><a href="donation.html" title="か">donation</a></li> </ul> </div><!--g_navi END--> <div class="clearfix"><hr /></div> <div id="main"> <h2><img src="img/h2_staff.gif" width="115" height="20" alt="あ" /></h2> <p id="staff_pics"><img src="img/staff_pics.jpg" width="428" height="206" alt=" " /></p> <div class="staff"> <p class="staff_name"><img src="img/name_shige.gif" width="107" height="85" alt="あ" /></p><br /> <p class="staff_word">ああああ</p> <div class="clearfix"><hr /></div> </div><!-- staff end --> </div><!-- main end --> <img src="img/footer.gif" width="750" height="23" alt=" " /> </div><!-- contents end --> </div><!-- wrapper end --> </body> </html> --------- @charset "UTF-8"; .clearfix {zoom:1;} .clearfix:after{ content: ""; display: block; clear: both;} *{ margin:0; padding:0; border:none; } body { font-family:"MS Pゴシック","Osaka",sans-serif; color:#493d21; font-size:14px; line-height:140%; } #wrapper { margin:10px auto; width:750px; } #contents { width:750px; background-image:url(../img/bg.gif) ; background-repeat: repeat-y; } #main { margin:40px; } h1 { margin:0 0 23px 1px; } h2 { margin:20px 0px 10px 0px; } #staff_pics { text-align:center; margin-bottom:20px; } .staff { width:670px; margin-bottom:20px; background-color:#d1ece6; line-height:150%; } .staff_name { float:left; margin:0px; } .staff_word { background-color:#FFF; margin:0px 20px 20px 107px; padding:7px; }

関連するQ&A

  • CSS:全体の画面の中央ぞろえ

    全体的にレイアウトを中央にそろえたいのですが、それをするのにあるサイトに、「margin:0 auto」または「margin-left:auto ; margin-right:auto」を指定すると書いてあったのですが、そのようにしても中央ぞろえにはなっていませんでした。 どのようにすればよいのでしょうか? div { float: left; margin-left: auto; margin-right: auto } div.Kukaku1 { background-color:blue; width: 900px; height: 150px; } div.Kukaku2_1 { background-color:green; width: 300px; height: 25px } div.Kukaku2_2 { background-color:aqua; width: 300px; height: 25px } div.Kukaku2_3 { background-color:gray; width: 300px; height: 25px } div.Kukaku3_1 { background-color: black; width: 250px; height: 200px; } div.Kukaku3_2 { background-color: fuchsia; width: 650px; height: 150px } div.Kukaku3_3 { background-color: lime; width: 650px; height: 50px } div.Kukaku4_Ga { width: 450px; height: 150px } div.Kukaku4_1 { background-color: maroon; width: 450px; height: 80px } div.Kukaku4_2 { background-color: navy; width: 450px; height: 70px } div.Kukaku4_3 { background-color: red; width: 450px; height: 150px } <div class="Kukaku1"></div> <div class="Kukaku2_1"></div> <div class="Kukaku2_2"></div> <div class="Kukaku2_3"></div> <div class="Kukaku3_1"></div> <div class="Kukaku3_2"></div> <div class="Kukaku3_3"></div> <div class="Kukaku4_Ga"> <div class="Kukaku4_1"></div> <div class="Kukaku4_2"></div> </div> <div class="Kukaku4_3"></div> 回答よろしくお願いします。

    • ベストアンサー
    • HTML
  • HTML、CSS が、なかなかうまくいきません。

    お世話になります。 HTMLを始めたばかりですので、 ご教授いただけたら幸いです。 以下の図のような感じに並べたいのですが、 なかなかうまい具合にいきません。 黄色は、全てボタンになります。 赤は、ボタンについた吹き出し部分となります。 上段の2つのボタンは、やや大きい感じのボタン。 下段の3つのボタンは、上段に比べて、少し小さい感じのボタンになります。 ボタンは、上段(A)と下段(B)で、 HTML と CSS は、分けようかと考えています。 【HTML】 <div class="Button"> <div class="contents"> <div class="Button_boxA clearfix"> <div class="Yellow_Btn_01"><img src="img/Yellow_Btn_01.png" width="200" height="75" /> </div> <div class="Yellow_Btn_02"><img src="img/Yellow_Btn_02.png" width="200" height="80" /> </div> </div> <div class="btn_boxB clearfix"> <div class="Yellow_Btn_03"><img src="img/Yellow_Btn_03.png" width="100" height="60" /> </div> <div class="Yellow_Btn_04"><img src="img/Yellow_Btn_04.png" width="100" height="65" /> </div> <div class="Yellow_Btn_05"><img src="img/Yellow_Btn_05.png" width="100" height="60" /> </div> </div> </div> </div> 【 CSS 】 div.Button{ width:600px; margin-top:20px; margin-right:auto; margin-left:auto; padding-right:25px; } div.btn_boxA{ width::500px; margin-left:auto; margin-right:auto; margin-bottom:10px; } div.low_btn_01{ width:200px; height:75px; margin-left:auto; margin-right:auto; margin-bottom:10px; float:left; } div.low_btn_02{ width:200px; height:80px; margin-left:auto; margin-right:auto; padding-left:25px; margin-bottom:10px; float:left; } div.btn_boxB{ width::500px; margin-left:auto; margin-right:auto; margin-bottom:10px; } div.low_btn_03{ width:100px; height:60px; margin-left:auto; margin-right:auto; margin-bottom:10px; padding-left:25px; float:left; } div.low_btn_04{ width:100px; height:65px; margin-left:auto; margin-right:auto; margin-bottom:10px; padding-left:25px; float:left; ] div.low_btn_05{ width:100px; height:60px; margin-left:auto; margin-right:auto; margin-bottom:10px; padding-left:25px; 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; }

  • safariだけCSSが崩れてしまいます

    safariだけCSSが崩れてしまいます。 初心者ですが、教えて下さい。 コンテンツ部分の中に、画像(説明文付き)を横並びに3列並べて表示するためにfloatで指定してあります。 下記のように並べたいのですが、safari以外のブラウザでは全てうまく表示されるのに、safariだけ2と3が下に落ちて崩れてしまいます。 1 2 3 4 5 6 どのようにしたら横に並んでくれるのか、わかりません。。 どうかお詳しい方、ご教授下さい。 ______________________________________ #secondary { float:left; width:705px; padding:10px 0 0 15px; margin:0; } .index .module { float:left; width:210px; margin:0 17px 0 0; padding:0 4px; text-align:left; } .galleries { background:#eee; float:left; width:100%; margin:0 0 15px; position:relative; } .gallery .galleries { float:left; position:relative; width: 720px; margin:0 0 15px; padding:0; list-style:none; padding-top:10px; line-height:1.4em; } .gallery .galleries .thumb { float:left; margin:0 10px 10px 0; } .index .galleries { margin-bottom:5px; } .galleries ul { float:left; margin-left:0; margin-bottom:0; list-style:none; text-align:left; } .galleries li { background-image:none; float:left; position:relative; width:220px; height:6.4em; overflow:hidden; margin-bottom:0; padding:75px 0 1.6em 15px; } .archive .galleries li { height:10.5em; } .galleries h3 { margin:0 10px 0 4px; font-size:100%; } .galleries h3 a, .galleries a.img, .galleries h3 a:visited { border-width:0; } .galleries .img { position:absolute; top:4px; left:15px; } .galleries .img img { display:block; } .galleries p { margin:0 10px 0 4px; } .galleries div { margin:0 4px; } .gal { background:url("../images/bg_gal.gif") 11px 0px no-repeat; margin:0; } html>body .gal { background-image:url("../images/bg_gal.png"); }

    • 締切済み
    • CSS
  • CSSでの質問です

    初めて段組を作ってみたんですが、上の余白を無くするにはどうしたらいいのでしょうか? ソースは以下のとおりです。 <style type="text/css"> <!-- #wrapper { width: 760px; margin: 0px auto; } #header { background-color: #9933FF; height: 50px; top: 0px; } #primary { background-color: #c7d5ed; float: right; width: 550px; margin-top: 10px; margin-bottom: 10px; } #secondary { background-color: #f9cfba; float: left; width: 200px; margin-top: 10px; margin-bottom: 10px; } #footer { clear: both; background-color: #99FFFF; height: 50px; } --> </style> </head> <body> <div id="wrapper"> <div id="header"></div> <div id="primary"> </div> <div id="secondary"> </div> <div id="footer"></div> </div> </body> </html> センタリングを維持したまま上の余白をクリアしたいのですが、何か解消法はありますか?

  • cssレイアウトで表を作成したいです。

    添付した画像の様な表組みをテーブルタグを使用せずに作成するのは可能なのでしょうか? もしくは表はテーブルタグを使用したほうが、ソースの量は少なくて済むのでしょうか 全体を囲うBoxAは"height:auto;"を指定してボックスBoxBのテキストの量によって可変する。BoxCのテキストは常にBoxBの最下行と揃える。 /*css*/ .BoxA{ width:490px; height:auto; margin:0px auto 10px auto; background-color:#999999; border:solid #999999 1px;} .BoxA .BoxB{ width:350px; height:auto; margin:0px; padding:5px; float:left; background-color:#fffbfb;} .BoxA .BoxC{ width:129px; height:auto; margin:0px; padding:0px; float:right; background-color:#fffbfb; } .clearfloat { clear:both;} <!--ソース--> <div class="BoxA"> <div class="BoxB"> <p>■■■■■■■■■■<br /> ■■■■■■■■■■<p/> </div> <div class="BoxC"> <p style="margin:auto 0px 0px;">■■■■■■■■■■</p> </div> <br class="clearfloat" /> </div>

    • ベストアンサー
    • HTML
  • HTML CSSを、教えてください。

    お世話になります。 HTMLを始めたばかりで、 超初心者ですので、ご教授いただけたらと思います。 以下の図のような感じに並べたいです。 バックグラウンドには、青色。 赤と緑の部分は、画像配置、 また、右の緑の画像の上に, オレンジのボタン配置を行いたいのです。 ただ、オレンジのボタン配置の仕方が、 なかなか出来ずにいます。 以下のHTMLとCSSには、 オレンジのボタンを入れずに、まず配置をしてみましたが…。 ただ、やはり右の緑の画像が、崩れてしまう感じも…。 オレンジのボタンを入れていただいた形で、 お願いできないでしょうか? (オレンジ画像 width=100 height=50 でお願いします。) 【 HTML 】 <div class="Red"><img src="img/Red.png" width="300" height="50" /> <div class="contents"> <div class="Color_Box"> <div class="Green01"><img src="img/Green01.png" width="200" height="100" /> </div> <div class="Green02"><img src="img/Green02.png" width="200" height="100" /> </div> </div> </div> </div> 【 CSS 】 div.Red{ background:url(img/Bule.png) 0 100% repeat-x; height:200px; margin-top:45px; text-align:center; } div.Color_box{ width:450px; height:100px; } div.Green01{ width:200px; padding-right:50px; float:left; } div.Green02{ width:200px; float:left; }

    • 締切済み
    • CSS
  • CSSでドロップシャドウ

    CSS で写真の周りにふちと影を付けたいのですが Firefox1.5 だとうまくいくのですが、 IE6 だと padding: 4px; が反映されず、ふちの無い写真になってしまいます。どなたかコツを教えていただけないでしょうか? --HTML-- <div class="img-shadow"> <img src="./1.jpg" alt="" width="200" height="150" /> </div> --CSS-- .img-shadow { float:left; background: url(shadowAlpha.png) no-repeat bottom right !important; background: url(shadow.gif) no-repeat bottom right; margin: 10px 0 0 10px !important; margin: 10px 0 0 5px; } .img-shadow img { display: block; position: relative; background-color: #ffffff; border: 1px solid #999999; margin: -6px 6px 6px -6px; padding: 4px; ←ここが怪しい }

  • CSSでロールオーバーを作って中央揃えにしたい。

    CSSを使ってロールオーバーを作成しました。 がんばっているのですが、なかなか難しく、壁ばかりです。 なんとか、ロールオーバーは出来たのですが、その画像が左揃えになっていて、中央揃えにならないのです。 どなたか、お力をお貸しください。よろしくお願い致します。 HTML ----------------------------------- <link href="css.css" rel="stylesheet" type="text/css"> <div class="contents_box2"> <h3 class="no"><a href="info.html"><img src="contents_img2_1.jpg" alt="教室のご案内" width="215" height="53" /></a></h3> <p class="contents_text2">ああああああああああああああああああああああああああああああああああああああああああああああああ <p class="contents_text2">あああああああああああああああああああああああああああああああああああああああああああああああああああああああ <p class="contents_text2"><br /> <div class="rollover01"><a href="info.html"><img src="button2.jpg" alt="詳しくはこちら" width="172" height="29" /></a></div> <img src="contents_img2_3.jpg" width="215" height="18" /></div> -------------------- css↓↓↓ ------------- BODY { COLOR: #666666; TEXT-ALIGN: center; margin-top: 0px; font: 12px/130% "MS Pゴシック", Osaka, "ヒラギノ角ゴ Pro W3"; } IMG { BORDER-RIGHT: 0px; BORDER-TOP: 0px; VERTICAL-ALIGN: bottom; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px; margin: 0px; padding: 0px; } .contents_box2 { FLOAT: left; MARGIN: 0px 12px 0px 0px; WIDTH: 215px; TEXT-ALIGN: left; padding: 0px; background: url(contents_img2_2.jpg) repeat-y; } .contents_text2 { MARGIN: 10px 16px 0px } .contents_detail { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 215px; PADDING-TOP: 0px; TEXT-ALIGN: center } .rollover01 { width:172px; height:29px; background:url(img/button3.jpg) no-repeat center bottom; text-align: center; } .rollover01 a { display:block; width:172px; height:29px; font-size:1px; line-height:1px; outline:none; text-align: center; } .rollover01 a:hover { text-indent:-9999px; } -------------------------------------

  • CSSによる左右の高さをそろえる

    http://oshiete1.goo.ne.jp/qa4249087.html で質問してましたが、すこし内容が変わるので改めて質問させて頂きます。 現在のCSSは、 body { text-align:center;} /*メインのフレーム指定*/ #page { width:760px; margin:0 auto; text-align:left; padding-bottom: 32768px; margin-bottom: -32768px; } /*ヘッダー及び横項目指定*/ #header { width:100%; text-align:center; height:65px; } #header2 { width:750px; line-height:35px; background-color:#FF00FF; } /*中央左右設定及び余白指定*/ .pageyohaku { margin:0 10px; } .main {width:570px; float:right; background-color:#E0FFFF;padding-bottom: 32768px; margin-bottom: -32768px;} .submenu { width:170px; float:left; background-color:#FFC0CB;padding-bottom: 32768px; margin-bottom: -32768px;} .c-both { clear:both; } /*下記記載事項枠指定*/ .footer1 {width:100%; text-align:left;line-height:15px;background-color:#24CF00;clear:both;position:relative;} .footer2 {width:100%; text-align:center;line-height:15px;background-color:#DCDCDC;clear:both;position:relative;} /*リンク指定*/ .link {color:blue;} ------------------- htmlは <html> <head> <link href="style.css" rel="stylesheet" type="text/css"> <title>ホームページ</title> </head> <body> <div id=page> <div id=header> <p><img border="0" src="" width="730" height="65"></p> </div> <div id=header2> <p>このページはレーベル作成を指南します</p> </div> <div class=pageyohaku> </div><! pageyohakuの終わり指定> <div class=main> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> <p>本日はようこそ</p> </div><! mainの終わり指定> <! サブメニュー一覧> <div class=submenu> <p>リンク</p> <p>リンク</p> <p>リンク</p> <p>リンク</p> <p>リンク</p> <p>リンク</p> </div><! submenuの終わり指定> <div class=c-both> </div><! c-bothの終わり指定> <div class=footer1> 最下層メニュー項目</p> </div><! footer1の終わり指定> <div class=footer2> <p>コピーライト</p> </div><! footer2の終わり指定> </div><! Pageの終わり指定> </body> </html> としてあります。 いろいろ参考にしてやりましたところ途中にコピーライトが ありその後ずっと下の方まで左右のびていて左が少し短くて 終わる感じになりますになります。 どうすればいいのでしょうか 過去の質問も参考にしましたがやったらこうなったというわけです。

    • 締切済み
    • CSS

専門家に質問してみよう