Search code examples
htmlcsstwitter-bootstrapfrontendweb-frontend

Moving element outside of grid system


I'm developing a tumblr theme with bootstrap, and I'd like a nice big area for the user's profile picture right next to the header. The issue here is, that bootstrap has a very tight grid format and I can't see any room for what I want:

enter image description here

see that red thing? I want to move it where the blue arrow is pointing. I've tried expanding the container, setting the red circle to float left, and giving it margin-bottom:100%, but that shoved everything down off the page.

Here's my css and HTML for reference, the item in question is labeled with the class "talkbubble":

CSS

//Media Queries
@media (min-width: 1200px){
    .container {
        width: 800px;
    }
}
@media (min-width: 992px){
    .container {
        width: 800px;
    }
}


//Header Edits
.jumbotron{
    margin-bottom: 0px;
    h1{
        color: red;
    }
}   

//upsidedown tab edits
.tab-content{
    padding:10px;
    border:1px solid #ddd;
    border-bottom:0px;
}
.nav-tabs {
    border-bottom: 0px;
    border-top: 1px solid #ddd;
}
.nav-tabs > li {
    margin-bottom:0;
    margin-top:-1px;
    margin-left: 32px;
    width: 71px; 
    white-space: nowrap;
}

.nav-tabs > li > a {
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 20px;
    border: 1px solid transparent;
    background-color: #eee;
    -moz-border-radius:0px;
    -webkit-border-radius:0px;
    border-radius:0px;
    -moz-border-radius-bottomright: 10px;
    -webkit-border-bottom-right-radius: 10px;
    border-bottom-right-radius: 10px;
    -moz-border-radius-bottomleft: 10px;
    -webkit-border-bottom-left-radius: 10px;
    border-bottom-left-radius: 10px; 
}
.nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus {
    color: #555555;
    cursor: default; 
    background-color: #eee;
    border: 1px solid #ddd;
    border-top-color: transparent;
}

.nav-tabs > li.active > a {
    background-color: #eee !important;
}

.arrow {
    border-color: #eee transparent transparent #eee;
    border-style: solid;
    border-width: 17px 17px 17px 17px;
    height:0;
    width:0;
    position:absolute;
    bottom:2px;
    right:-33px;

}

.arrow2 {
    border-color: #eee #eee transparent transparent;
    border-style: solid;
    border-width: 17px 17px 17px 17px;
    height:0;
    width:0;
    position:absolute;
    bottom:2px;
    right:67px;

}


//square gallery
.square{
    border-radius: 20px;
    border-style: solid;
    border-width: 2px;
    width: 200px;
    height: 200px;
    margin-top: 60px;
}

//iconbubble

.talkbubble {
   width: 120px;
   height: 120px;
   background: red;
   position: absolute;
   -moz-border-radius: 60px;
   -webkit-border-radius: 60px;
   border-radius: 60px;
} 
.talkbubble:before {
   content:"";
   position: absolute;
   right: 100%;
   top: 50px;
   width: 0;
   height: 0;
   border-top: 13px solid transparent;
   border-right: 26px solid red;
   border-bottom: 13px solid transparent;
}

