h1のみが反映されない!?

このQ&Aのポイント
  • HTML内で任意の場所に<h1>タイトル</h1>と記述してもデフォルトサイズと#555のカラーになってしまいます。
  • <h2>や<h3>なら反映するのに、<h1>のみ反映しないのがわかりません。
  • 今現在は<h1>で表示したいタイトルをh2としてUPしてますが、<h1>と記述してWEB上で反映しない原因は何でしょうか?
回答を見る
  • ベストアンサー

h1のみが反映されない!?

外部.cssに body { font-size : 80%; font-family:Verdana,Chicago,osaka,sans-serif,"MS Pゴシック"; line-height: 140%; text-align: center; background-color : #ffffff; color:#555; } /* タイトル*/ h1 { font-size:2.3em; color:#ffffff; text-align:left; padding: 10px 0px 0px 10px; } h2 { font-size:1.2em; color:#ff0000; text-align:left; padding: 10px 0px 0px 10px; } h3 { font-size:1.2em; color:#ff0000; text-align:rihgt; padding: 10px 10px 0px 0px; } と設定し、HTML内で任意の***場所に <div id="***"> <h1>タイトル</h1> </div> と記述してもデフォルトサイズと#555のカラーになってしまいます。 text-align:left; や padding: 10px 0px 0px 10px; も全く反映しません。 タイトルの位置を任意の場所を変更しても、状況は同じで <h1>を<h2>や<h3>に打ち直すと.css通りきちんと反映されます。 全体.css記述をコピーすると膨大なので省略しますが、解せないのは<h2>や<h3>なら反映するのに、<h1>のみ反映しないのがわかりません。 色々試してみましたが、今現在は<h1>で表示したいタイトルを h2 { font-size:2.3em; color:#ffffff; text-align:left; padding: 10px 0px 0px 10px; } としてUPしてますが、<h1>と記述してWEB上で反映しない原因は何でしょうか?宜しくお願い致します。

  • HTML
  • 回答数2
  • ありがとう数2

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

  • ベストアンサー
  • dezimac
  • ベストアンサー率56% (2365/4208)
回答No.1

ざっと見た限りではh1のスタイルシートにはミスは無いようです。 h3のtext-align:rihgt;は間違っていますが。 目隠しされた断片的な情報じゃなく、全体(そのもの)を見れれば判るかもしれないですが。 あとりあえず以下でCSSやhtmlの文法にミスがないかチェックしてみては。 http://jigsaw.w3.org/css-validator/ http://openlab.ring.gr.jp/k16/htmllint/htmllintl.html

sinya0840
質問者

お礼

早速の回答ありがとうございました。 http://openlab.ring.gr.jp/k16/htmllint/htmllintl.html は存じてましたが、http://jigsaw.w3.org/css-validator/ は、今回初めて利用しとても役に立ちました! おかげさまで、原因がわかりました。 .cssを作成する時に多窓が面倒なのでファイルの空白の端の方にコピー用のタグを貼り付けながら作業し、 後からそれを全部消したつもりだったのですが...ちょうど<h1>にかかる位置にposition:absolute;の absoluteだけがちょこんと消し残っていました。(恥) こんなケアレスミスを3日がかりでも気がつかないなんて...やはり自分の目では見落としてしまうものですね。 文法チェックサイト&教えてgooに感謝々です。

その他の回答 (1)

noname#56851
noname#56851
回答No.2

レンタルスペースによるとは思いますが、バナーのためのスタイルをボディの中に書き込むことがありますが、それのせいかな、とも思います。 FC2で作っているホームページでは a:visited text-align がおかしくなりました。

sinya0840
質問者

お礼

早速の回答ありがとうございました。 原因は、下記の通りでした。以前にもほんのわずかなミスに気がつくまで数日を要したことがありましたが(汗) 先ずはチェックサイトを利用する重要性を再認識した次第です^^;

関連するQ&A

  • スタイルシートが反映されない。

    htmlに <link rel="stylesheet"type"text/css" href="style.css" media"all"> と記入 style.cssに <style type="text/css"> <!-- body{ text-align:center; padding-top:20px; h1{ text-align:center; font-size:1.5em; color:♯800000; backgraund-color:♯FFFFFF; padding-top:20px; padding-bottom:20px; } --> </style> と記入 bodyは反映されるのにh1が反映されません。 原因がまったくわかりません。 なにが悪いのでしょうか?。 よろしくお願いします。

  • MacからアップしたCSSがWinで反映されな

    こんにちは。現在、Macでホームページを作っています。 その際、CSSでレイアウトやフォント等を設定したのですが、アップロードしたCSSがWindowsでは反映されません。Macではすべてしっかり反映されています。 ブラウザごとの振り分け等、色々と調べて試しましたが変わりませんでした。 どこかおかしなところがあれば指摘、アドバイスの方よろしくお願い致します。 ↓<head></head>内 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title>(タイトル)</title> <link rel="stylesheet" type="text/css" href="main.css"> ↓main.css * { margin: 0; padding: 0; } body,table,tr,td { font-size: 10px; font-family: "Times" ""Osaka"; line-height: 160%; text-align: left; } a:link {color: #000000; text-decoration: none; } a:visited {color: #000000; text-decoration: underline; } a:active {color: #000000; text-decoration: underline; } a:hover {color: #000000; text-decoration: none; } #layout { width: 650px; margin-top: 10px; margin-left : auto; margin-right : auto; text-align : center; } .header { margin: 5px 0px 3px; padding: 20px 10px; border: 1px solid #c0c0c0; background-image: url("(画像URL)") } #main { float: left; width: 436px; margin: 10px 14px 0px 0px; } .entry { border: 1px solid #c0c0c0; margin: 0px 0px 14px 0px; padding: 10px 30px; overflow: auto; } .entry_navi { text-align: left; } .entry_title { font-size: 13px; font-family: "Times"; border-bottom: 1px dashed #c0c0c0; color: #000000; } #side { float: right; width: 200px; margin: 10px 0px ; } .pict { margin: 15px 0px; padding: 8px; border: 1px solid #c0c0c0; } h1 { font-size: 20px; font-weight: bolder; font-family: "Times"; margin: 0px 0px 5px 0px; padding: 0px; color: #ffffff; } h1 a, h1 a:link, h1 a:visited, h1 a:active, h1 a:hover { color: #ffffff; text-decoration: none; } .description { font-size: 10px; color: #ffffff; padding-bottom: 30px; } .list { border: 1px solid #c0c0c0; margin: 0px 0px 14px 0px; padding: 10px 20px; } .list_title { font-family: "Times"; font-size: 16PX; font-weight: bolder; color: #000000; border-bottom: 1px dashed #C0C0C0; }

    • ベストアンサー
    • CSS
  • CSS backgroundが反映されません

    CSS初心者です。 CSSレイアウトで問題にぶつかりました。 下記CSSをIE6で見るとbodyに書いた 「background-image:url(images/flower.png); 」が反映されません。 IE10では反映されました。 いったい何故でしょうか。。。 調べてみたのですがいまいち分かりませんでした。 よろしくお願いいたします。 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ * { margin:0; padding:0; } body { background-image:url(images/flower.png); background-repeat:no-repeat; background-position:bottom; background-attachment:fixed; background: rgb(#00000); color: rgb(76, 76, 76); } body{ text-align:center; } div#container { background-image:url(images/sora.jpg); background-repeat:no-repeat; box-shadow: 10px 10px 10px rgba(0,0,0,0.4); #000; box-shadow: 10px 10px 10px rgba(0,0,0,0.4); #000; } div#container{ width: 770px; margin: 0 auto; text-align: left; border: 3px solid rgb(228, 225, 219); } .photo{ margin: 0px; padding: 0px; left: 600px; top: 970px; width: 141px; position: absolute; } .photo2{ margin: 0px; padding: 0px; left: 400px; top: 970px; width: 141px; position: absolute; } p { line-height: 2em; font-size: 0.8em; } .p1{ font-weight: bold; letter-spacing: 0.1em; } .h1{ text-align: center; } h1 span { display:none; } h2 span { display:none; } h3 { line-height: 1.2em; padding-top: 2.4em; padding-bottom: 1em; font-size: 1em; font-weight: bold; } h3 { background-image:url(images/h3.png); background-repeat:no-repeat; background-position:0px 35px; padding-right: 40px; padding-left: 30px; } h2 { line-height: 1.3em; padding-top: 1em; padding-bottom: 1em; font-size: 1em; font-weight: bold; } a{ color:#0000ff; font-style:normal; text-decoration:underline; } a:link { color: rgb(90, 120, 255); font-style:normal; text-decoration:underline; } a:visited { color: rgb(165, 188, 255); text-decoration:underline; } a:hover { color:#ff0000; font-style:normal; text-decoration:underline; } acronym { border-bottom-color: currentColor; border-bottom-width: medium; border-bottom-style: none; } #intro { padding: 0px 79px 0px 86px; } #participation p { padding-right: 40px; padding-left: 10px; } #intro { padding-top: 50px; } #preamble p { padding-right: 40px; padding-left: 15px; } #explanation p { padding-right: 40px; padding-left: 15px; } #preamble { padding-bottom: 20pt; border-bottom-color: rgb(228, 225, 219); border-bottom-width: 3px; border-bottom-style: ridge; } #explanation { padding-bottom: 20pt; border-bottom-color: rgb(228, 225, 219); border-bottom-width: 3px; border-bottom-style: ridge; } #participation { padding-bottom: 20pt; border-bottom-color: rgb(228, 225, 219); border-bottom-width: 3px; border-bottom-style: ridge; } #benefits { padding-bottom: 20pt; border-bottom-color: rgb(228, 225, 219); border-bottom-width: 3px; border-bottom-style: ridge; } #requirements { padding-bottom: 20pt; border-bottom-color: rgb(228, 225, 219); border-bottom-width: 3px; border-bottom-style: ridge; } #quickSummary p{ padding-right: 40px; padding-left: 10px; } #footer { text-align: center; line-height: 1.5em; padding-top: 10px; padding-bottom: 40px; font-size: 0.9em; } #footer a:link { color: rgb(133, 126, 112); } #footer a:visited { color: rgb(133, 126, 112); } #footer a:hover { color: rgb(133, 126, 112); } #footer a:active { color: rgb(133, 126, 112); }

    • ベストアンサー
    • CSS
  • CSS IDごとのCLASS指定

    以下のようなCSSがあった場合に、それぞれのIDに同じ名前で中身の違うCLASSを指定する事は出来るのでしょうか? #main{ margin:0; padding:0; background: transparent; float : left; font-size : 0.8em; } #menu{ margin:0; padding:0; width:140px; float : left; font-size : 0.8em; background :url('img/back.gif') no-repeat left top; color:#17F600; } #mainにはこれ、 .txt { font-size : 1em; line-height : 120%; margin:0 0 5px 380px; padding:0 0 0 30px; text-align : left; color:#69788A; } #menuにはこれ .txt{ font-size : 1em; padding:0 0 0 10px; margin:5px 30px 5px 0; text-align : left; color:#69788A; border-bottom:1px solid #CFDEEF; } といったかんじなのですが…

    • ベストアンサー
    • HTML
  • CSSが反映されない!ソース公開

    なぜかCSSが表示されずに困っています。 解決方法をご指導願います。 CSS↓(ファイル名screen.css) * { margin: 0; padding: 0; list-style: none; text-decoration: none; } body { margin: 25px 0 25px 0; font: normal 11px Trebuchet MS, Sans-serif; background: #000; color: #999; text-align: center; } #container { width: 320px; margin-left: auto; margin-right: auto; border: 1px solid #666; padding: 250px 25px 25px 25px; background: url("../images/top.jpg") no-repeat; text-align: left; } h1 { font: normal 20px Georgia, Sans-serif; margin-left: 45px; margin-bottom: 20px; } h1 span.highlight { color: #efefef; } h1 span.small { font-size: 11px; color: #333; } h2 { margin-top: 15px; margin-left: -25px; padding-left: 20px; border-left: 5px solid #666; font: bold 11px Trebuchet MS, Sans-serif; } INDEX.HTML↓(前半部分のみです) <!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="pl" lang="pl"> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="styles/screen.css" media="screen"> </head> <body> はじめてのHP作成です。凡ミス等ご指導よろしくお願いします。

    • ベストアンサー
    • HTML
  • お世話になっております。

    お世話になっております。 CSSでサイトを構築しようと考えております。 その際にコピーライト部分を〈address〉~〈/address〉タグで 囲み、その部分をページの最下部に表示したいのですが それが出来ずに悩んでおります。 よく『containerの全長(例えば500px)のheightを指定して、main(450px)とfooter(50px)でそれぞれにも 高さを指定すればよい』との解答を見かけますが、私が考えるのは もっと単純に『ページの最下部に表示』をしたいのです。 例えばテーブルタグを使えば【vertical-align: bottom】で 簡単に実践できますがこの表現方法はスマートとは言えません。 過去ログを検索したところ・・・ http://okwave.jp/qa/q2859912.html の質問サイトに私と全く同じ症状に悩み、解決した方への回答が あるのですが、解答と同様に私のサイトにタグを適用しても解決出来ず困っております。 【index.html】 (--ページヘッダは省略--) <title>タイトル</title> <link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css"> </style> </head> <body> <div id="container"> <div id ="header"> <h1>こんにちは</h1> </div> <ul> <li><a href="index.html">top</a></li> <li><a href="schedule.html">schedule</a></li> </ul> <div id="main"> <h2>Welcome!!</h2> </div> <address>Copyright&copy;</address> </div> </body> </html> 【style.css】 @charset "utf-8";body , html { height: 100%;} body {color: #444444;} div#container {border: solid 2px #aaaaaa; padding: 20px; width: 500px; height: 100%; background-color: #ffffff; margin-left: auto; margin-right: auto} div#header {background-color: #111111; padding: 5px 20px;} h1 {font-size: 1.25em; font-family: Verdana, Helvetica, sans-serif; color: #66aa66} h2 {font-size: 1em; padding-left: 20px; padding-bottom: 3px; maragin-bottom: 10px; border-bottom: solid 2px #999999; background-image: url(freeback65.gif); background-repeat: no-repeat} ul {list-style-type: none; margin-left:0; background-color: #888888; padding-left:0; padding:3px 20px} li {display: inline; padding-right: 10px; color: #ffffff} li a {text-decoration: none; color:#ffffff} li a:hover {background-color:#bbbbbb} p {font-size: 0.75em; padding-left:10px} address {font-size: 0.625em; font-weight: bold; font-style: normal; color: #2d444f; text-align: center; text-valign: bottom;} この状態でwebで見ますと、肝心のアドレス部分は#container内の <p>タグの直下に表示されます。私の希望としましてはcontainer内の 一番下に表示されるのが理想です。 ご教授よろしくお願いいたします。

    • ベストアンサー
    • HTML
  • css/上部に移動させたい。参考URLあり。

    お世話になります。 http://www.sonzai.net/tama/index.html 下の車と動いているgifネコを地平線部分あたりに 上げたいのですが、css・htmlをどのように改変したら良いでしょうか? 宜しくお願いします。 【gif猫】 #tama1 { font-size: 11px; color: #FFFFFF; font-weight: normal; text-align: center; padding-bottom: 110px; padding-left: 470px; letter-spacing: 1px; } 【小窓・秘密の応接間】 #window1 { font-size: 11px; color: #FFFFFF; font-weight: normal; padding-top: 53px; padding-left: 370px; letter-spacing: 1px; } 【小窓・リンク】 #window2 { font-size: 11px; color: #FFFFFF; font-weight: normal; padding-top: 6px; padding-left: 298px; letter-spacing: 1px; } 【車】 #kuruma { font-size: 11px; color: #FFFFFF; font-weight: normal; padding-left: 68px; letter-spacing: 1px; }

    • ベストアンサー
    • HTML
  • IE7とIE8での表示の違いを無くすにはどうしたら良いか、お分かりにな

    IE7とIE8での表示の違いを無くすにはどうしたら良いか、お分かりになる方がいらっしゃれば、お教えくださいませ。 以下の様に、HTMLとCSSを記述したのですが、IE7は思う様に表示しますが、 IE8ですと、ヘッダー部分がやや縦長になってしまいます。 この差を無くすためにはどのように記述したら良いでしょうか? どうぞ宜しくお願い致します。 ※CSSの記述 --------------------------- /* コンテナ */ div#container {width: 760px; margin-left: auto; margin-right: auto; background-color: #ffffff;} /* ヘッダー */ div#header {background-color: #017acd; background-image: url(top001.png); padding: 10px 10px 25px 0px; } div#header h1 {margin-top: 20px; margin-left: 30px; font-size: 17px; text-align: left; font-weight:normal; text-decoration:none; color: #ffffff; font-family: "cataneo BT",normal; word-spacing: 0.05em;} div#header h2 {margin-top: 30px; font-size: 48px; text-align: center; color: #ffffff; font-family: "cataneo BT",normal;} ※HTMLの記述 ----------------------- <!-- コンテナ --> <div id="container"> <!-- ヘッダー --> <div id="header"> <h1>Welcome to my pages!</h1> <h2>My HomePage</h2> </div> ~中略~ </div>

  • Firefoxでpaddingが反映されません。

    現在WEBサイトを作っているのですが、IEとFirefoxで確認を行ってみたところ、IEでは正しく表示されるのですがFirefoxだとうまく表示されません。 paddingの指定なんですが、Firefoxだけうまく寄ってくれません、何がいけないのでしょうか(T_T) CSS部分は以下のようになります。 .menu { color: #000000; padding : 5px 0px 0px 30px; font-size : 14px; text-align: left; font-weight: bold; text-transform: uppercase; letter-spacing: .3em; } 問題はpaddingの30pxというところで、左側から30px離したいのですが、全く変わりません。 分かる方いましたら、アドバイス宜しくお願いいたします。

    • ベストアンサー
    • 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=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="author" content="xxxxxxxx" /> <meta name="keywords" content="xxxxxxxx" /> <title>xxxxxxxx </title> <link ref="stylesheet" type="text/css" href="cut.css" /> <style type="text/css"> body {margin: 0px 5em; } #container { width:800px; margin-left:auto; margin-right:auto; border-top: 1px solid #999; border-left: 1px solid #999; border-right: 1px solid #999; border-bottom: 1px solid #999; border-color:#000000; } #header {background-color:#ffffff;}←ここの色を黒に変えたいのですが変わりません。                        どうすればいいのでしょうか?  h1 { margin-left:20px; color:#ffffff; font-size:1.25em; padding-top:30px;}   ul {list-style-type:none; margin-left:100px; padding-left:0px;} li {display:inline; padding-right:20px; font-size:1.0em;} li a {text-decoration:none; line-height:2.2 } a { color:#000000} a:hover {color:#990000; } address a:hover {color:#990000;} p { font-size:1.25em; margin-left:50px; color:#ffffff;} .isu {text-align:right; margin-right:2px; } .moji {font-size:2em; line-height:200%; } .name { color:#ffff99; text-align:right; margin-right:50px; margin-bottom:50px; text-align:bottom;} .champ {text-indent:1em; font-size:2em;} .midasi { color:#ffff99; text-align:bottom; margin-left:100px; } .coment { color:#000000; text-align:left; margin-left:150px; line-height:2em; width:600px;} .http {font-size:0.9em; color:#000000; text-align:right; margin-right:0px; line-height:2em; padding-right:30px;} .denwa {color:#000000; text-align:right; line-height:2em; padding-right:30px;} hr {background-color:#000000; height:2px; width:250px; align-right;} .addless {text-align:right; color:#000000; padding-right:30px;} </style> </herd> <body> <div id="container"> <div id="header">←ここから <h1>xxxxxxxx </h1> <p class="isu"><img src="isuA.jpg" alt="xxxxxxxx" align="right" width="400px" height="250px" /> <br /> <p class="moji" >xxxxxxxx</p> <p class="champ">xxxxxxxx</p> <p class="midasi">xxxxxxxx</p> <p class="name">xxxxxxxx</p> <br /clear="all"></p> <br /> </div>←ここまでの背景色を黒に変えたいのですが変わりません。                        どうすればいいのでしょうか?  <br /> <br /> <p class="http">xxxxxxxx</p> <p class="addless">xxxxxxxx</p> <hr width="250" size="10" align="right"> <p class="denwa"> (黒電話) xxxxxxxx</p> <ul> <li><a href="top.html">トップページ</a></li> <li><a href="profile.html">プロフィール</a></li> <li><a href="staff.html">スタッフ</a></li> <li><a href="ryoukin.html">メニュー・マップ</a></li> <li><a href="mail.html">お客様メール</a></li> </ul> <br /> <br /> <p class="coment">xxxxxxxxxxxxxxxxxxxxxxxx</p>  <br /> <br /> <br /> <address>Copyright(C)<a href="mailto:saitou@gmail.com">Hair Salon Saitou</address> </div> </body> </html>

専門家に質問してみよう