BOOK Studio947
狩野祐東・狩野さやか著書

2コラムレイアウトができません(P187)

書籍Q&ACategory: スラスラわかるHTML&CSSのきほん2コラムレイアウトができません(P187)
はじめて asked 4年 ago

menuページで、左側menu allと、右側拡大写真を横並びにできず、拡大写真がmenu allの下に表示されています。
ちなみに、下記ページ上でHTML&CSS validation checkしたところ、エラーはなしという表示でした。
W3C Validaion Services
https://jigsaw.w3.org/css-validator/
不具合の原因につきまして、アドバイス頂けますでしょうか?
よろしくお願いいたします。
——————-CSS——————————————–
@charset “UTF-8”;
/* すべてのWebページに適用される */
body {
margin: 0 0 0 0;
padding: 0 0 0 0;
background-color: #f5f3eb;
}
.wrapper {
margin: 0 auto 0 auto;
width:900px;
}
h2 {
color: #442220;
font-size: 18px;
border-bottom-width: 2px;
border-bottom-style: dotted;
border-bottom-color: #442220;
margin-top: 20px;
margin-right: 0px;
margin-bottom: 20px;
margin-left: 0px;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
}
p {
line-height: 160%;
}
a:link {
color: #6aa4d6;
}
a:visited {
color: #6aa4d6;
}
a:hover {
color: #4f7697;
}
a:active {
color: #aed3f2;
}
h1 {
margin: 30px 0 30px 0;
padding:0 0 0 0;
line-height: 0;
text-align: center;
}
imge {
border-style: none;
}
/* すべてのページに適用 – navまわり – */
#nav li {
display: inline;
list-style-type: none;
padding-right: 30px;
}
#nav {
margin: 0 0 0 0;
padding: 15px 30px 10px 30px;
background-image: url(../images/menu-bg.png);
}
#nav li a:link {
color: #f5f3eb;
text-decoration: none;
}
#nav li a:visited {
color: #f5f3eb;
text-decoration: none;
}
#nav li a:hover {
color: #e4dbb9;
text-decoration: none;
}
#nav li a:active {
color: #ffffff;
text-decoration: none;
}
/* すべてのページに適用 – footer – */
#footer {
background-image: url(../images/footer-bg.png);
background-repeat: repeat-x;
margin-top: 30px;
padding: 20px 0 20px 0;
font-size: smaller;
color: #442220;
}
/* 個別のスタイル */
/* index.html */
.keyvisual {
margin: 20px 0 0 0;
}
.news_item {
margin: 0 0 0 0;
}
/* about.html */
.float img {
float: left;
padding-right: 1em;
}
.clear {
clear: both;
}
table.info {
border-collapse: collapse;
border: 1px solid #b78c5f;
}
table.info th, table.info td{
padding: 8px 8px 8px 8px;
border: 1px solid #d6c2b5;
text-align: left;
vertical-align: middle;
}
table.info th {
background-color: #c99e73;
color: #442220;
}
/* menu.html */
.menu_block {
overflow: hidden;
zoom: 1;
}
.menu_left {
float: left;
width: 280px;
margin-right: 20px;
}
.menu_right {
float: left;
width: 600px;
}
table.menu_all {
border: none;
border-collapse: collapse;
}
table.menu_all td {
padding: 0;
}
table.menu_all td.photo {
padding: 0 10px 10px 0;
}
.menu_right h3 {
margin: 20px 0;
text-align: right;
font-size: 16px;
color: #442220;
}
.menu_right p {
text-align: right;
font-size: 12px;
}
/* access.html */
div.map {
text-align: center;
}
/* contact.html */
form div {
padding: 12px;
border-bottom: 1px dashed #d6c2b5;
}
select {
width: 30em;
}
label {
color: #442220;
}
input[name=subject] {
width: 30em;
}
textarea {
width: 30em;
height: 6em;
}
input[type=submit] {
margin: 20px 12px;
width: 30em;
}
———HTML———————-
<!doctype html>
<html>
<head>
<meta charset=”UTF-8″>
<meta name=”description” content=”KUJIRA cafeへようこそ。九寺楽町にオープンした新しいカフェです。”>
<meta name=”keywords” content=”カフェ,cafe,九寺楽”>
<title>KUJIRA cafeへようこそ</title>
<link rel=”stylesheet” type=”text/css” href=”css/style.css”>
</head>
<body>
<div class=”wrapper”>
<!– ヘッダー –>
<h1 id=”logo”><a href=”index.html”><img src=”images/logo.png” width=”217″ height=”89″ alt=”KUJIRA cafe”></a></h1>
<ul id=”nav”>
<li><a href=”index.html”>ホーム</a></li>
<li><a href=”about.html”>店舗案内</a></li>
<li><a href=”access.html”>アクセス</a></li>
<li><a href=”menu.html”>メニュー</a></li>
<li><a href=”contact.html”>お問い合わせ</a></li>
</ul>
<!– ヘッダーここまで –>
<!– メイン –>
<div class=”keyvisual”>
<img src=”images/keyvisual.jpg” width=”900″ height=”362″alt=””>
</div>
<h2 id=”news”>News</h2>
<p class=”news_item”>5月30日、『<a href=”http://www.sbcr.jp&#8221; target=”_blank”>ここでしか飲めない!おいしいうれしい満喫カフェ</a>』に掲載されました。</p>
<p class=”news_item”>4月18日、KUJIRA cafeがオープンしました。ここ九寺楽の町で、皆さんが気軽に立ち寄れる、ゆったりと時間を過ごせる落ち着いた場所にしたいと思っています。</p>
<!– メインここまで –>
<!– フッター –>
<div id=”footer”>
<p>&copy;Copyright KUJIRA cafe. All rights reserved.</p>
</div>
<!– フッターここまで –>
</div>
</body>
</html>

狩野 祐東 Staff replied 4年 ago

ここにペーストしているHTMLは違うページ(index.html)のものではないですか? まず、menu.htmlの適切なタグに、適切なclass属性がついているかどうかを確認してみてください。