2013-03-18 104 views
1

我现在挣扎了好几天,而且我找到了一个似乎没有用的解决方案。1000宽度以下的水平滚动

无论如何,我想要做的是当有人拖动窗口小于1000 px的宽度'锁定'屏幕。我的意思是,必须出现一个水平滚动条,并且背景图像必须停止调整大小,并且文本停止转移。背景必须在达到1000像素以下时才能水平滚动以及文字。

希望能有人能帮助我,想对现在看两天:■

<!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> 
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<title>Hup</title> 


<style type="text/css"> 
html{ 

    background: url(jup.png) no-repeat center center fixed; 
    min-width:500px; 
    max-height: 500px; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size:auto 580px; 
    background-position: center 120px; 
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='jup.png',  sizingMethod='scale'); 
    -ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='jup.png', sizingMethod='scale'); 
} 

#menu { 
    position:absolute; 
    margin-top:80px; 
    margin-left:20px; 
    position:absolute; 
right:20px; 
} 
.menu_container { 
    width:500px; 
    overflow:hidden; 
    position:absolute; 
    display:none; 
    height:100px; 
} 
#bottom { 
    position:absolute; 
    margin-top:720px; 
    position:absolute; 
    left:20px; 
    white-space: nowrap; 
} 
.bottom_container { 
    width:500px; 
    overflow:hidden; 
    position:absolute; 
    display:none; 
    height:100px; 

} 
body,td,th { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 12px; 
    color: #000000; 

} 
body { 
    min-width:1024px; 
    background-color: #000; 
    margin-left: 0px; 
    margin-top: 0px; 
    margin-right: 0px; 
    margin-bottom: 0px; 
} 
</style> 
</head> 

<body> 

<div id="menu"> 
<div class="container"> 
Text here 
</div> 

</div> 
<div id="bottom"> 
<div class="container"> 
Text here 
</div> 

</div> 

</body> 
</html> 
+1

你的HTML MIN-和最大宽度与已设置宽度冲突html标签。尝试删除这些设置。 – Jost 2013-03-18 20:16:29

+0

很难看到HTML标签的样式,因为您拥有它。我会将其更改为body {}并从下面添加Adam的解决方案。 – isherwood 2013-03-18 20:16:47

+0

如果我只保留html标签中的最小宽度,或者只保留在body标签中,背景仍然不会滑动,文字会,但背景不会... – 2013-03-18 20:43:51

回答

2

简单:

body { min-width: 1000px; } 
+0

我在我的身体中现在标记...即使我删除了html标记中的最小宽度,但背景仍然不会沿着..:s – 2013-03-18 20:44:37

+0

将您的背景图像放在您的身体上(在您的CSS中),而不是您的标记。请记住,您正在设置身体的最小宽度,而不是标记的最小宽度。 – Adam 2013-03-18 21:39:35