获取一个div来遍历整个页面 [英] Get a div to go across the whole page

查看:141
本文介绍了获取一个div来遍历整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我试图做一个div的宽度为100%,它不会跨越整个页面,它留下任何一边(顶部左下和右边)的小边距,我想要的div跨越整个页面,例如此页面顶部的标题栏。

Whenever i try to make a div with width 100%, it does not go across the whole page, it leaves small margins on either side(top bottom left and right), i would like the div to go across the whole page, such as the header bar on the top of this page.

推荐答案

您必须设置边距和填充 body 元素为0.像这样(在CSS中):

You have to set margin and padding of body element to 0. Like this (in CSS):

body
{
  margin: 0;
  padding: 0;
}

还要记住设置 margin div 元素到 0

And also remember about setting margin of div element to 0.

这篇关于获取一个div来遍历整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