简体   繁体   English

图像未填满到行尾

[英]images not filling up to end of row

I am currently making a website for an architecture firm, HLArchitects. 我目前正在为一家建筑公司HLArchitects建立一个网站。
In the projects page I have created an HTML / Javascript image gallery. 在项目页面中,我创建了一个HTML / Javascript图片库。
It can be viewed here for reference: http://www.hla.co.za/projects/Hyuandai_Training_Centre/ 可以在此处查看以供参考: http : //www.hla.co.za/projects/Hyuandai_Training_Centre/

My problem is that the smaller thumbnail images underneath the large image leaves a big gap on the right in the first row. 我的问题是大图像下方的较小缩略图在第一行的右侧留下了很大的空白。 My final goal is to have one row, which scrolls with javascript, and cut away the other 2 rows. 我的最终目标是拥有一行,并使用javascript进行滚动,而切掉其他两行。 Here is the css for that div: 这是该div的CSS:

#imageFlow {
        width: 750px;
        height: 50px;
        position: relative;
        padding: 3px;
        float: right;
    }

When I go overflow: hidden it cuts away the other rows but still leaves the big gap at the end of the top row, How would I do it so that the images fill right to the end of the 750px even if the last image gets cut half way? 当我overflow: hidden它会切掉其他行,但在第一行的末尾仍然留有很大的空隙,我该怎么做,以便即使最后一个图像被剪切,图像也将填充到750px的末尾半路?
Thank you in advance 先感谢您

Like this: 像这样:

#imageFlow {
        width: 750px;
        height: 50px;
        position: relative;
        padding: 3px;
        float: right;
        overflow:hidden;
        white-space:nowrap;
    }

You should update this three block property, 您应该更新这三个块的属性,

#imageFlow {
    width: 750px;
    height: 50px;
    position: relative;
    padding: 3px;
    float: right;
    display: inline-block;
    overflow: hidden;
}

#imageFlow img:first-child {
    margin-right: 8px;
}

#imageFlow img {
    margin: 6px 3px 6px 0.8px;
}

Hope this would be help you! 希望这会对您有所帮助!

Here's a way to keep your image in only one row. 这是一种将图像仅保留在一行中的方法。

<div class="wrapper">
    <div class="inline-wrap">
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
        <img src="http://www.hla.co.za/projects/Hyuandai_Training_Centre/images/DSC_0380.jpg" height="50"/>
    </div>
</div>

<style type="text/css">
.wrapper {
    width:600px;
    overflow-x:scroll;
    overflow-y:hidden;
}

.inline-wrap {
    width:800px;
}
</style>

JSFiddle JSFiddle

After you need to play with your CSS to adjust the ideal margin between image to make them arrived at the exact needed position. 在需要使用CSS来调整图像之间的理想边距以使其到达所需的确切位置之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM