css - css中的 body 背景图像位置问题

标签 css background background-image background-position

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
    margin: 0px; padding:0;
    background:url(http://custdemos.com/synverse_portfolio/images/safercab_mobi.png) no-repeat left bottom;
    height:100%
}
</style>
</head>

<body>
<div class="do">
X Content 
</div>
</body>

</html>

我需要把那个背景图片放在正文底部,如果有人知道这个问题请告诉我。

最佳答案

你需要给 body 一个最小高度。这是更正后的 jsFiddle link .下面也是修改的css

body {
    margin: 0px;
    padding:0;
    background:url(http://custdemos.com/synverse_portfolio/images/safercab_mobi.png) no-repeat left bottom;
    min-height:500px;
}

关于css - css中的 body 背景图像位置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16935300/

相关文章:

css - 是否有命令行工具或库可以在 indesign 模板和 CSS/Html 之间进行转换?

objective-c - 注销时的 MBProgressHUD

css - 背景没有填满窗口的高度

CSS - 将 Div 宽度设置为 100% 并调整大小以保持纵横比

javascript - 将网页和外链资源保存为独立的静态资源

css - Angular Material 垫选择下拉宽度

html - 全屏视频背景,内容低于首屏

jquery - 相对于页面滚动背景

html - 使用 DIV 作为另一个元素的背景

javascript - 将两个 CSS 类的属性与过滤器属性结合起来