0

上周我在遇到问题时发布了一个类似的问题,但不确定我是否可以重新提出同一个问题,所以我创建了一个新问题以防万一。

我有两列,一列向左浮动,一列向右浮动,我正在使用 clear:both 来清除浮动,但它不起作用。我已经检查以确保我所有的 DIV 标签都已关闭并且它们已关闭(这是上次的问题)并将 clear:both 移动到不同的部分,但它仍然决定不工作。代码如下,但如果您想查看它的外观,可以在此处查看http://www.richardawarner.co.uk/portfoliov2

任何帮助表示赞赏。

HTML

<div id="sectiontwowrapper">
        <div id="header">
            <h1>About Me</h1>
        </div><!--Header-->

        <div id="contentwrapper">
            <div id="aboutmeleft">
                <h3>About Me</h3>
                <br>
                <a>My name is <strong>Richard Warner</strong> and I am a young web designer from Birmingham, United Kingdom. I have recently graduated from Manchester Metropolitan University having studied BSc(Hons) Multimedia Computing. Whilst having an interest in studying different aspects to computers, it was here where I developed a passion for web design. I have learnt various languages such as HTML, CSS and PHP aswell as experienced using Adobe Photoshop, Adobe Dreamweaver and other Adobe products.</a>

                <p>
                    <h3>Skills and Expertise</h3>
                    <br>
                        <ul>
                            <li><a>HTML and CSS</a></li>
                            <li><a>PHP</a></li>
                            <li><a>MySQL</a></li>
                            <li><a>Wordpress</a></li>
                            <li><a>Adobe Photoshop</a></li>
                            <li><a>Adobe Dreamweaver</a></li>
                        </ul>

            </div><!-- About me left -->

            <div id="aboutmeright">
                <h3>Hobbies</h3>
                <br>
                <a>Hobbies will appear here</a>

                <p>
                    <h3>My CV</h3>
                    <br>
                        <a>You can download my CV by clicking here.</a>
            </div><!-- About Me right -->


        </div><!--Content Wrapper -->


    </div><!--Section Two Wrapper -->
    <div class="clear"></div>


    <div id="sectionthreewrapper">
        this line should be underneath this sections border line below
    </div> <!--Section three wrapper -->

CSS

#sectiontwowrapper {

position: relative;
top: 100px;
min-height: 550px;
min-width: 960px;
text-align: left;
border: solid 1px #000;

#contentwrapper {

width: 960px;
margin: 0 auto;
text-align: left;
}

#aboutmeleft {

width: 450px;
height: 400px;
/*border: 1px solid #000;*/
position: relative;
top: 40px;
float: left;


}

#aboutmeright {

width: 450px;
height: 220px;
/*border: 1px solid #000;*/
position: relative;
top: 40px;
float: right;
}

.clear {

display: block;
clear: both;

}

4

1 回答 1

5

您将sectiontwowrapperdiv 设置为position: relativewith top: 100px。这会将整个部分向下移动 100 像素 - 即使 clear 有效,sectiontwowrapper 也会向下 100px 进入下一部分。

于 2013-06-01T18:20:05.860 回答