Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.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 将一个div置于另一个div之上,并使一个div保持在底部_Html - Fatal编程技术网

Html 将一个div置于另一个div之上,并使一个div保持在底部

Html 将一个div置于另一个div之上,并使一个div保持在底部,html,Html,我想在图片的底部有一个关于div的故事(mainMedia),但我也想在照片的顶部有一个关于div的故事 当我尝试这样做的时候,故事版会登上榜首,因为主流媒体的跳水是位置:绝对的,但我必须保持它,以保持关于跳水在榜首。。。有什么想法吗 你能帮忙吗 非常感谢 HTML 以下是我对您努力实现的目标的看法: 我为你写了一封信 您需要做的是将story div粘贴到mainMedia div中。您还可以在css引用“.story”时使用“.story” HTML: 我希望这有帮助 <html>

我想在图片的底部有一个关于div的故事(mainMedia),但我也想在照片的顶部有一个关于div的故事

当我尝试这样做的时候,故事版会登上榜首,因为主流媒体的跳水是位置:绝对的,但我必须保持它,以保持关于跳水在榜首。。。有什么想法吗

你能帮忙吗

非常感谢

HTML


以下是我对您努力实现的目标的看法:

我为你写了一封信

您需要做的是将story div粘贴到mainMedia div中。您还可以在css引用“.story”时使用“.story”

HTML:

我希望这有帮助

<html>
<head>
    <title> Beta</title>
    <!-- css links -->
    <link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
    <div class="gigantic">
        <div class="main">
            <div class="twitterProfilePicture">
                <img src="https://si0.twimg.com/profile_images/2015016150/petecashmoreavatar_normal.png">
            </div>
            <div class="push">
                <div class="mainMedia">
                    <img src="http://blog.sunsafaris.com/wp-content/uploads/2013/02/dune-king-lion.jpg">
                    <div class="about">
                        <p><span>Mashable</span></br>3 Hours ago</p>
                    </div>
                </div>
            </div>  
            <div class="Story">
                <div class="heading">

                </div>
                <div class="text">

                </div>
            </div>
        </div>
    </div>
</body>
</html>
body
{
    margin: 0;
    background-color: rgb(233,234,237);
    font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
}

p
{
    margin: 0;
}

.gigantic
{
    width: 800px;
    height: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-top: 20px;
    margin-top: 40px;
    /*background-color: #fff;*/
}

.main
{
    width: 700px;
    height: 400px;
    /*background-color: #000;*/
    margin-right: auto;
    margin-left: auto;
    padding: 30px;
}

.twitterProfilePicture
{
    width: 55px;
    height: 55px;
    border-radius: 3px;
    /*background-color: #fff;*/
    position: relative;
    float: left;
}

.twitterProfilePicture img
{
    width: 55px;
    height: 55px;
    border-radius: 3px;
    /*background-color: #fff;*/
    position: relative;
    float: left;
}

.mainMedia
{
    width: 630px;
    height: auto;
    /*background-color: #fff;*/
    float: right;
    border-radius: 4px;
    position: relative;
    margin-bottom: 10px;
}

.mainMedia img
{
    width: 630px;
    height: auto;
    position: relative;
    border-top-left-radius: 3px;    
    border-top-right-radius: 3px;   
}

.about
{
    position: absolute;
    /*background-color: #000;*/
    overflow: hidden;
    height: 35px;
    position: absolute;
    top: 7px;
    left: 7px;
    font-size: 12px;
    color: rgb(94,118,171);
}

.about span
{
    color: #385874;
    font-size: 16px;
}

.story
{
    width: 630px;
    height: 300px;
    background-color: #fff;
    position: absolute;
    margin-left: 70px;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    position: static;
    bottom: 0;
}
    <div class="gigantic">
        <div class="main">
            <div class="twitterProfilePicture">
                <img src="https://si0.twimg.com/profile_images/2015016150/petecashmoreavatar_normal.png">
            </div>

    <div class="push">
                <div class="mainMedia">
                        <img src="http://blog.sunsafaris.com/wp-content/uploads/2013/02/dune-king-lion.jpg"/>
                    <div class="about">
                            <p><span>Mashable</span></br>3 Hours ago</p>
                    </div>

            <div class="Story">
                        <div class="heading">Heading</div>
                        <div class="text">Text Story here</div>
                    </div>

        </div>
            </div>  

         </div>
    </div>
body
{
    margin: 0;
    background-color: rgb(233,234,237);
    font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
}

p
{
    margin: 0;
}

.gigantic
{
    width: 800px;
    height: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-top: 20px;
    margin-top: 40px;
    /*background-color: #fff;*/
}

.main
{
    width: 700px;
    height: 400px;
    /*background-color: #000;*/
    margin-right: auto;
    margin-left: auto;
    padding: 30px;
}

.twitterProfilePicture
{
    width: 55px;
    height: 55px;
    border-radius: 3px;
    /*background-color: #fff;*/
    position: relative;
    float: left;
}

.twitterProfilePicture img
{
    width: 55px;
    height: 55px;
    border-radius: 3px;
    /*background-color: #fff;*/
    position: relative;
    float: left;
}

.mainMedia
{
    width: 630px;
    height: auto;
    /*background-color: #fff;*/
    float: right;
    border-radius: 4px;
    position: relative;
    margin-bottom: 10px;
}

.mainMedia img
{
    width: 630px;
    height: auto;
    position: relative;
    border-top-left-radius: 3px;    
    border-top-right-radius: 3px;   
}

.about
{
    position: absolute;
    /*background-color: #000;*/
    overflow: hidden;
    height: 35px;
    position: absolute;
    top: 7px;
    left: 7px;
    font-size: 12px;
    color: rgb(94,118,171);
}

.about span
{
    color: #385874;
    font-size: 16px;
}

.Story
{
    background-color: black;
    opacity:0.5;
    position: absolute;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    position: absolute;
    bottom: 3px;
    color:white;
    width:630px; /*I made this the same as your mainMedia*/
}