Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 网站无法扩展以适应移动屏幕的问题_Html_Css - Fatal编程技术网

Html 网站无法扩展以适应移动屏幕的问题

Html 网站无法扩展以适应移动屏幕的问题,html,css,Html,Css,我使用的网站作为参考,构建了一个css网页,其中侧栏在页面上始终保持相同大小,而当屏幕显示时,整个左侧逐渐缩小 sidebar{width:400px;float:right;/*rest doesn't matter*/} leftside{width:auto;height:auto;;overflow:hidden;/* no float */} // i think this // is where i missed up, reddit's site didn't have this

我使用的网站作为参考,构建了一个css网页,其中侧栏在页面上始终保持相同大小,而当屏幕显示时,整个左侧逐渐缩小

sidebar{width:400px;float:right;/*rest doesn't matter*/}
leftside{width:auto;height:auto;;overflow:hidden;/* no float */} // i think this
// is where i missed up, reddit's site didn't have this
无论如何,这个网站在移动设备上根本无法扩展,侧边栏占据了整个屏幕,但在reddit的网站上,它可以很好地扩展。我如何使我的网站规模?我需要另一个div来包裹侧面和左侧吗?我试着在网上查这个,但每个人都说不使用px来定义边栏,但reddit使用px,它仍然可以缩放


感谢

尝试使用响应式css框架,如或

如果在移动设备上,东西的缩放可能是由于使用屏幕大小的媒体查询,因为在我的浏览器上,reddit的行为与您的描述相同,当我将其调整为移动设备的大小时,侧栏会显示整个浏览器的大小。
若你们不想让它在浏览器上表现得像reddit那个样,你们可以使用它;将媒体查询与浏览器的宽度一起使用,并在这些规则或中调整侧栏的大小;使用某种javascript或html5和css将侧栏设置为按钮,并在OnClick

reddit具有完全不同的移动风格时将其扩展到整个屏幕。但是你想要的是一个“响应性css框架”。哇,真的吗?每当我浏览他们的网站,它似乎只是桌面,没有移动/桌面option@LucasOu-杨:你不会被重定向到它,但可以通过媒体查询来访问它?我从来没有听说过在使用CSS的时候会用到这些?你的意思是宽度:em还是宽度:%?@LucasOu Yang:有关使用媒体查询的提示,请参阅。