Search code examples
csstwitter-bootstrapborderborder-layout

How to get crossing CSS borders


I am trying to create some styling for my page and I want it to look basically like this:

enter image description here

I am curious if there is any way that I can get the borders to overlap like this. I am using Twitter Bootstrap and my HTML looks like this right now:

<div class="container-fluid">

  <div class="row-fluid">

    <div class="span2">
       <img src="/images/logo.png" alt="logo"><br><br>

       <div class="well sidebar-nav">
        <ul class="nav nav-list">
          <li class="nav-header">Sub-Menu (this will only show for pages that need a sub-menu)</li>
          <li class="active"><a href="#">Current</a></li>
          <li><a href="#">Link</a></li>
          <li><a href="#">Link</a></li>
          <li><a href="#">Link</a></li>
        </ul>
      </div><!--/.well -->

    </div>

    <div class="span10">
      <h1 style="text-align:center;">Interplanetary Reactions</h1>
      <div class="center-me" style="border-top:5px solid white; border-bottom:5px solid white;">

    </div>

  </div>
<div class="center-me">
      <img src="http://i.imgur.com/yeHzm.jpg" alt="graphic">
</div>
    </div>
  </div>

  <footer style="border-top:5px solid white;">
<br>
<div class="row-fluid">

<div class="span4">
    &copy; Interplanetary Reactions 2012
</div>

<div class="span4">
    <div class="fb-like" data-href="http://www.facebook.com/    InterplanetaryReactions" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div>
</div>

<div class="span4">
    <a href="https://twitter.com/InterReactions" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @InterReactions</a>
</div>

</div>
  </footer>

</div><!--/.fluid-container-->

I know this isn't super clear but I am hoping someone will have some insight.


Solution

  • I suggest putting a border-image around your parent element. The basic approach is to create an image that contains your border in in in 9 slices (each corner, each side, and the middle) and then use CSS3's border-image to add the border to your element. See http://css-tricks.com/understanding-border-image/ for details.