intro
I am creating a simple project in angular and using angular material with flexlayout
problem
the problem is that it doesn't wrap the text correctly on smaller screens, it either clips text or just make it larger than the container.
code
html
<div class="container">
<h2>Normal</h2>
<div class="flex-container" fxLayout="row" fxLayout.xs="column wrap">
<div class="child-1">1. One</div>
<div class="child-2">2. Two</div>
<div class="child-3">3. Three</div>
</div>
<h2>Default</h2>
<div class="flex-container" fxLayout="row" fxLayout.xs="column wrap">
<div class="child-1" fxFlex>
<p>1. One</p>
<p>166.67px</p>
</div>
<div class="child-2" fxFlex>
<p>1. Two</p>
<p>166.67px</p>
</div>
<div class="child-3" fxFlex>
<p>1. Three</p>
<p>166.67px</p>
</div>
</div>
<h2>fxFlex with grow shrink values</h2>
<div class="flex-container" fxLayout="row" fxLayout.xs="column wrap">
<div class="child-1" fxFlex="2 1 auto">
<p> Angular fxFlex flexgrow flexshrink flexbasis</p>
<p>250px</p>
</div>
<div class="child-2" fxFlex>
<p>Angular fxFlex flexgrow flexshrink flexbasis</p>
<p>125px</p>
</div>
<div class="child-3" fxFlex>
<p>125px</p>
</div>
</div>
</div>
<div class="container">
<mat-list>
<div class="flex-container" fxLayout="row wrap" fxLayout.xs="column wrap">
<mat-list-item fxFlex>
<div mat-line> <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestias qui assumenda perferendis atque ipsa ipsum enim voluptate voluptas mollitia autem minima deleniti quisquam iste alias, accusantium, eveniet ut, rerum totam.</p></div>
</mat-list-item>
<mat-list-item fxFlex>
<div mat-line>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos molestiae, sequi fugiat tempora dicta numquam ipsam dolorem natus ducimus et expedita cum quaerat porro, cumque necessitatibus odit. Omnis, fugiat officia?</div>
<div mat-line> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odio voluptatibus, rem blanditiis nobis, nemo, soluta velit molestiae repudiandae vel non atque accusantium ipsum deleniti saepe natus quam quasi quae fuga.</div>
</mat-list-item>
</div>
</mat-list>
</div>
CSS
.child-1 {
background-color: orange;
}
.child-2 {
background-color: yellow;
}
.child-3 {
background-color: green;
}
.container {
margin: 15px;
height: auto;
width: 95%;
border: 2px solid red;
text-align: center;
}
what i want
I included another container in the next stack blitz that uses the same CSS and flexlayout that works just fine. I want the other container to be the same using mat-list
stackblitz
stackblitz
Related
<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6">
<div class="info">
<h1>Lorem ipsum dolor sit amet <u style="color: rgb(165, 177, 231);">consectetur.</u> </h1>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga, pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error, omnis rerum tenetur officiis ea doloremque qui nihil officia?</p>
</div>
<ul>
<li>
<img src="./image/freshfood.png" alt="">
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="./image/restaurant.png" alt="">
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img">
<div>
<img src="image/home.png" alt="">
</div>
</div>
</div>
</div>
</section>
I want the home.png image and h1,p elements in the html codes to be replaced under 575.98 px. When I bring the device to these dimensions, h1,p is on the top and home.png is on the bottom. For this reason;
#home .container-items {
display: flex;
}
#home .info{
max-width: 100%;
height: 15rem;
order: 1 ;
}
#home .food-img{
order: 2;
}
I wrote these codes. Could you please explain this to me; For the order element to work, don't I need to assign the order element in the css to the classes or ids I gave to these divs? Like the food-img and info classes in this code.
As Paulie_D points out, this only works on the direct children (identified by the class flex-item-1 and flex-item-2 in the code below). You can then specify the order for the child elements:
#home .container-items {
display: flex;
}
#home .info {
max-width: 100%;
height: 15rem;
}
#media only screen and (max-width: 575.98px) {
.container-items {
flex-direction: column;
}
.flex-item-1 {
order: 2;
}
.flex-item-2 {
order: 1;
}
}
<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6 flex-item-1">
<div class="info">
<h1>
Lorem ipsum dolor sit amet
<u style="color: rgb(165, 177, 231)">consectetur.</u>
</h1>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga,
pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem
dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error,
omnis rerum tenetur officiis ea doloremque qui nihil officia?
</p>
</div>
<ul>
<li>
<img src="https://picsum.photos/60" alt="" />
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="https://picsum.photos/60" alt="" />
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img flex-item-2">
<div>
<img src="https://picsum.photos/300/200" alt="" />
</div>
</div>
</div>
</div>
</section>
In this case, you could just use flex-direction: column-reverse; though:
#home .container-items {
display: flex;
}
#home .info {
max-width: 100%;
height: 15rem;
}
#media only screen and (max-width: 575.98px) {
.container-items {
flex-direction: column-reverse;
}
}
<section id="home">
<div class="container">
<div class="row align-items-center container-items">
<div class="col-md-6 flex-item-1">
<div class="info">
<h1>
Lorem ipsum dolor sit amet
<u style="color: rgb(165, 177, 231)">consectetur.</u>
</h1>
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Fuga,
pariatur corporis! Quaerat officiis sit rerum exercitationem
facilis quas ex veritatis quod dolores delectus reiciendis autem
dignissimos doloremque consequuntur, ad eaque possimus corrupti.
Fugiat, non unde labore, cupiditate nobis quis maxime error,
omnis rerum tenetur officiis ea doloremque qui nihil officia?
</p>
</div>
<ul>
<li>
<img src="https://picsum.photos/60" alt="" />
<span><u>Fresh Foods</u> </span>
</li>
<li>
<img src="https://picsum.photos/60" alt="" />
<span> <u>Master Chefs</u> </span>
</li>
</ul>
</div>
<div class="col-md-6 food-img flex-item-2">
<div>
<img src="https://picsum.photos/300/200" alt="" />
</div>
</div>
</div>
</div>
</section>
I want to make the image almost half the height it is now but it should cover the whole image not the zoomed part only. How do i do it?
HTML code
<section class="Details">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="Jeans.jpg" alt="">
</div>
</section>
CSS
.Details {
display: flex;
}
.sectionimg {
width: 50%;
height: 10%;
}
See the modified example below. I'd suggest you do a research about how flex layout works and how image properties work in them.
.Details {
display: flex;
}
.sectionimg {
flex: 1 0 50%;
}
.sectionimg img {
max-width: 100%;
}
<section class="Details">
<div class="sectiontext">
<p class="sectionhead">More Than 1 Lakh Collection Of Items</p>
<p class="sectionsubhead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Itaque ratione nostrum rem in, illo repellat eius minima aspernatur beatae ipsa officiis, fugiat enim cumque magnam. Repellendus dicta amet distinctio aspernatur!</p>
</div>
<div class="sectionimg">
<img src="https://i.stack.imgur.com/Hc97v.png" alt="">
</div>
</section>
This question already has answers here:
Why is nth-child selector not working?
(5 answers)
Closed 2 years ago.
HTML
for each service box i want to change background.
but nth-child() selector is not working.
when each service class changed to nave with respective number its working finly.
.service:nth-child(1) {
background-color: red;
}
<section class="about-us">
<div class="service">
<div class="service-header">
<i class="fas fa-pen-nib"></i>
<h1>Interiar</h1>
</div>
<div class="service-text">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro corporis modi alias officia quod repudiandae fugit, eveniet ipsum, doloremque facere dolores ex illo hic quidem.</p>
</div>
</div>
<div class="service">
<div class="service-header">
<i class="fas fa-pen-nib"></i>
<h1>Interiar</h1>
</div>
<div class="service-text">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro corporis modi alias officia quod repudiandae fugit, eveniet ipsum, doloremque facere dolores ex illo hic quidem.</p>
</div>
</div>
</div>
To change the background for each service box to red remove :nth-child() from the css.
.service {
background-color: red;
}
nth-child(#) will get the number(#) of the element. Here 1st element with the match is selected and the style is applied.
To change the background for each try this :
.service:nth-child(1) {
background-color: red;
}
.service:nth-child(2) {
background-color: blue;
}
<section class="about-us">
<div class="service">
<div class="service-header">
<i class="fas fa-pen-nib"></i>
<h1>Interiar</h1>
</div>
<div class="service-text">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro corporis modi alias officia quod repudiandae fugit, eveniet ipsum, doloremque facere dolores ex illo hic quidem.</p>
</div>
</div>
<div class="service">
<div class="service-header">
<i class="fas fa-pen-nib"></i>
<h1>Interiar</h1>
</div>
<div class="service-text">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Porro corporis modi alias officia quod repudiandae fugit, eveniet ipsum, doloremque facere dolores ex illo hic quidem.</p>
</div>
</div>
</div>
Remember to remove background-color from .service. Background-color should be defined in the nth-child property.
If you want it more modular, I would recommend to use even/odd.
.service {
width: 100px;
height: 100px;
border: 1px solid black;
}
.service:nth-child(even) {
background-color: red;
}
.service:nth-child(odd) {
background-color: blue;
}
<div class="service"></div>
<div class="service"></div>
<div class="service"></div>
<div class="service"></div>
<div class="service"></div>
<div class="service"></div>
<div class="service"></div>
But you can also play around if you add different background-colors with for example :nth-child(3n+3), which means: Every third element: 3rd, 6th, 9th, etc, will have that background-color applied.
:nth-child(2n+2) => 2nd, 4th, 6th...
image doesnt fit parent element
here is the full code
https://jsfiddle.net/601q9j7c/1/
<section class="cards">
<div class="card">
<div class="img-data">
<div clas="bgimg"> <img src="https://cdn.pixabay.com/photo/2015/01/10/16/45/home-office-595476_960_720.jpg" alt=""> </div>
<div class="cardDetails">
<span class="date"><i class="fas fa-calendar-alt"></i> March 30, 2020 </span>
</div>
</div>
<div class="post-data">
<h1 class="title">Vuestic – Free Vue Admin Template</h1>
<p class="description">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Accusantium ullam ratione id nihil quis officia voluptas vitae molestiae provident natus exercitationem, praesentium maiores quo quas ducimus. Voluptatibus debitis ea perferendis?</p>
<div class="cta">
Read more →
</div>
</div>
</div>
</section>
If you don't set any defined width in either the CSS or the <img> tag, the image will be displayed at full size regardless of its container. This is your issue. So you need to ensure the image is at maximum 100% of it's parent's width.
HTML only
<section class="cards">
<div class="card">
<div class="img-data">
<div clas="bgimg"> <img src="https://cdn.pixabay.com/photo/2015/01/10/16/45/home-office-595476_960_720.jpg" alt="" width="100%"> </div>
<div class="cardDetails">
<span class="date"><i class="fas fa-calendar-alt"></i> March 30, 2020 </span>
</div>
</div>
<div class="post-data">
<h1 class="title">Vuestic – Free Vue Admin Template</h1>
<p class="description">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Accusantium ullam ratione id nihil quis officia voluptas vitae molestiae provident natus exercitationem, praesentium maiores quo quas ducimus. Voluptatibus debitis ea perferendis?</p>
<div class="cta">
Read more →
</div>
</div>
</div>
</section>
It is best practise to do this with CSS rather than directly into HTML, but you have not shown any CSS in your question.
A CSS example is below:
CSS example
.bgimg > img {
max-width: 100%;
width: 100%;
height:auto;
}
<section class="cards">
<div class="card">
<div class="img-data">
<div class="bgimg"> <img src="https://cdn.pixabay.com/photo/2015/01/10/16/45/home-office-595476_960_720.jpg" alt=""> </div>
<div class="cardDetails">
<span class="date"><i class="fas fa-calendar-alt"></i> March 30, 2020 </span>
</div>
</div>
<div class="post-data">
<h1 class="title">Vuestic – Free Vue Admin Template</h1>
<p class="description">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Accusantium ullam ratione id nihil quis officia voluptas vitae molestiae provident natus exercitationem, praesentium maiores quo quas ducimus. Voluptatibus debitis ea perferendis?</p>
<div class="cta">
Read more →
</div>
</div>
</div>
</section>
First of all ! your spelling your class is wrong, that's why image is not fitting.
Make the width of the image to be 100% and its height is auto so that is don't stretch but then your image may be come out of parent container make there overflow:hidden
.cards {
display: flex;
justify-content: center;
}
.card {
width: 60%;
justify-content: center;
display: grid;
grid-template-columns: 50% 50%;
box-shadow: 10px 0px 20px rgba(0,0,0,0.08);
height: 25rem;
}
.img-data {
height: 100%;
z-index: 1;
background-color: salmon;
display: grid;
grid-template-rows: 50% 50%;
}
.bgimg {
overflow: hidden;
}
.bgimg img {
height: auto;
width: 100%;
}
<section class="cards">
<div class="card">
<div class="img-data">
<div class="bgimg"> <img src="https://cdn.pixabay.com/photo/2015/01/10/16/45/home-office-595476_960_720.jpg" alt=""> </div>
<div class="cardDetails">
<span class="date"><i class="fas fa-calendar-alt"></i> March 30, 2020 </span>
</div>
</div>
<div class="post-data">
<h1 class="title">Vuestic – Free Vue Admin Template</h1>
<p class="description">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Accusantium ullam ratione id nihil quis officia voluptas vitae molestiae provident natus exercitationem, praesentium maiores quo quas ducimus. Voluptatibus debitis ea perferendis?</p>
<div class="cta">
Read more →
</div>
</div>
</div>
</section>
This should work and is dynamic:
This gives the image an inherited width and height, which means that it replicates the width of the previous object. It is given with the property style="width: inherit; height: inherit;"
.bgimg {
width: 500px; /*Or whatever you want...*/
}
/* this CSS can be directly inserted in a tag with style="width: 500px;"*/
<section class="cards">
<div class="card">
<div class="img-data">
<div class="bgimg"><!--*NOTE: you wrote <div clas="bgimg">(you missed an 's')--><img src="https://cdn.pixabay.com/photo/2015/01/10/16/45/home-office-595476_960_720.jpg" alt="" style="width: inherit; height: inherit;"> </div>
<div class="cardDetails">
<span class="date"><i class="fas fa-calendar-alt"></i> March 30, 2020 </span>
</div>
</div>
<div class="post-data">
<h1 class="title">Vuestic – Free Vue Admin Template</h1>
<p class="description">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Accusantium ullam ratione id nihil quis officia voluptas vitae molestiae provident natus exercitationem, praesentium maiores quo quas ducimus. Voluptatibus debitis ea perferendis?</p>
<div class="cta">
Read more →
</div>
</div>
</div>
</section>
Hope this helps!
I'm trying to put a divider inbetween the two divs but I can't find a solution without putting the class tag in the div area which I don't want to do.
What I want to do is something like this. Jsfiddle preview
<div class="box1"></div>
<div class="divider"></div>
<div class="box1"></div>
You don't need a divideer you can give right border to the first div as following:
.col-xs-6:first-child //can be md as well{
border-right:1px solid;
}
See the fiddle: "http://jsfiddle.net/ut8dgbxz/4/"
Your question is not clear in the sense of vertical or horizontal divider! So, for horizontal divider, that is a line that is sleeping or parallel to the floor, instead of div.divider use:
<hr />
This is the right way, which is called horizontal rule.
Snippet
#import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css");
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<hr />
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
</div>
</div>
</div>
If it is supposed to be vertical one, i.e., the standing one, use this way:
Snippet
#import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css");
.divider {border-left: 2px solid #ccc; padding-left: 5px;}
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-6">
<div class="divider">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
</div>
</div>
</div>
</div>
Make sure you do the columns this way: Use two .col-md-6 for equal width columns. And then use the CSS:
.divider {border-left: 2px solid #ccc; padding-left: 5px; margin-left: -5px;}
<div class="col-md-6">
Some content here.
</div>
<div class="col-md-6">
<div class="divider">
Some content here.
</div>
</div>
Snippet
.divider {border-left: 2px solid #ccc; padding-left: 3px; margin-left: -5px; height: 50px; float: left;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-6">Hello</div>
<div class="divider"></div>
<div class="col-md-6">Hello</div>
</div>
</div>
This replaces the margin displaced with the padding. And then you can use it anywhere.
Important Note: Never use the divider with .col-*-* classes as the layout might get screwed up in the responsiveness.
Now try to this way
.box1{
width:50%;
float:left;
background:gray;
}
.container {overflow:hidden;}
.divider{
position:relative;
}
.divider:after{
content:"";
position:absolute;
right:50%;
top:0;
bottom:0;
border-right:dotted 1px red;
}
<div class="container divider"><div class="box1 ">Hello</div>
<div class="box1">Hello two </div></div>
I think you want this kind:
.container{
background:#f5f5f5;
}
.col-md-6{
border-bottom:1px solid grey;
height:auto;
position:relative;
padding:0 0 10px 0;
}
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
</div>
</div>
</div>
HTML:
<div class="box1 divider"></div>
<div class="box1"></div>
CSS:
.divider {
position: relative;
}
.divider:after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 1px;
background-color: #000;
}
Just add an extra class to any div you want to be vertically divided then use this CSS. It removes the need for an extra element. This gives you more control when nesting grids
I understand that you don't want to put extra html element in there. What about this solution (this will work with many columns, not just two):
.col-md-6:nth-child(odd) {
border-right: 1px dotted grey;
}
.col-md-6:nth-child(even) {
border-right: none;
}
And HTML:
<div class="row">
<div class="col-md-12">
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-6">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
</div>
</div>
jsfiddle
You can use border-left using the sibling selector to act as the vertical divider. This is not dependent on the number of columns in the row so you can use it independently.
.dividers {
display: flex;
display: -ms-flex;
}
.dividers [class^=col] + [class^=col] {
/* To match all the classes prefixed with col and which has a sibling */
border-left: 1px solid gray;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-md-12 col-xs-12 dividers">
<div class="col-md-3 col-xs-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-3 col-xs-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-3 col-xs-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
<div class="col-md-3 col-xs-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expliabo a quisquam earum accusamus iusto quos sunt incidunt laudantium ratione unde veritatis soluta fuga cum hic odit asperiores accusantium nulla libero.</div>
</div>
</div>
</div>
If you want to use the bootstrap .col-* classes, see my Fiddle for a way to put vertical dividers that adjust to the tallest column.
Must view in full-screen for full effect
The borders are not used on mobile since the columns stack when viewed on a mobile platform.
.row {
overflow: hidden;
}
.cols {
padding-bottom: 100%;
margin-bottom: -100%;
overflow: hidden;
}
#media(min-width: 992px) {
.col-md-4:not(:first-child),
.col-md-6:not(:first-child) {
border-left: 1px solid black;
}
.col-md-4:not(:last-child),
.col-md-6:not(:last-child) {
border-right: 1px solid black;
margin-right: -1px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<h1>
.col-md-6
</h1>
<hr>
<div class="row text-center">
<div class="col-md-6 cols">
<p>Enter some text here</p>
</div>
<div class="col-md-6 cols">
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
</div>
</div>
<hr>
<h1>
.col-md-4
</h1>
<div class="row text-center">
<div class="col-md-4 cols">
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
</div>
<div class="col-md-4 cols">
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
</div>
<div class="cols col-md-4 cols">
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
<p>Enter some more text here</p>
</div>
</div>
</div>