0

I'm mimicking this webpage as practice:

https://getbootstrap.com/docs/3.3/getting-started/

and I'm having difficulty attaching the blue div that takes you to Bootstrap 4 to the top of the page. I want to ensure there is no space between the div, like the website provided.

Here is the code I have so far:

  body {
    background-color: white;
  }

  #top {
    background-color: #386CD5;
    text-align: center;
    color: white;
    text-decoration: bold;
    padding: 16px;
    border-radius:0px;
  }

  #special1:visited {
    color:#386CD5;
  }

  #top:hover {
    background-color: #2C62BF;
  }
<a id="special1" href="https://getbootstrap.com">
 <div id="top">
  <strong>Bootstrap 4 is here!</strong>
 </div>
</a>

Thanks.

DaGallane
  • 11
  • 4

2 Answers2

0

You can add margin: 0; to body. Many browsers will add their own margins by default if you don't explicitly include this rule.

tshimkus
  • 1,173
  • 2
  • 17
  • 24
0

What I understand from your question, is that you don't want the white color arround the div. You can easily solve this by settings the margin of body to zero.

It will look like this:

  body {
    background-color: white;
  margin: 0;
  }

  #top {
    background-color: #386CD5;
    text-align: center;
    color: white;
    text-decoration: bold;
    padding: 16px;
    border-radius:0px;
  }

  #special1:visited {
    color:#386CD5;
  }

  #top:hover {
    background-color: #2C62BF;
  }
<a id="special1" href="https://getbootstrap.com">
 <div id="top">
  <strong>Bootstrap 4 is here!</strong>
 </div>
</a>
willem
  • 42
  • 5