Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove white space left and right side of page?

Tags:

html

css

I am trying to make a footer, but the left and right sides show some white space. How to remove the white space?

Here is my code:

<html>
<head>
  <style>
    footer {
      background: none repeat scroll 0% 0% #DFDFDE;
      padding: 120px 0px;
      text-align: center;
      position: relative;
    }
    .divider {
      background: url('http://evablackdesign.com/wp-content/themes/ebd/images/footer-border.png')
      repeat-x scroll center center transparent;
      height: 7px;
      width: 100%;
      position: absolute;
      top: -6px;
    }
    .container {
      width: 930px;
      margin: 0px auto;
    }
  </style>
</head>
<body>
  <footer>
    <div class="divider"></div>
    <div class="container">
      <h1>hiiiiiiiii</h1>
      <br>
      <h2>buyyyyyyyyyyyy</h2>
    </div>
  </footer>
</body>
</html>

enter image description here image of footer

The tag defines a footer for a document or section.

A element should contain information about its containing element.

A footer typically contains the author of the document, copyright information, links to terms of use, contact information, etc.

like image 771
Aavik_Kumar Avatar asked Nov 15 '25 23:11

Aavik_Kumar


2 Answers

The body has a default margin. Remove it via:

html,body {
    margin:0;
    padding:0;
}
like image 112
j08691 Avatar answered Nov 18 '25 13:11

j08691


Most Web browsers have different default settings for the base margins and padding. This means that if you don't set a margin and padding on your body and html tags, you could get inconsistent results on the page depending upon which browser you're using to view the page.

The best way to solve this is to set all the margins and paddings on the html and body tags to 0:

html, body {
    margin: 0px;
    padding: 0px;
} 
like image 31
Mayank Avatar answered Nov 18 '25 12:11

Mayank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!