0

次の HTML コードがあります。コンテンツと呼ばれる div 内に多くのテキストがある場合、フッター div は下に移動せず、テキストはフッター div を超えます。

問題を確認するには、このリンクhttp://jsfiddle.net/LhzrQ/を確認してください。

問題の解決方法を教えてください。

    <div id="container" style="width:500px">

        <div id="header" style="background-color:#FFA500;">
            <h1 style="margin-bottom:0;">Main Title of Web Page</h1>
        </div>

        <div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;">
            <b>Menu</b><br>
            HTML<br>
            CSS<br>
            JavaScript
        </div>

        <div id="content" style="background-color:#EEEEEE;width:400px;float:left;">
            HyperText Markup Language (HTML) is the main markup language for displaying web pages and other information that can be displayed in a web browser.
            HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like <html>), within the web page content. HTML tags most commonly come in pairs like <h1> and </h1>, although some tags, known as empty elements, are unpaired, for example <img>. The first tag in a pair is the start tag, the second tag is the end tag (they are also called opening tags and closing tags). In between these tags web designers can add text, tags, comments and other types of text-based content. The purpose of a web browser is to read HTML documents and compose them into visible or audible web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.

        </div>

        <div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
            Copyright © W3Schools.com
        </div>

    </div>

</body>

</p>

4

2 に答える 2

3

コンテンツ div の高さ要素を削除できます。

参照: http://jsfiddle.net/LhzrQ/1/

于 2012-09-30T13:46:28.367 に答える
1

働くフィドル

fixed heightcontentdivに削除します。それが動作します 。

于 2012-09-30T13:47:00.450 に答える