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.

0

2 Answers 2

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>

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.