css - Bootstrap - Grid Layout of List Items -
i have web page in i'm using bootstrap 3. in page, want have list of 4 panels place in 2x2 grid. want grid looks this:
+-----+-----+ | 1 | 2 | | | b | +-----+-----+ | 3 | 4 | | c | d | +-----+-----+
i want grid styled list-group though. styled, mean have border stylings , internal padding list-group item. not want single column of items. while i've been able close shown in bootply, it's not quite there. there still blank line between first , second rows in grid. but, if rid of blank line, borders between rows don't correct. in addition, i'm not sure if should use width:50%
i'm using.
my code in question looks this:
<div class="container"> <div class="list-group list-group-horizontal block" style="width:100%;"> <div class="list-group-item" style="width:50%;"> <h4>portion 1</h4> <h4><small>this description</small></h4> </div> <div class="list-group-item" style="width:50%;"> <h4>portion 2</h4> <h4><small>this description</small></h4> </div> </div> <div class="list-group list-group-horizontal block" style="width:100%;"> <div class="list-group-item" style="width:50%;"> <h4>portion 3</h4> <h4><small>this description</small></h4> </div> <div class="list-group-item" style="width:50%;"> <h4>portion 4</h4> <h4><small>this description</small></h4> </div> </div> </div>
what doing incorrect in approach layout?
you can use regular list-group. use css remove unwanted rounded corners , position 2 list-groups next each other
see below snippet or bootply: http://www.bootply.com/iyq8a9nvzq
.my-list-group { width: 50%; display: inline-block; } .left .list-group-item { border-top-right-radius: 0px; border-bottom-right-radius: 0px; } .right { float: right; } .right .list-group-item { border-top-left-radius: 0px; border-bottom-left-radius: 0px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="list-group my-list-group left"> <div class="list-group-item"> <h1>item 1</h1> <p>sub</p> </div> <div class="list-group-item"> <h1>item 3</h1> <p>sub</p> </div> </div> <div class="list-group my-list-group right"> <div class="list-group-item"> <h1>item 2</h1> <p>sub</p> </div> <div class="list-group-item"> <h1>item 4</h1> <p>sub</p> </div> </div>
Comments
Post a Comment