html - 图片总是在页面底部,无论多长时间

标签 html css

我有一个固定宽度为 1000 像素和 margin:auto 的主中心列。

在固定列之外,如果用户的屏幕宽度大于 1000px,我希望在每个页面的最左下角和右下角有一个背景图像,无论内容显示多长时间页面或用户屏幕的宽度。

换句话说,如果屏幕上的内容太长以至于您需要滚动,那么最初您不会看到图像,因为它们位于页面底部。

同样,如果您调整浏览器窗口的大小,左右图像将移向主中心列。

我怎样才能做到这一点?

编辑

    <style>
    html{height:100%;}
    body {

        margin: 0;
        font-family: 'DINMedium';
        font-size:16px;
        color: #ffffff;
        background: #e0dcd3 url(../images/mainbg.png) repeat-x;
        min-height:100%;
        }
    #leftBottomImg{position:absolute; bottom:0px;left:0px; background:url(../images/leftBottomImg.png);height:330px;width:300px;}
    #rightBottomImg{position:absolute; bottom:0px;right:0px; background:url(../images/rightBottomImg.png);height:330px;width:300px;}
    #slFooter{width:960px; margin:auto;height:400px;background: #e0dcd3 ;padding:20px;}
</style>

<body id="indexHomeBody">

    <div id="mainWrapper">


    <div id="headerWrapper">
        <div class="left">
            <div id="logo"><a href=""><img src="includes/templates/ceon/images/logo.png" alt="" width="273" height="58" /></a></div>
        </div>
        <div style="clear:both;"></div>
    </div>


    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="contentMainWrapper">
      <tr>
        <td valign="top">


        <div id="slideshow">
            <div id="nav"></div>
            <a href="#"><img src="includes/templates/ceon/images/banner1.jpg" width="1000" height="369" /></a>
            <a href="#"><img src="includes/templates/ceon/images/banner2.jpg" width="1000" height="369" /></a>
            <a href="#"><img src="includes/templates/ceon/images/banner3.jpg" width="1000" height="369" /></a>
            <a href="#"><img src="includes/templates/ceon/images/banner4.jpg" width="1000" height="369" /></a>
        </div>



        <div id="homeMidNav">
        </div>

        <div style="clear:both"></div>

        <div id="homeBestSellers">
        </div>

    </td>

      </tr>
    </table>

    <div id="leftBottomImg"></div>
    <div id="rightBottomImg"></div>

    <div id="slFooter"></div>
    </div>

</body>

最佳答案

sample

.center {
    margin: auto;
    width: 50%; height: 100%;
    text-align: center;
    border: 1px solid silver;

}
.main {
    width:100%; height: 600px;
     background: url('http://www.mojowallpapers.com/wp-content/uploads/2013/11/Cat-Wallpaper-1.jpg') no-repeat right bottom,
    url(http://www.mojowallpapers.com/wp-content/uploads/2013/11/Cat-Wallpaper-3.jpg) no-repeat left bottom;
    background-size: 20%;
}

@media screen and (max-width: 1000px) {
    .main {      
      background-size: 25%;
}


}

关于html - 图片总是在页面底部,无论多长时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23645280/

相关文章:

javascript - 如果 div 包含一个带有基于参数的类的跨度

html - 在不滚动页面的情况下隐藏 iPhone 设备中 Safari 的默认元素,如标题栏和状态栏

css - 等待 testcafe 中的 css 属性值

css - 具有固定边距内容容器的流体模板

html - 如何根据父div设置子div的高度

python - 如何创建存储在我的 Amazon S3 存储桶中的文件列表并将它们显示为下载链接?

jquery - Bootstrap Navbar Hamburger 菜单无法打开,下方有容器

html - 不允许加载本地资源 meteor 应用程序

HTML 3 列标题

android - 所有设备的 Bootstrap 列布局