Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Css粘性页脚导致图像不适合div_Html_Css - Fatal编程技术网

Html Css粘性页脚导致图像不适合div

Html Css粘性页脚导致图像不适合div,html,css,Html,Css,div动物和animalmugshots应该在包装物和内容物中,但由于某些原因,动物会溢出白色内容物的身体部位。我不明白为什么?希望有人能帮我 当children元素浮动时,元素animals正在崩溃 浮动和绝对定位的元素从文档流中取出,因此导致父元素以未定义的维度折叠 向父元素添加定义的高度或overflow:hidden将解决此塌陷问题 -为便于查看,将页脚设置为黑色 <!DOCTYPE html> <html> <head> <title&

div动物和animalmugshots应该在包装物和内容物中,但由于某些原因,动物会溢出白色内容物的身体部位。我不明白为什么?希望有人能帮我

当children元素浮动时,元素animals正在崩溃

浮动和绝对定位的元素从文档流中取出,因此导致父元素以未定义的维度折叠

向父元素添加定义的高度或overflow:hidden将解决此塌陷问题

-为便于查看,将页脚设置为黑色

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">     
        body{
            background-color: #f2f2f2;
        }

        #content{
            background-color: white;
            border: 1px solid gray;
            width: 60%;
            height: auto;
            display: block;
            position: relative;
            left: 50%;
            margin-left: -30%;
            padding: 10px;
            z-index: 100;
            margin-top: 20px;
        }
        html, body {
            height: auto;
        }

        #wrap {
            min-height: 100%;
        }

        #main {
            overflow:auto;
            padding-bottom: 150px;
        }  /* must be same height as the footer */

        #footer {
            position: relative;
            margin-top: -150px; /* negative value of footer height */
            height: 150px;
            clear:both;
        } 
        .instructions{
            margin-top: 50px;
            font-family: serif;
            font-size: medium;
            width: 50%;
            left: 50%;
            margin-left: -25%;
            position: relative;
            margin-bottom: 60px;
        }
        .repbanner{
            background-color: red;
            width: 108%;
            height: auto;
            left: 50%;
            margin-left: -54.5%;                
            margin-top: 40px;
            position: relative;
            z-index: 200;
            border: 1px #a70000 solid;
            text-align: center;
            color: white;
            font-size: smaller;
            text-transform: uppercase;
            padding-top: 3px;
            padding-bottom: 3px;
        }

        .dembanner{
            background-color: blue;
            width: 108%;
            height: auto;
            left: 50%;
            margin-left: -54.5%;
            margin-top: 40px;
            position: relative;
            z-index: 200;
            border: 1px navy solid;
            text-align: center;
            color: white;
            font-size: smaller;
            text-transform: uppercase;
            padding-top: 3px;
            padding-bottom: 3px;

        }
        .introbanner{
            background-color: white;
            width: 108%;
            height: auto;
            left: 50%;
            margin-left: -54.5%;
            margin-top: 40px;
            position: relative;
            z-index: 199;
            border: 1px gray solid;
            text-align: center;
            color: black;
            font-size: smaller;
            text-transform: uppercase;
            margin-bottom: 10px;

        }

        /*Opera Fix*/
        body:before {
            content:"";
            height:100%;
            float:left;
            width:0;
            margin-top:-32767px;/
        }
        #animals{
            width: 100%;
            margin-left: 5px;
            margin-right: 5px;
            margin-bottom: 5px;
            text-align: center;
            position: relative;
            display: block;
            height: auto;
        }
        .animalmugshot{
            width: 150px;
            height: 150px;
            float: left;
            position: relative;
        }
        img{
            position: relative
        }
    </style>
    <!--[if !IE 7]>
        <style type="text/css">
        #wrap {display:table;height:100%}
        </style>
    <![endif]-->

    </head>
<body>
<div id="wrap">
    <div id="main">
        <div id="content">
        <div class="repbanner">
            INTRODUCTION
        </div>
        <div class="instructions">
        Hello and thanks for using the Chrome extension Political Animals. Below are the instructions on how the piece works. Enjoy!
        <br/>
        <br/>
        </div>
        <div class="dembanner">
            Instructions
        </div>
            <div class="instructions">
                Here's how the project works!

                1. Surf the Web. Try any website you would like.
                2. You should be redirected to a news site. Do not be alarmed!
                3. Enjoy!
            </div>  
            <div class="introbanner">
            Meet the Cast
            </div>

            <div id="animals">
                <div class="animalmugshot">
                <img src="animalshots/thumbnails/PoliticalAnimal.png" alt="Charlie the CEO"/><br/><p>Charlie the CEO</p>
                </div>
                <div class="animalmugshot">
                <img src="animalshots/thumbnails/PoliticalFox.png" alt="Freddy the Financial Agent"/>
                <br/>
                <p> Freddy the Financial Agent</p>
                </div>
                <div class="animalmugshot">
                <img src="animalshots/thumbnails/PoliticalGiraffe.png" alt="Geoffry the Graphic Designer"/>
                <br/>
                <p>Geoffry the 
                <br/>Graphic Designer</p>
                </div>
            </div>      
        </div>
    </div>
</div>
<div id="footer">

</div>
</body>

需要清除动物或所有潜水中的漂浮物

#animals {
    width: 100%;
    margin-left: 5px;
    margin-right: 5px;
    margin-bottom: 5px;
    text-align: center;
    position: relative;
    display: block;
    height: auto;
    overflow: hidden;       /* Added this.. */
}

因为您的图片采用浮动样式,所以在没有clearfix的自动高度中不会考虑它们的高度。
div:after //OR
#animals:after {
    display: table;
    content: '';
    clear: both;  
}