Html 如何将父元素推送到绝对定位div的高度

Html 如何将父元素推送到绝对定位div的高度,html,css,Html,Css,这是我的小提琴: JSFIDLE 您可以在JSFIDLE中找到源代码 CSS HTML 标题在这里 这里有一些信息 标题在这里 这里有一些信息 标题在这里 这里有一些信息 标题在这里 这里有一些信息 标题在这里 这里有一些信息 标题在这里 这里有一些信息 在css部分,我想删除height:350px声明,并让我的web浏览器选择图像的高度,但当我删除height时,一切都消失了。我知道这是因为我使用的是position:absolute,但我需要position:absolute和去掉高度

这是我的小提琴:

JSFIDLE 您可以在JSFIDLE中找到源代码

CSS HTML

标题在这里
这里有一些信息
标题在这里
这里有一些信息
标题在这里
这里有一些信息
标题在这里
这里有一些信息
标题在这里
这里有一些信息
标题在这里
这里有一些信息
在css部分,我想删除height:350px声明,并让我的web浏览器选择图像的高度,但当我删除height时,一切都消失了。我知道这是因为我使用的是position:absolute,但我需要position:absolute和去掉高度:350px。那么我如何才能做到这一点呢


注意:使用clearfix无法解决问题。

删除高度和溢出:隐藏可能是解决方案是的,但是div.article之后的元素仍然存在与放置相关的问题。例如,如果我在关闭div.article标记后放置一个div,这个新的div对用户来说是不可见的,因为它的位置在小提琴中所有元素的后面。多个div.article是否应该显示为堆栈?我可以问你为什么需要每个div.article都是position:absolute?这是因为我正在创建一个滑块,并且在该滑块中所有div.article都应该绝对定位。
.container {
    overflow:hidden; 
    position:relative;
    height: 350px;
}
.container .article {
    width:100%;
    position:absolute;
    background-color: red;
}
<div class="container">
    <div class="article">
            <img src="img/5.jpg">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
    <div class="article">
            <img src="https://wiki.documentfoundation.org/images/thumb/8/88/LibreOffice_MotifScatter_RGB.png/300px-LibreOffice_MotifScatter_RGB.png">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
    <div class="article">
            <img src="https://c.s-microsoft.com/en-us/CMSImages/microsoft-design-practice-delight.png?version=0c2ab83d-b515-9006-7c34-bf5021ffb656">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
    <div class="article">
            <img src="https://www.verdadesign.com/assets/styles/square_300/public/thumbnails/image/custom-web-design-icon.png?itok=MS2LOkw6">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
    <div class="article">
            <img src="http://www.suma-design.co.uk/images/graphic-design.jpg">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
    <div class="article">
            <img src="http://www.redoinfotech.com/images/web_designing.jpg">
            <span>title goes here</span>
            <span>some informations goes here</span>
    </div>
</div>