プロが教えるわが家の防犯対策術!

画像のような方法はありますでしょうか?
宜しくお願いします。

「CSS 2カラムの可変」の質問画像

A 回答 (2件)

普通にwidth:autoでよいです。

    • good
    • 0
この回答へのお礼

ORUKA1951 様

width:autoで出来ました。
今まで使った事が無かったので、思いつきませんでした(´-`;)

No.2もご丁寧にありがとうございました。

お礼日時:2014/02/28 09:02

簡単なサンプル


★タブは_に置換してあるので戻す。
★HTML5のときは<div class="header"></div>などはそれぞれ<header></header>になる。
★Another HTML Lint - Gateway( http://www.htmllint.net/html-lint/htmllint.html# )
 でチェック済みのHTML4.01strict+CSS2.1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
_<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
_<title>サンプル</title>
_<meta name="author" content="ORUKA1951">
_<meta http-equiv="Content-Style-Type" content="text/css">
_<link rev="made" href="mailto:oruka1951@hoge.com" title="send a mail" >
_<link rel="START" href="../index.html">
_<style type="text/css">
<!--
html,body{margin:0;padding:0;}
div.header,div.section,div.footer{
width:80%;min-width:630px;max-width:900px;
margin:0 auto;padding:5px;
}
div.section{position:relative;}
div.section div.nav{
position:absolute;
left:30px;/* ★位置 */
top:0;
width:298px;/* ★幅 */
border:solid green 1px;
}
div.section h2,
div.section p,
div.section div.section{
width:auto;/* ★width:auto;*/
min-width:0;margin:0 30px 0 360px;/* ★左右のマージン */
line-height:1.6em;background-color:white;
border:solid 1px green;
}
div.section div.section p{margin:0;}
div.section div.section{min-height:200px;}

/* 説明 */
div.section div.nav:before,
div.section div.nav:after,
div.section h2:after{
content:"←→\A 30px";
text-align:center;
display:block;
white-space:pre;
position:absolute;top:0;
font-size:12px;
font-weight:normal;
}
div.section h2:after{right:0;}
div.section div.nav:before{left:-30px;}
div.section div.nav:after{right:-30px;}
div.section div.nav ol:before{
content:"←───300px──→\A";white-space:pre;
}
div.section div.nav{background-color:white;}
body{background-color:gray;}
div.header{background-color:aqua;}
div.section{border:solid 1px green;padding:3px;}
div.footer{background-color:yellow;}

-->
_</style>
</head>
<body>
_<div class="header">
__<h1>タイトル</h1>
__<p>このページでは・・・・</p>
_</div>
_<div class="section">
__<h2>見出し</h2>
__<p>・・・</p>
__<div class="section">
___<h3>見出し</h3>
___<p>記事</p>
__</div>
__<div class="nav">
___<ol>
____<li>リスト</li>
____<li>リスト</li>
____<li>リスト</li>
___</ol>
__</div>
_</div>
_<div class="footer">
__<h2>文書情報</h2>
__<dl class="documentHistry">
___<dt id="FIRST-PUBLISHED">First Published</dt>
___<dd>2013-02-27</dd>
__</dl>
__<address>&copy; ORUKA1951 2012 - 2016 All Rights Reserved mailto:*****</address>
_</div>
</body>
</html>
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!