html - 出现但未出现在 div 中的图像

标签 html css image

我的图片出现了,但似乎没有占用 div 中的任何空间。

这是我的 html:

<div id="header">

    <img id="img_1" src="img/DSC_0195.JPG" alt="Habor 1">
    <img class="img_2-5" src="img/DSC_0197.JPG" alt="Habor 2">
    <img class="img_2-5" src="img/DSC_0904.JPG" alt="Habor 3">
    <img class="img_2-5" src="img/DSC_0901.JPG" alt="Habor 4">
    <img class="img_2-5" src="img/DSC_0903.JPG" alt="Habor 5">
    <img id="img_6" src="img/DSC_0902.JPG" alt="Habor 6">               
</div>

和我的CSS:

#header {
    margin:0 auto;
    width: 100%;
}

.img_2-5, #img_1, #img_6{
    width:16.666%;
    display: inline;
    float:left;
}

#img_1 {
    border-radius: 25px 0 0 25px;   
}

#img_6{
    border-radius: 0 25px 25px 0;       
}

最佳答案

这是因为您的图像是 float 的。您需要在父级上添加一个 overflow:hidden; 属性,使它们出现在 div 上。

关于html - 出现但未出现在 div 中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37058682/

相关文章:

php - 一起使用 onclick 和 onsubmit

javascript - 如何在javascript中更改下拉框值时获取文本框值

c# - 单击链接时打开带有 URL 的选项卡

html - 当使用另一个按钮设置内联 block 时,Bootstrap 输入字段会缩小

html - 奇怪的 Html Css 错误

javascript - 多背景图像滚动

html - 在绝对 div 内居中 div

css - Google Chrome 中的单选按钮和复选框不稳定行为

android - 将图像分享到 Instagram 故事

css - chrome (CSS) 的图像格式问题