Tableとdivタグで、画像のようなレイアウトを作りたいのですが。
黒い線を二本入れた簡単なレイアウトなのですが、
どのブラウザーで見ても、(どの画面の大きさで見ても)
同じような形になるように、tableとdivでレイアウトするにはどうしたらよいでしょうか。
metaタグなど余計なものは書かなくてもかまいませんのでよろしくおねがいします。
(後パーセンテージもいくつでも構いません、適当に書きました)
tableで書いた場合と、divで書いた場合と教えてください。
縦横ともに長さ100%で表示したいです。
パーセンテージを使うとかける気がするのですが、忘れてしまいました。
ぜひよろしくお願いします。
A 回答 (2件)
- 最新から表示
- 回答順に表示
No.2
- 回答日時:
こんにちは
大まかですがこんな感じでしょうか。
Htmlタグ
<body>
<div id="top">
<div id="top-left">
<!--top-left--></div>
<div id="top-space">
<!--top-space--></div>
<div id="top-right">
<!--top-right--></div>
<!-- top --></div>
<div id="bottom">
<div id="bottom-left">
<!--bottom-left--></div>
<div id="bottom-space">
<!--bottom-space--></div>
<div id="bottom-right">
<!--bottom-right--></div>
<!--bottom--></div>
</body>
CSS
* {
margin: 0px;
padding: 0px;
}
body, html {
margin: 2% 0%;
padding: 0px;
width: 100%;
height: 96%;
background-color: black;
}
#wrapper{
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
#top {
margin: 0px;
padding: 0px;
height: 70%;
}
#top-left {
margin: 0px;
height: 90%;
width: 65%;
float: left;
background-color: white;
}
#top-space {
margin: 0px;
width: 5%;
height: 100%;
float: left;
}
#top-right {
margin: 0px;
height: 90%;
width: 30%;
float: left;
padding-bottom: 0px;
background-color: white;
}
#bottom {
margin: 0px;
padding: 0px;
height: 28%;
}
#bottom-left {
margin: 0px;
height: 100%;
width: 65%;
float: left;
background-color: white;
}
#bottom-space {
margin: 0px;
width: 5%;
height: 100%;
float: left;
}
#bottom-right {
margin: 0px;
height: 100%;
width: 30%;
float: left;
background-color: white;
}
%は適当ですのでお好みで。
No.1
- 回答日時:
黒い枠線がご提示のもののように太いものであれば、
テーブル自体は border:0 にしておいて、黒い枠線部分はテーブルのセルにしてしまい(幅・高さを設定)、その部分を背景色黒で表示すると言う方法ではいかがでしょうか?
幅・高さとも(黒の枠線部分を含んで)合計100%になるようにしておけばよろしいかと。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
htmlの文字が縦書きになる
-
widthやheightの数値に単位(px...
-
HTMLで文字が重なって表示されます
-
<li>の黒い点を消したい。
-
W3Cのソースコードの検証サービ...
-
CSS(0の単位)について
-
form input テキストを上下中央...
-
【HTML&CSS】フッター下部の余...
-
余分な縦スクロールバーが出て...
-
【CSS】ヘッダーの高さが不明の...
-
背景が下まで表示されないんです。
-
ページを拡大縮小でborderが消...
-
CSSで指定した背景画像にリンク...
-
指定したborderの一部が表示さ...
-
ホームページのCSSについて
-
表示倍率を変えるとレイアウト...
-
iPadのSafariでサイトが右側に...
-
CSSで「overflow:scroll」をしてい
-
CSSでテーブルのセルが、a:hove...
-
スクロールボックスを中央に配...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
htmlの文字が縦書きになる
-
widthやheightの数値に単位(px...
-
css初心者 フレックスボックス...
-
CSSがなぜかfont-sizeだけ効か...
-
【CSS】ヘッダーの高さが不明の...
-
画像イメージの上下左右、欲し...
-
CSS、width100%でもできる余白
-
スクロールボックスを中央に配...
-
<div>と<div>の間の10px程の...
-
CSSで背景画像を一番下にもって...
-
余分な縦スクロールバーが出て...
-
CSS:animation開始位置の設定
-
form input テキストを上下中央...
-
Media Queries 4 で 非推奨とな...
-
CSSでボックスのheightが0になる
-
W3Cのソースコードの検証サービ...
-
表示倍率を変えるとレイアウト...
-
定義リストに下線をつけたいと...
-
背景が下まで表示されないんです。
-
footer を横幅いっぱいに広げる...
おすすめ情報