我对html和css有点生锈,我无法让2张图片浮动,一个在另一个上方。继承人的代码...

    <div class="kbody">
        <img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
    <div id="ktxt">
        <p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
        Kristallnacht occurred on November 9-10, 1938. Also known as the night of
        broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
        Germany and Austria that burned synagogues, broke store windows, stole from the
        stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
        later Germany made an &quotatonement fine&quot that added up to over one billion dollars
        and placed it on the remaining Jews. </p>
    </div>
    <img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
    </div>


和CSS ...

.kbody {
width:800px;
margin-left: auto;
margin-right: auto;
/*border-style:solid;
border-width:3px;*/
}

.kimg1 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
}

.kimg2 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
margin-top:10px;
}

#ktxt {
padding-left:10px;
padding-right:10px;
padding-top:10px;
/*border-width:2px;
border-style: solid;*/
width:350px;
height:330px;
margin-left:402px;
font-style:arial, sans-serif;
color: #336699;
font-size:14pt;
}


我究竟做错了什么??
这段代码看起来像这样
http://imgur.com/a/ivDE2#0

最佳答案

要将第二个图像移到第一个图像下:

.kimg2 {
    clear: both;
}

09-30 14:29
查看更多