【问题标题】:How to align images on the bottom of the website如何对齐网站底部的图像
【发布时间】:2015-09-19 13:03:13
【问题描述】:

我想对齐图像,如网站底部的对齐图像链接中所示。我的意思是我想在页面底部放置许多电影 dvd 封面,以便直接访问任何电影变得容易。因此,如果有人将电影 Blast 悬停,它就会弹出。谁能帮我吗。

【问题讨论】:

  • 你需要详细说明你想要什么。你想看到它一直固定在底部吗?只有当你到达底部时?什么?

标签: html alignment


【解决方案1】:
img {
    position: absolute;
    bottom: 0;
}

还有一个小提琴:http://jsfiddle.net/dwtp7pje/

请注意,如果您将图像放在另一个 div 中,则需要为该 div 分配一个 position: relative; 才能使其工作。

编辑:如果您想在底部放置多张图片,请将这些图片放在 div 中,如下所示:

<div>
    <img src="http://orig12.deviantart.net/2b79/f/2008/314/e/8/my___dark_knight___dvd_cover_by_esbe77.jpg" alt="">
    <img src="http://orig12.deviantart.net/2b79/f/2008/314/e/8/my___dark_knight___dvd_cover_by_esbe77.jpg" alt="">
    <img src="http://orig12.deviantart.net/2b79/f/2008/314/e/8/my___dark_knight___dvd_cover_by_esbe77.jpg" alt="">
</div>

用css:

div {
    position: absolute;
    bottom: 0;
}

img {
    max-width: 33%;
}

还有小提琴:http://jsfiddle.net/dwtp7pje/1/

【讨论】:

  • 我想如图所示对齐。我不希望图像在页面底部对齐
【解决方案2】:

这是在css中

      .fix{
         position:fixed;
         bottom:0px;
           }

和你的 html

     <img src="yourimagepath" class="fix"/>

absolute:基于其最近的相对定位的父元素的绝对定位。

fixed:固定元素完全独立于网页。无论任何父母,一个固定位置的元素总是会固定在一个基于浏览器窗口的点

【讨论】:

    【解决方案3】:

    试试下面的代码。

    <img  src="http://i.imgur.com/KjuqA1l.png" style="position:fixed;bottom:0px;">
    

    更新:

    <img  src="http://i.imgur.com/KjuqA1l.png" style="position:fixed;bottom:0px;max-width:100%;">
    

    【讨论】:

    • 我想如图所示对齐。我不希望图像在页面底部对齐
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-05
    • 2016-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-21
    相关资源
    最近更新 更多