アプリ版:「スタンプのみでお礼する」機能のリリースについて

サイドバーだけ固定させ(非スクロール)、メインのコンテンツはスクロールさせるようなHPを作りたいです。参考になるURLを教えて下さい。

A 回答 (3件)

間違えた・・


HTML5用、HTML4.01用共に
#content_Table{position:fixed;top:200px;left:5px;width:30%;}
ですみです。
HTML4.01なら
body>div.section>*{margin-left:31%;}
5なら
body>section{padding-left:31%;}
で左を開けておく。色々な書き方がある。

ごく簡単な例です。
★Another HTML-lint gateway ( http://openlab.ring.gr.jp/k16/htmllint/htmllint. … )
★W3C CSS 検証サービス ( http://jigsaw.w3.org/css-validator/#validate_by_ … )
で検証済み、ウェブ標準の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">
<!--
#content_Table{position:fixed;top:200px;left:5px;width:30%;top:100px;}
body>div.section{padding-left:31%;width:69%;background-color:aqua;}
/* 質問と関係ない部分 */
html,body{margin:0;padding:0;}
p{margin:0 auto;text-indent:1em;}
div.section div.section{min-height:400px;}
div.header,div.section,div.footer{margin:0 auto;}
div.header h1,div.section h2,div.footer h2{margin:0 auto;}
#content_Table{background-color:yellow;}
div.header{height:100px;background-color:lime;}
-->
_</style>
</head>
<body>
_<div class="header">
__<h1 id="TOP">サンプル</h1>
_</div>
_<div class="section">
__<h2>本文</h2>
__<div class="section" id="section1">
___<h3>第一章</h3>
___<p>・・</p>
__</div>
__<div class="section" id="section2">
___<h3>第二章</h3>
___<p>・・</p>
__</div>
__<div class="section" id="section3">
___<h3>第三章</h3>
___<p>・・</p>
__</div>
__<div id="content_Table">
___<h3>目次</h3>
___<ol>
____<li><a href="#TOP">トップ</a></li>
____<li><a href="#section1">1章</a></li>
____<li><a href="#section2">2章</a></li>
____<li><a href="#section3">3章</a></li>
___</ol>
__</div>
_</div>
_<div class="footer">
__<h2>文書情報</h2>
_</div>
</body>
</html>
    • good
    • 0
この回答へのお礼

時間をかけ、回答してもらい心より感謝しています。
これ以上の回答はないと言う位、私にとってとても勉強になりました。
よろしければ、今後とも宜しくおねがいします。

お礼日時:2012/06/08 20:53

position:fixed;です。



サイドバーとか・・・今のウェブではあまり勧められない考え方です。今後HTML5が普及すると文書構造と言う考え方が大事になります。

 それで質問を読み替えると
「目次をウィンドウの左に表示し、長い本文をスクロールしても常にウィンドウの左側に表示し続けたい」
 となります。
HTMLは、HTML5の場合
<body>
 <header>
  ヘッダ
 </header>
 <section>
  <section id="section1">
   <h2>第一章</h2>
   <p>・・</p>
  </section>
  <section>
   <h2>第一章</h2>
   <p>・・</p>
   ・・・
  </section>
  <div id="content_Table">
   <ol>
    <li><a href="#section1">1章</a></li>
    <li><a href="#section2">2章</a></li>
    <li><a href="#section2">3章</a></li>
   </ol>
  </div>
 </section>
 <footer>
 </footer>
</body>

HTML4.01の場合
<body>
 <div class="header">
  ヘッダ
 </div>
 <div class="section">
  <div class="section" id="section1">
   <h2>第一章</h2>
   <p>・・</p>
  </div>
  <div class="section">
   <h2>第一章</h2>
   <p>・・</p>
   ・・・
  </div>
  <div id="content_Table">
   <ol>
    <li><a href="#section1">1章</a></li>
    <li><a href="#section2">2章</a></li>
    <li><a href="#section2">3章</a></li>
   </ol>
  </div>
 </div>
 <div class="footer">
 </div>
</body>

と書くことになります。

その上で、スタイルシートで
HTML5用
section div.contentTable{position:fixed;top:200px;left:5px;width:30%;}
HTML4.01用
div.section div.contentTable{position:fixed;top:200px;left:5px;width:30%;}
とすればよいだけです。

資料は
★css fixed ナビゲーション - Google 検索 ( https://www.google.co.jp/#hl=ja&safe=off&sclient … )
→CSS : positionの「absolute」「relative」「fixed」のリファレンス | CSS Lecture ( http://www.css-lecture.com/log/css/037.html )の最下段のdemoとか・・
    • good
    • 0

インラインフレームでは駄目ですか?


http://www.d3.dion.ne.jp/~tiyoko01/fure-mu/fure- …
    • good
    • 0
この回答へのお礼

回答ありがとうございます。
固定はするけど、スクロールするのでは・・・?

お礼日時:2012/06/08 20:46

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