Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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
Css 调整浏览器大小时显示右边距_Css_Html_Responsive Design_Media Queries - Fatal编程技术网

Css 调整浏览器大小时显示右边距

Css 调整浏览器大小时显示右边距,css,html,responsive-design,media-queries,Css,Html,Responsive Design,Media Queries,我用这个来集中我的主分区,它包含了所有的东西 #main { margin-left: 10%; margin-right: 10%; width: 100%; height: 100%; } 我必须制作一个响应性强的网站,这样当我缩小浏览器的尺寸时,我希望右边的空白保持不变。目前,我的div随着大小而减少,但右边没有余量 另外,我认为主分区的中锋也不好 非常感谢你的帮助 <div style="width: 80%; position: relative;

我用这个来集中我的主分区,它包含了所有的东西

#main {
margin-left: 10%;
margin-right: 10%;
width: 100%;
height: 100%;
}
我必须制作一个响应性强的网站,这样当我缩小浏览器的尺寸时,我希望右边的空白保持不变。目前,我的div随着大小而减少,但右边没有余量

另外,我认为主分区的中锋也不好

非常感谢你的帮助


<div style="width: 80%; 
         position: relative; 
             left: 10%; 
            align: center; 
 background-color: red;"></div>

我现在明白了。使用此选项,并将其粘贴到@media中

#main {
 margin-left: 10%;
 margin-right: 10%;
 }
工作得很有魅力。感谢钛和布赖恩的帮助。非常感谢


:D

我现在明白了。使用此选项,并将其粘贴到@media中

#main {
 margin-left: 10%;
 margin-right: 10%;
 }
工作得很有魅力。感谢钛和布赖恩的帮助。非常感谢


:D

您也可以使用
边距:10%0
而不是同时使用
左边距
右边距
。是的,但我不希望在顶部有任何边距。我使用的代码工作正常,但是当我收缩浏览器时右边距消失了。对不起,我的意思是
margin:0 10%你确定你的
html,body了吗{
页边距:0;
?啊,我想出来了…我删除了宽度和高度。它现在工作正常了。谢谢:p你也可以使用
页边距:10%0;
而不是同时使用
左边的页边距
右边的页边距
。是的,但我不希望在顶部有任何页边距。我使用的代码工作正常,但当我使用时右边的页边距消失了缩小浏览器。对不起,我的意思是
margin:0 10%;
你确定你的
html,body{
margin:0;
?啊,我算出来了…我删除了宽度和高度。现在可以了谢谢:P