HTML below

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
     <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="http://getbootstrap.com/favicon.ico">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/app.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/bootstrap/tab.js"></script>
    <script src="js/jquery.fakecrop.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>


  <body data-pinterest-extension-installed="cr1.39.1">

    <div class="container">
        <div class="talkbubble"></div>
      <div class="header clearfix">
        <!--
        <nav>
          <ul class="nav nav-pills pull-right">
            <li role="presentation" class="active"><a href="http://getbootstrap.com/examples/jumbotron-narrow/#">Home</a></li>
            <li role="presentation"><a href="http://getbootstrap.com/examples/jumbotron-narrow/#">About</a></li>
            <li role="presentation"><a href="http://getbootstrap.com/examples/jumbotron-narrow/#">Contact</a></li>
          </ul>
        </nav>
        -->
        <h3 class="text-muted">Hi I'm...</h3>
      </div>

      <div class="jumbotron tab-content">
        <div id="home" class="tab-pane fade in active">
        <h1>CpBunni</h1>
        <p class="lead">...and I'm an artist.</p>
        </div>
        <div id="menu1" class="tab-pane fade">
        <h1>CpBunni</h1>
        <p class="lead">...and I'm a cosplayer.</p>
        </div>
        <div id="menu2" class="tab-pane fade">
        <h1>CpBunni</h1>
        <p class="lead">...and I'm a nude model.</p>
        </div>
      </div>
      <ul class="nav nav-tabs">
        <li class="active"><a data-toggle="tab" href="#home">Home <div class="arrow"></div><div class="arrow2"></div></a></li>
        <li><a data-toggle="tab" href="#menu1">Menu 1 <div class="arrow"></div><div class="arrow2"></div></a></li>
        <li><a data-toggle="tab" href="#menu2">Menu 2 <div class="arrow"></div><div class="arrow2"></div></a></li>
      </ul>

    <script>
        $(document).ready(function () {
            // for a filled square thumbnail
            $('.square img').fakecrop({fill: true, wrapperWidth: 200, wrapperHeight: 200});
        });
    </script>

      <div class="row marketing">
        <div class="col-sm-4">
          <a href="#"><div class="square"><img src="resources/testimg.jpg" alt="..."></div></a> 
        </div>

        <div class="col-sm-4">
        <a href="#"><div class="square"><img src="resources/testimg2.jpg" alt="..."></div></a>  
        </div>

        <div class="col-sm-4">
        <a href="#"><div class="square"><img src="resources/testimg3.jpg" alt="..."></div></a>  
        </div>
            <div class="col-sm-4">
            <a href="#"><div class="square"><img src="resources/testimg4.png" alt="..."></div></a>  

        </div>
            <div class="col-sm-4">
            <a href="#"><div class="square"><img src="resources/testimg5.jpg" alt="..."></div></a>  

        </div>
      </div>

      <footer class="footer">
        <p>© 2015 Company, Inc.</p>
      </footer>
       </div> <!-- /container -->


    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="./Narrow Jumbotron Template for Bootstrap_files/ie10-viewport-bug-workaround.js"></script>
  <div id="scrollrail-vertical" class="disabled" style="width: 12px; border-left-width: 1px;"><div id="scrollbar-vertical" style="visibility: hidden; border-radius: 5px 7px; box-shadow: rgba(255, 255, 255, 0.901961) 0px 0px 1px 1px; height: 1015px; top: 2px; opacity: 0;"></div></div><div id="scrollrail-horizontal" class="disabled" style="height: 12px; border-top-width: 1px;"><div id="scrollbar-horizontal" style="visibility: hidden; border-radius: 14px 10px; box-shadow: rgba(255, 255, 255, 0.901961) 0px 0px 1px 1px; width: 1916px; left: 2px; opacity: 0;"></div></div><div id="window-resizer-tooltip"><a href="http://getbootstrap.com/examples/jumbotron-narrow/#" title="Edit settings"></a><span class="tooltipTitle">Window size: </span><span class="tooltipWidth" id="winWidth"></span> x <span class="tooltipHeight" id="winHeight"></span><br><span class="tooltipTitle">Viewport size: </span><span class="tooltipWidth" id="vpWidth"></span> x <span class="tooltipHeight" id="vpHeight"></span></div></body>


</html>

Solution

  • See this fiddle

    The trick is this:

    <div class="container-fluid">
      <div class="row">
        <div class="col-md-3">
          ...your image markup here...
        </div>
        <div class="col-md-9">
          ...
        </div>
      </div>
    

    I've set it to be like that from md up. You might want to make use of hidden-* for the image column at lower widths as what you're doing from a design point of view would look strange at mobile widths.