如何从页面右侧删除白边

时间:2022-06-16 09:26:39

I have converted a Html Page to Responsive page. I was checking my page in iphone then I found that there is some white margin in right side of page.

我已将Html页面转换为响应页面。我正在iphone中查看我的页面,然后我发现页面右侧有一些白色边距。

I have used below code in my code, still I am not able to remove this issue

我在我的代码中使用了下面的代码,但我仍然无法删除此问题

body{
    margin:0%;
    padding:0%;
    overflow-x:hidden;
}

2 个解决方案

#1


0  

The best solution is of course using Bootstrap

最好的解决方案当然是使用Bootstrap

Otherwise your css should be something like that:

否则你的CSS应该是这样的:

html, body {
  margin: 0;
  position: absolute;
  top: 0;
  let: 0;
}

UPDATE: imho, usually is not a good idea to remove manually the overflow

更新:imho,手动删除溢出通常不是一个好主意

#2


0  

You have some content that is overflowing the container, you should identify the source of this by removing sections of the page until it fits correctly. The easiest way of doing this is to open the dev-tools and start selecting main sections of the site and removing them.

您有一些内容溢出容器,您应该通过删除页面的各个部分来确定其来源,直到它正确适合。最简单的方法是打开开发工具并开始选择站点的主要部分并将其删除。

You should be able to narrow down the cause of the overflow from here.

您应该能够从这里缩小溢出的原因。

Instead of masking the problem (which overflow-x: hidden will), you should try and resolve it. You'll probably find that the fix will be simple.

而不是掩盖问题(overflow-x:hidden will),你应该尝试解决它。你可能会发现修复很简单。

#1


0  

The best solution is of course using Bootstrap

最好的解决方案当然是使用Bootstrap

Otherwise your css should be something like that:

否则你的CSS应该是这样的:

html, body {
  margin: 0;
  position: absolute;
  top: 0;
  let: 0;
}

UPDATE: imho, usually is not a good idea to remove manually the overflow

更新:imho,手动删除溢出通常不是一个好主意

#2


0  

You have some content that is overflowing the container, you should identify the source of this by removing sections of the page until it fits correctly. The easiest way of doing this is to open the dev-tools and start selecting main sections of the site and removing them.

您有一些内容溢出容器,您应该通过删除页面的各个部分来确定其来源,直到它正确适合。最简单的方法是打开开发工具并开始选择站点的主要部分并将其删除。

You should be able to narrow down the cause of the overflow from here.

您应该能够从这里缩小溢出的原因。

Instead of masking the problem (which overflow-x: hidden will), you should try and resolve it. You'll probably find that the fix will be simple.

而不是掩盖问题(overflow-x:hidden will),你应该尝试解决它。你可能会发现修复很简单。