Removing white space between Divs - help me restructure code

时间:2015-06-26 10:05:35

标签: css

I have two divs I want to merge together for my website header. I want them both to be black and have no white space in between. Please advise. Also - does anybody recommend how I write my code? Im using a container class but don't have one in my CSS - Is this bootstrap default or something?

Thanks! See Below

<div class="nav">
      <div class="container" style="background-color: #000000;>
        <ul class="pull-left">
          <li><a href="#">Home</a></li>
          <li><a href="#">About Us</a></li>
        </ul>
        <ul class="pull-right">
          <li><a href="#">Portfolio</a></li>
          <li><a href="#">Pricing</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
      </div>
</div>



  <div style="background-color: #000000;" class="container" >
  <div><img src="http://www.part-box.com/images/yf.png" height="auto" width="400"></div>

</div> 

1 个答案:

答案 0 :(得分:1)

If you just want to merge the two with no space in between then you could just put the image tag within the first div. Easiest solution, does what you want as far as I interpret your request.

Like this:

<div class="nav">
  <div class="container" style="background-color: #000000;">
    <ul class="pull-left">
      <li><a href="#">Home</a></li>
      <li><a href="#">About Us</a></li>
    </ul>
    <ul class="pull-right">
      <li><a href="#">Portfolio</a></li>
      <li><a href="#">Pricing</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
    <img src="http://www.part-box.com/images/yf.png" height="auto" width="400">
  </div>
</div>