Responsive vertical align for three equal boxes with CSS - html

I'm using Bootstrap and would like to have three boxes of the same height align vertically.
Here you can see those three blocks, however I need them to be of equal height that will occupy maximum space. I can manually add some padding so it looks like that:
However when the block becomes smaller (bootstrap's grid) it breaks.
Any ideas?
Here's CSS code I'm using and HTML layout.
.caption {
height: 150px;
overflow: hidden;
position: relative;
padding: 0!important;
}
.caption-info{
width: 70%;
height: 100%;
display: inline-block;
padding: 9px;
}
.caption-flag:hover{
background: rgba(235, 75, 75, 1);
transition: background 0.2s ease;
}
.caption-flag{
cursor: help!important;
transition: background 0.2s ease;
position: absolute;
background: rgba(235, 75, 75, 0.75);
color: white;
font-weight: bold;
width: 100%;
text-align: center;
top: 20px;
z-index: 9999;
font-size: 20px;
}
.caption-info h4 { margin-top: 5px; margin-bottom:5px;}
.caption-prices{
width: 32%;
height: 100%;
display: inline-block;
position: absolute;
top: 0;
text-align: center;
}
.caption-prices h4{
margin-top: 0;
margin-bottom: 0;
font-weight: bold;
}
.caption-square, .caption-cost, .caption-total{
box-shadow: inset 10px 0px 20px -10px rgba(0,0,0,0.5);
padding-left: 0!important;
color: white;
font-size: 0.85em;
padding: 5.5px;
}
.caption-square{
background: green;
}
.caption-cost{
background: orange;
}
.caption-total{
background: red;
}
.thumbnail {
padding: 0;
position: relative;
}
<div class="row">
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/320x150" alt="">
<div class="caption">
<div class="caption-info">
<h4>Product Title</h4>
<p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<div class="caption-prices">
<div class="caption-square">
площадь
<h4>$24.99</h4>
</div>
<div class="caption-cost">
цена за м<sup>2</sup>
<h4>$24.99</h4>
</div>
<div class="caption-total">
стоимость
<h4>$24.99</h4>
</div>
</div>
</div>
</div>
</div>
</div>

Change this rule
.caption-square, .caption-cost, .caption-total{
box-shadow: inset 10px 0px 20px -10px rgba(0,0,0,0.5);
padding-left: 0!important;
color: white;
font-size: 0.85em;
padding: 5.5px;
height: 33%; /* added */
box-sizing: border-box; /* added */
}
Sample snippet
.caption {
height: 150px;
overflow: hidden;
position: relative;
padding: 0!important;
}
.caption-info{
width: 70%;
height: 100%;
display: inline-block;
padding: 9px;
}
.caption-flag:hover{
background: rgba(235, 75, 75, 1);
transition: background 0.2s ease;
}
.caption-flag{
cursor: help!important;
transition: background 0.2s ease;
position: absolute;
background: rgba(235, 75, 75, 0.75);
color: white;
font-weight: bold;
width: 100%;
text-align: center;
top: 20px;
z-index: 9999;
font-size: 20px;
}
.caption-info h4 { margin-top: 5px; margin-bottom:5px;}
.caption-prices{
width: 32%;
height: 100%;
display: inline-block;
position: absolute;
top: 0;
text-align: center;
}
.caption-prices h4{
margin-top: 0;
margin-bottom: 0;
font-weight: bold;
}
.caption-square, .caption-cost, .caption-total{
box-shadow: inset 10px 0px 20px -10px rgba(0,0,0,0.5);
padding-left: 0!important;
color: white;
font-size: 0.85em;
padding: 5.5px;
height: 33%;
box-sizing: border-box;
}
.caption-square{
background: green;
}
.caption-cost{
background: orange;
}
.caption-total{
background: red;
}
.thumbnail {
padding: 0;
position: relative;
}
<div class="row">
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<img src="http://placehold.it/320x150" alt="">
<div class="caption">
<div class="caption-info">
<h4>Product Title</h4>
<p>This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<div class="caption-prices">
<div class="caption-square">
площадь
<h4>$24.99</h4>
</div>
<div class="caption-cost">
цена за м<sup>2</sup>
<h4>$24.99</h4>
</div>
<div class="caption-total">
стоимость
<h4>$24.99</h4>
</div>
</div>
</div>
</div>
</div>
</div>

Related

Row of <div> elements will not align to the center [duplicate]

This question already has answers here:
How do I center floated elements?
(12 answers)
Closed last year.
I've read a hundred posts about how to center a row of divs, but I can't seem to get this to work. I want these elements to align to the center of their container, while maintaining a gap between each of them. No matter what I seem to do, they hug the left.
Do I need to change the CSS on the container element, or the individual div items themselves?
Help!
.news_section {
width: 100%;
height: 100%;
margin-left: auto;
margin-right: auto;
}
.news_container {
border: 1px red solid;
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.news_item { position: relative; float: left; font-family: graphik-light; font-size: 1.1em; margin: 25px 25px 25px 0px; width: 220px; height: 400px; cursor: pointer; transition: all 0.2s ease-out;
-webkit-box-shadow: 0px 3px 10px 1px rgba(204, 204, 204 0, 1);
-moz-box-shadow: 0px 3px 10px 1px rgba(204, 204, 204 0, 1);
box-shadow: 0px 3px 10px 1px rgba(204, 204, 204, 1);
}
.news_item:hover { background: #efefef; transform: scale(1.04); transition: all 0.2s ease-in; cursor: pointer; }
.news_img {
width: 100%;
height: 100%;
object-fit: contain;
}
.news_header { font-family: 'Oswald', sans-serif; font-size: 22px; line-height: 1.4em; text-align: left; margin-top: 18px; margin-left: 14px; margin-right: 14px; }
.news_outlet { font-size: 13px; text-align: left; margin-top: 7px; margin-left: 14px; color: #c1c1c1; font-family: graphik-regular; text-transform: uppercase; }
.news_subtext { font-size: 14px; text-align: left; margin-top: 20px; margin-left: 14px; margin-right: 14px; color: #4d5051; font-family: graphik-regular; }
.news_more { position: absolute; bottom: 10px; font-size: 16px; margin-left: 14px; color: #000; font-family: 'Oswald', sans-serif; }
<section class="news_section">
<div class="news_container">
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
</div>
</section>
On the news_item ... Change that
float: left;
to
display: inline-block;
.news_section {
width: 100%;
height: 100%;
margin-left: auto;
margin-right: auto;
}
.news_container {
border: 1px red solid;
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.news_item { position: relative; display: inline-block; font-family: graphik-light; font-size: 1.1em; margin: 25px 25px 25px 0px; width: 220px; height: 400px; cursor: pointer; transition: all 0.2s ease-out;
-webkit-box-shadow: 0px 3px 10px 1px rgba(204, 204, 204 0, 1);
-moz-box-shadow: 0px 3px 10px 1px rgba(204, 204, 204 0, 1);
box-shadow: 0px 3px 10px 1px rgba(204, 204, 204, 1);
}
.news_item:hover { background: #efefef; transform: scale(1.04); transition: all 0.2s ease-in; cursor: pointer; }
.news_img {
width: 100%;
height: 100%;
object-fit: contain;
}
.news_header { font-family: 'Oswald', sans-serif; font-size: 22px; line-height: 1.4em; text-align: left; margin-top: 18px; margin-left: 14px; margin-right: 14px; }
.news_outlet { font-size: 13px; text-align: left; margin-top: 7px; margin-left: 14px; color: #c1c1c1; font-family: graphik-regular; text-transform: uppercase; }
.news_subtext { font-size: 14px; text-align: left; margin-top: 20px; margin-left: 14px; margin-right: 14px; color: #4d5051; font-family: graphik-regular; }
.news_more { position: absolute; bottom: 10px; font-size: 16px; margin-left: 14px; color: #000; font-family: 'Oswald', sans-serif; }
<section class="news_section">
<div class="news_container">
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
<div class="news_item">
<div><img src="https://thruline.com/prototype/images/news/news.jpeg" class="news_img"/></div>
<div class="news_header">News title Here</div>
<div class="news_outlet">MAGAZINE OUTLET</div>
<div class="news_subtext">Description of articles goes here....</div>
<div class="news_more">Click Here to Read More...</div>
</div>
</div>
</section>
Better still, take a look at flex-box: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
If you want to align all items to the center, you need to use Flexbox. Basically, you gotta add this code to align everything of your container in center:
CSS:
.container: {
display: flex; /* flexbox */
justify-content: center; /* horizontal center */
align-items: center; /* vertical center */
}
This is an excelent article about Flexbox, made by W3School:
W3School - CSS Flexbox

How can I add spacing between these progress bar titles?

THIS IS A RESPONSIVE DESIGN, MAKE SURE TO TURN ON TOGGLE DEVICE TOOLBAR ON YOUR BROWSER
I am trying to make a progress bar. First I want to increase the height of the transparent black background. I can't find a way to do that. I am confused. And secondly, I want to add spacing and align the 2nd and 3rd text properly.
/* progress bar */
.center {
height: 300px;
width: 100%;
position: absolute;
left: 50%;
margin-top: 140px;
transform: translate(-50%, -50%);
padding: 20px;
background-color: rgba(0, 0, 0, 0.678);
box-shadow: 0 2px 60px rgba(0, 0, 0, .5);
border-radius: 10px;
color: white;
}
.center #progress{
margin: 0px;
padding: 0;
color: #fff;
text-transform: uppercase;
letter-spacing: 8px;
border-radius: 20px;
height: auto;
background-color: rgba(0, 0, 0, 0);
}
.skillbar{
box-sizing: border-box;
width: 100%;
margin: 20px 0;
}
/* skillbar languages */
.skillbar-html p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-html p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skillbar-css p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-css p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skill_percentage{
background-color: #262626;
padding: 4px;
box-sizing: border-box;
border: 1px solid #0fffb7;
border-radius: 6px;
}
.skill_level{
background-color: #0fffb7;
width: 100%;
height: 10px;
border-radius: 6px;
}
<section>
<div class="center">
<h1 id="progress">Progress</h1>
<div class="skillbar-html">
<p>HTML</p>
<p>90%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 90%;"></div>
</div>
<div class="skillbar-css">
<p>CSS</p>
<p>70%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 80%;"></div>
</div>
<div class="skillbar-javascript">
<p>JavaScript</p>
<p>50%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 50%;"></div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
</section>
You can take advantage of the <br> element in your HTML.
Line break and tab elements can be used when you need a little more control over how the browser renders the text. The <BR> element is used to force a line break.
-W3.org
/* progress bar */
.center {
height: 300px;
width: 100%;
position: absolute;
left: 50%;
margin-top: 140px;
transform: translate(-50%, -50%);
padding: 20px;
background-color: rgba(0, 0, 0, 0.678);
box-shadow: 0 2px 60px rgba(0, 0, 0, .5);
border-radius: 10px;
color: white;
}
.center #progress{
margin: 0px;
padding: 0;
color: #fff;
text-transform: uppercase;
letter-spacing: 8px;
border-radius: 20px;
height: auto;
background-color: rgba(0, 0, 0, 0);
}
.skillbar{
box-sizing: border-box;
width: 100%;
margin: 20px 0;
}
/* skillbar languages */
.skillbar-html p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-html p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skillbar-css p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-css p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skill_percentage{
background-color: #262626;
padding: 4px;
box-sizing: border-box;
border: 1px solid #0fffb7;
border-radius: 6px;
}
.skill_level{
background-color: #0fffb7;
width: 100%;
height: 10px;
border-radius: 6px;
}
<section>
<div class="center">
<h1 id="progress">Progress</h1>
<br>
<div class="skillbar-html">
<p>HTML</p>
<p>90%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 90%;"></div>
</div>
<br>
<div class="skillbar-css">
<p>CSS</p>
<p>70%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 80%;"></div>
</div>
<br>
<div class="skillbar-javascript">
<p>JavaScript</p>
<p>50%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 50%;"></div>
</div>
</div>
</div>
</div>
</div>
</section>
The Height: - I noticed a fixed height of 300px, and that you were centering the parent div by using margins and translations in your CSS. I went ahead and removed those margins and translations, also removed your absolute positioning. You can adjust your fixed height of 300px to expand the grey background. For this example, I made it 100 view height.
/* progress bar */
.center {
height: 100vh;
width: 100%;
padding: 20px;
position: relative;
background-color: rgba(0, 0, 0, 0.678);
box-shadow: 0 2px 60px rgba(0, 0, 0, .5);
border-radius: 10px;
color: white;
}
.center #progress{
margin: 0px;
padding: 0;
color: #fff;
text-transform: uppercase;
letter-spacing: 8px;
border-radius: 20px;
height: auto;
background-color: rgba(0, 0, 0, 0);
}
.skillbar{
box-sizing: border-box;
width: 100%;
margin: 20px 0;
}
/* skillbar languages */
.skillbar-html p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-html p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skillbar-css p{
color: #fff;
text-transform: uppercase;
margin: 0 0 10px;
padding: 0;
font-weight: bold;
letter-spacing: 3px;
}
.skillbar-css p:nth-child(2){
float: right;
position: relative;
top: -30px;
}
.skill_percentage{
background-color: #262626;
padding: 4px;
box-sizing: border-box;
border: 1px solid #0fffb7;
border-radius: 6px;
}
.skill_level{
background-color: #0fffb7;
width: 100%;
height: 10px;
border-radius: 6px;
}
<section>
<div class="center">
<h1 id="progress">Progress</h1>
<br>
<div class="skillbar-html">
<p>HTML</p>
<p>90%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 90%;"></div>
</div>
<br>
<div class="skillbar-css">
<p>CSS</p>
<p>70%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 80%;"></div>
</div>
<br>
<div class="skillbar-javascript">
<p>JavaScript</p>
<p>50%</p>
<div class="skill_percentage">
<div class="skill_level" style="width: 50%;"></div>
</div>
</div>
</div>
</div>
</div>
</section>
If I understood properly, what you want to increase the height is for that black bar containing your actual progress bar, right? If that's the case, I think this should work:
.skill-percentage {
height: x (here you place how much height you want);
}
That should give you the height that you want.
And, in order to add the spacing, you can take advantage of CSS padding or margin, depending on what you exactly need.
I'll give you a small snippet here so you can see exactly what I mean. Note that I modified a bit your HTML to fit what you wanted to do, but this may not be necessary on your original file.
/* progress bar */
* {
margin: 0;
padding: 0;
}
.center {
height: 500px;
width: 100%;
background-color: rgba(0, 0, 0, 0.678);
color: white;
}
.center #progress{
margin: 0px;
padding: 0;
color: #fff;
text-transform: uppercase;
letter-spacing: 8px;
border-radius: 20px;
height: auto;
background-color: rgba(0, 0, 0, 0);
}
.skillbar{
box-sizing: border-box;
width: 100%;
margin: 0;
}
/* skillbar languages */
.text-container {
display: flex;
width: 100%;
justify-content: space-between;
}
.text-container p {
padding: 0 40px; /* this is the one that changes the position of your text. Be carefull, you don't want this to change the position too much, just a bit, if you need to change the full position, better try something like grid, or modifying the flex */
}
.skillbar-html {
display: flex;
flex-direction: column;
justify-content: center;
}
.skillbar-html p {
margin: 10px;
}
.skillbar-html > div {
margin: 10px;
}
.skillbar-css {
display: flex;
flex-direction: column;
justify-content: center;
}
.skillbar-css p {
margin: 10px;
}
.skillbar-css > div {
margin: 10px;
}
.skillbar-javascript {
display: flex;
flex-direction: column;
justify-content: center;
}
.skillbar-javascript p {
margin: 10px;
}
.skillbar-javascript > div {
margin: 10px;
}
.skill_percentage{
height: 20px; /* this is the one that changes your height, now it's changing nothing, but you can modify the height by changing this value */
background-color: #262626;
padding: 4px;
box-sizing: border-box;
border: 1px solid #0fffb7;
border-radius: 6px;
}
.skill_level{
background-color: #0fffb7;
width: 100%;
height: 10px;
border-radius: 6px;
}
<section>
<div class="center">
<h1 id="progress">Progress</h1>
<div class="skillbar-html">
<div class="text-container">
<p>HTML</p>
<p>90%</p>
</div>
<div class="skill_percentage">
<div class="skill_level" style="width: 90%;">
</div>
</div>
</div>
<div class="skillbar-css">
<div class="text-container">
<p>CSS</p>
<p>70%</p>
</div>
<div class="skill_percentage">
<div class="skill_level" style="width: 80%;">
</div>
</div>
</div>
<div class="skillbar-javascript">
<div class="text-container">
<p>JavaScript</p>
<p>50%</p>
</div>
<div class="skill_percentage">
<div class="skill_level" style="width: 50%;">
</div>
</div>
</div>
</div>
</section>

Why can't i align the div that contains text next to the div that contains the image

i'm currently working on a webpage for my design class and i have a problem. This is the browser view:
I am kinda new with html and css but i have tried display in-line block, flex... Nothing worked, and i dont know what else i could do
So the problem is that the text "aaaaa" must be next to image. Here is my html code:
.caixa {
word-wrap: break-word;
width: 70%;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
margin: 25px;
margin-left: 0px;
border-radius: 10px;
}
.caixa-img {
display: inline-block;
margin: 15px;
width: 15%;
position: relative;
}
.caixa-img img {
margin-right: 120px;
border-radius: 10px;
width: 100%;
height: 100%;
}
.info {
width: 100%;
padding: 10px 20px;
}
.tipo {}
.descripcio {
display: block;
background-color: chartreuse;
}
.tipo a {
color: #222222;
margin: 5px 0px;
font-weight: 700;
letter-spacing: 0.5px;
padding-right: 8px;
}
.tipo span {
color: rgba(26, 26, 26, 0.5);
}
.preu {
color: #333333;
font-weight: 600;
font-size: 1.1rem;
font-family: poppins;
letter-spacing: 0.5px;
}
.overlay {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: rgba(226, 197, 88, 0.6);
display: flex;
justify-content: center;
align-items: center;
}
.comprar {
width: 160px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
color: #252525;
font-weight: 700;
letter-spacing: 1px;
font-family: calibri;
border-radius: 20px;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
}
.comprar:hover {
color: #FFFFFF;
background-color: rgb(248, 171, 55);
transition: all ease 0.3s;
}
.overlay {
visibility: hidden;
}
.caixa-img:hover .overlay {
visibility: visible;
animation: fade 0.5s;
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="col-12 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
<!--
<div class="rating">
<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>-->
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
Below an example using flexbox (see .caixa).
.caixa {
width: 70%;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
margin: 25px 25px 25px 0;
/* margin-left: 0px; */
border-radius: 10px;
display: flex; /* Added */
}
.caixa-img {
margin: 15px;
width: 30%;
}
.caixa-img img {
border-radius: 10px;
width: 125px; /* For demo */
height: 125px; /* For demo */
}
.info {
width: 100%;
padding: 10px 20px;
}
.tipo {}
.descripcio {
display: block;
background-color: chartreuse;
word-break: break-all; /* Essential to break large words */
}
.tipo a {
color: #222222;
margin: 5px 0px;
font-weight: 700;
letter-spacing: 0.5px;
padding-right: 8px;
}
.tipo span {
color: rgba(26, 26, 26, 0.5);
}
.preu {
color: #333333;
font-weight: 600;
font-size: 1.1rem;
font-family: poppins;
letter-spacing: 0.5px;
}
.overlay {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
background-color: rgba(226, 197, 88, 0.6);
display: flex;
justify-content: center;
align-items: center;
}
.comprar {
width: 160px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
color: #252525;
font-weight: 700;
letter-spacing: 1px;
font-family: calibri;
border-radius: 20px;
box-shadow: 2px 2px 30px rgba(0, 0, 0, 0.2);
}
.comprar:hover {
color: #FFFFFF;
background-color: rgb(248, 171, 55);
transition: all ease 0.3s;
}
.overlay {
visibility: hidden;
}
.caixa-img:hover .overlay {
visibility: visible;
animation: fade 0.5s;
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
<div class="col-12 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
if you use boostrap framework
you can use the bootstrap column and row.
<!-- language: lang-html -->
<div class="row">
<div class="col-6 productes">
<div class="producte1">
<div class="caixa">
<div class="caixa-img">
<img alt="" src="imgExplora/imgCarrousel/herbicida.jpg">
<div class="overlay">
Comprar
</div>
</div>
<div class="col-6">
<div class="tipo">
<a href="#">
<h3>HERBICIDA</h3>
</a>
<!--
<div class="rating">
<span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span>
</div>-->
</div>
55€
</div>
<div class="info">
<span class="descripcio">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</span>
</div>
</div>
</div>
</div>
</div>
<!-- end snippet -->
You have too much nested divs that dont need to be there, just making it more complex.
Also, your text is going outside your div borders, this is not a good thing.
You can move your text next to the image by using flex.
You always apply flex on a parent of the element that you want to move around (in this case, div with a picture, and div with a text).
So you are going to apply flex to a div that holds both of those divs (div with image, and div with text).
Here is my solution to this problem on a simple example, it should help you :
https://codepen.io/Juka99/pen/YzGVQyv

Child divs next to each other with auto height

I have two child divs next to each other inside a parent div. I don't know what the height of either div has to be, because its generated by viewport-height.
My problem is that in the left div I have an image and I don't know how I can get that image the same size as the right div which needs to have height: auto. The parent div has to be adjust to the second child div.
HTML
<div class="post-info">
<a href="" class="post-link">
<div class="post-info_img"></div>
<div class="post-info_content">
<p class="categorie_info">Category</p>
<p class="titel">Header</p>
<p class="info">
Lorem ipsum dolor sit amet...
</p>
<p class="date">June 2018</p>
</div>
</a>
</div>
CSS
.post-info {
width: 90vw;
border-radius: 15px;
background-color: #F6F6F6;
box-shadow: 0px 3px 0px 0px rgba(0,0,0,0.2);
margin-bottom: 2.5vh;
display: table;
}
.post-info_img {
background-image: url('http://via.placeholder.com/350x150');
width: 30vw;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 15px 0 0 15px;
display: table-cell;
}
.post-info_info {
padding: 5% 4vw;
display: table-cell;
}
.categorie_info {
color: #5B7AEB;
}
.titel {
font-size: 14px;
color: #2B2B2B;
margin: 0;
}
.info {
font-size: 14px;
margin-top: 5px;
}
.date {
font-size: 12px;
color: #707070;
}
.post-info {
width: 90vw;
border-radius: 15px;
background-color: #F6F6F6;
box-shadow: 0px 3px 0px 0px rgba(0, 0, 0, 0.2);
margin-bottom: 2.5vh;
display: table;
}
.post-info_img {
background-image: url('http://via.placeholder.com/350x150');
width: 30vw;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 15px 0 0 15px;
display: table-cell;
}
.post-info_info {
padding: 5% 4vw;
display: table-cell;
}
.categorie_info {
color: #5B7AEB;
}
.titel {
font-size: 14px;
color: #2B2B2B;
margin: 0;
}
.info {
font-size: 14px;
margin-top: 5px;
}
.date {
font-size: 12px;
color: #707070;
}
<div class="post-info">
<a href="" class="post-link">
<div class="post-info_img"></div>
<div class="post-info_content">
<p class="categorie_info">Category</p>
<p class="titel">Header</p>
<p class="info">
Lorem ipsum dolor sit amet...
</p>
<p class="date">June 2018</p>
</div>
</a>
</div>
Looks like you've misspelled a classname in your CSS.
Find .post-info_info and replace it with .post-info_content:
.post-info {
width: 90vw;
border-radius: 15px;
background-color: #F6F6F6;
box-shadow: 0px 3px 0px 0px rgba(0, 0, 0, 0.2);
margin-bottom: 2.5vh;
display: table;
}
.post-info_img {
background-image: url('http://via.placeholder.com/350x150');
width: 30vw;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
border-radius: 15px 0 0 15px;
display: table-cell;
}
.post-info_content {
padding: 5% 4vw;
display: table-cell;
}
.categorie_info {
color: #5B7AEB;
}
.titel {
font-size: 14px;
color: #2B2B2B;
margin: 0;
}
.info {
font-size: 14px;
margin-top: 5px;
}
.date {
font-size: 12px;
color: #707070;
}
<div class="post-info">
<a href="" class="post-link">
<div class="post-info_img"></div>
<div class="post-info_content">
<p class="categorie_info">Category</p>
<p class="titel">Header</p>
<p class="info">
Lorem ipsum dolor sit amet...
</p>
<p class="date">June 2018</p>
</div>
</a>
</div>
Issues
.post-info_info doesn't exist in HTML.
.post-link and .post-info_content don't exist in CSS.
.post-info is display:table yet its only child was .post-link that had no styles at all.
The 2 divs that have display:table-cell were .post-info_img (not a child of an element with display:table) and .post-info_info (doesn't exist in HTML).
That pretty much guarantees that your layout wouldn't even come close to the expected results.
Solutions
Made all classes very simple and semantic.
Changed all of the div tags to a semantic equivalent.
Assigned .link as display:flex so its children .img and .content sit side-by-side.
Changed background image into an img tag then assigned display:block, and object-fit:cover
Replaced percentage dimensions with intrinsic dimensions (ex. width:20% to width:20vw)
Added the Boba Fett because he pwns.
Demo
.info {
width: 90vw;
border-radius: 15px;
background-color: #F6F6F6;
box-shadow: 0px 3px 0px 0px rgba(0, 0, 0, 0.2);
margin-bottom: 2.5vh;
display: table;
font-size: 14px;
margin-top: 5px;
}
.link {
display: flex;
justify-content: center;
}
.img {
position: relative;
width: 35vw;
min-height: 40vh;
display: table-cell;
padding: 0;
overflow:hidden
}
.img img {
position: absolute;
top: 0;
bottom: 0;
right: .5em;
left: .5em;
width: 35vw;
min-height: 35vh;
object-fit: cover;
border-radius: 15px 0 0 15px;
overflow:hidden;
}
.content {
width: 50vw;
min-height: 40vh;
}
.category {
color: #5B7AEB;
font-variant: small-caps;
font-size: 1.25em
}
.title {
color: #2B2B2B;
margin: 0;
letter-spacing: 2px;
font-size: 16px;
line-height: 1.83em
}
.date {
color: #707070;
}
<section class="info">
<a href="" class="link">
<figure class="img">
<img src='https://www.sideshowtoy.com/wp-content/uploads/2018/01/star-wars-boba-fett-deluxe-version-sixth-scale-figure-hot-toys-feature-903352-900x600.jpg'>
</figure>
<article class="content">
<header class="category">Profile
<h1 class="title">Boba Fett</h1>
</header>
<p class="text">
"I am the best bounty hunter in the galaxy. I will find your rebel scum or the next carbonite bath is on me," Specializes in Jedi location...
</p>
<footer class="date"><small>June 2018</small></footer>
</article>
</a>
</section>

Align button without affecting other buttons

I am working with Bootstrap 3.3.7.
I need button 1 to align like the below picture, but the button should not affect with Button 2. Before that make sense you can see the demo version here.
I have tried to set a margin-top:80px; on button 1, but that is not working below < 768px. I have tried to make a new row and col-sm-12 inside the card, but then the button is going over the text. Button 2 i called the classcta-right, so I know that button is aligning right.
So how can place the button 1 line the picture, no matter if the text is only 4 lines?
I have cut away so much code as possible, so the question is not getting to long.
body {
background-color: #f5f5f5;
}
div {
background-color: #fff;
}
.index-content a:hover {
color: black;
text-decoration: none;
}
.index-content .row {
margin-top: 20px;
}
.index-content a {
color: black;
}
.index-content .card {
background-color: #FFFFFF;
padding: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}
.index-content .card:hover {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
color: black;
}
.index-content .card img {
width: 100%;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
height: 350px;
}
.index-content .card h4 {
margin: 20px;
}
.index-content .card p {
margin: 20px;
opacity: 0.65;
}
.index-content .blue-button {
width: 100px;
-webkit-transition: background-color 1s, color 1s;
/* For Safari 3.1 to 6.0 */
transition: background-color 0.5s, color 0.5s;
min-height: 20px;
background-color: #4CAF50;
color: #ffffff;
border-radius: 4px;
text-align: center;
font-weight: lighter;
margin: 0px 20px 15px 20px;
padding: 5px 0px;
display: inline-block;
}
.index-content .blue-button:hover {
background-color: #dadada;
color: #002E5B;
}
/* Set width between block elements */
.small-padding.top {
padding-top:10px;
}
.small-padding.bottom {
padding-bottom:10px;
}
.small-padding.left {
padding-left:5px;
}
.small-padding.right {
padding-right:5px;
}
.row [class*="col-"] {
padding-left: 5px;
padding-right: 5px;
}
.margin_bottom {
margin-bottom: 10px;
}
.row [class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
.row {
margin-left: -5px;
margin-right: -5px;
}
.card-img-bottom {
color: #fff;
height: 20rem;
background: url(images/img1.jpg) center no-repeat;
background-size: cover;
}
.img-responsive {
height: 100%;
}
/* Button Position */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
/* Set full width on columns */
#media (max-width: 768px) {
.img-responsive {
width: 100%;
}
}
/* GRID ELEMENTS MEDIA QUERIES */
#media (min-width: 768px) {
.card {
position: relative;
}
.card-content {
position: absolute;
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0.5);
}
.card-content h4,
.card-content p {
color: white;
width: 100%;
float: left;
margin: 0 0 5px;
}
.card-content a {
float: right;
}
.index-content .card h4,
.index-content .card p {
padding: 15px 20px;
margin: 0;
}
.index-content .card p {
padding: 0 20px 15px;
margin: 0;
}
.card-content-textbox {
position: absolute;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.7);
/*right: 0;*//* top position on right*/
margin: 15px;
max-width: 300px;
height: 91%
}
}
/* Grid with different placement of position buttons */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
<div class="container">
<!-- Full width Banner -->
<div class="row">
<a href="#">
<div class="col-md-12 small-padding top bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/1200x500"></img>
<div class="card-content-textbox">
<h4>BMW & HEADLINE 2018</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
BUTTON 1
</div>
</div>
</div>
</div>
</a>
</div>
<!-- Col 4 - 8 -->
<div class="row">
<div class="col-sm-4 small-padding right bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/390x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
BUTTON 2
</div>
</div>
</div>
</div>
<div class="col-sm-8 small-padding left bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/800x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
<!-- <p>Brødtekst</p> -->
BUTTON 2
</div>
</div>
</div>
</div>
</div>
</div>
Make use of flexbox:
body {
background-color: #f5f5f5;
}
.flexbox-column {
display: flex;
flex-direction:column; /*Stack flex items verically*/
}
.flexbox-column .bottom-button {
margin-top: auto !important /*Send button to bottom*/;
margin-bottom: 10px;
}
div {
background-color: #fff;
}
.index-content a:hover {
color: black;
text-decoration: none;
}
.index-content .row {
margin-top: 20px;
}
.index-content a {
color: black;
}
.index-content .card {
background-color: #FFFFFF;
padding: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}
.index-content .card:hover {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
color: black;
}
.index-content .card img {
width: 100%;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
height: 350px;
}
.index-content .card h4 {
margin: 20px;
}
.index-content .card p {
margin: 20px;
opacity: 0.65;
}
.index-content .blue-button {
width: 100px;
-webkit-transition: background-color 1s, color 1s;
/* For Safari 3.1 to 6.0 */
transition: background-color 0.5s, color 0.5s;
min-height: 20px;
background-color: #4CAF50;
color: #ffffff;
border-radius: 4px;
text-align: center;
font-weight: lighter;
margin: 0px 20px 15px 20px;
padding: 5px 0px;
display: inline-block;
}
.index-content .blue-button:hover {
background-color: #dadada;
color: #002E5B;
}
/* Set width between block elements */
.small-padding.top {
padding-top:10px;
}
.small-padding.bottom {
padding-bottom:10px;
}
.small-padding.left {
padding-left:5px;
}
.small-padding.right {
padding-right:5px;
}
.row [class*="col-"] {
padding-left: 5px;
padding-right: 5px;
}
.margin_bottom {
margin-bottom: 10px;
}
.row [class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
.row {
margin-left: -5px;
margin-right: -5px;
}
.card-img-bottom {
color: #fff;
height: 20rem;
background: url(images/img1.jpg) center no-repeat;
background-size: cover;
}
.img-responsive {
height: 100%;
}
/* Button Position */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
/* Set full width on columns */
#media (max-width: 768px) {
.img-responsive {
width: 100%;
}
}
/* GRID ELEMENTS MEDIA QUERIES */
#media (min-width: 768px) {
.card {
position: relative;
}
.card-content {
position: absolute;
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0.5);
}
.card-content h4,
.card-content p {
color: white;
width: 100%;
float: left;
margin: 0 0 5px;
}
.card-content a {
float: right;
}
.index-content .card h4,
.index-content .card p {
padding: 15px 20px;
margin: 0;
}
.index-content .card p {
padding: 0 20px 15px;
margin: 0;
}
.card-content-textbox {
position: absolute;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.7);
/*right: 0;*//* top position on right*/
margin: 15px;
max-width: 300px;
height: 91%
}
}
/* Grid with different placement of position buttons */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
<div class="container">
<!-- Full width Banner -->
<div class="row">
<a href="#">
<div class="col-md-12 small-padding top bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/1200x500"></img>
<div class="card-content-textbox flexbox-column">
<h4>BMW & HEADLINE 2018</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
BUTTON 1
</div>
</div>
</div>
</div>
</a>
</div>
<!-- Col 4 - 8 -->
<div class="row">
<div class="col-sm-4 small-padding right bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/390x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
BUTTON 2
</div>
</div>
</div>
</div>
<div class="col-sm-8 small-padding left bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/800x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
<!-- <p>Brødtekst</p> -->
BUTTON 2
</div>
</div>
</div>
</div>
</div>
</div>
You can use the .flexbox-column and .bottom-button classes anywhere on the site and place as many buttons at the bottom as you need.
How about adding
.top .index-content .blue-button {
position: absolute;
bottom: 0;
}
for screen width > 768 ?
body {
background-color: #f5f5f5;
}
div {
background-color: #fff;
}
.index-content a:hover {
color: black;
text-decoration: none;
}
.index-content .row {
margin-top: 20px;
}
.index-content a {
color: black;
}
.index-content .card {
background-color: #FFFFFF;
padding: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}
.index-content .card:hover {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
color: black;
}
.index-content .card img {
width: 100%;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
height: 350px;
}
.index-content .card h4 {
margin: 20px;
}
.index-content .card p {
margin: 20px;
opacity: 0.65;
}
.index-content .blue-button {
width: 100px;
-webkit-transition: background-color 1s, color 1s;
/* For Safari 3.1 to 6.0 */
transition: background-color 0.5s, color 0.5s;
min-height: 20px;
background-color: #4CAF50;
color: #ffffff;
border-radius: 4px;
text-align: center;
font-weight: lighter;
margin: 0px 20px 15px 20px;
padding: 5px 0px;
display: inline-block;
}
.index-content .blue-button:hover {
background-color: #dadada;
color: #002E5B;
}
/* Set width between block elements */
.small-padding.top {
padding-top:10px;
}
.small-padding.bottom {
padding-bottom:10px;
}
.small-padding.left {
padding-left:5px;
}
.small-padding.right {
padding-right:5px;
}
.row [class*="col-"] {
padding-left: 5px;
padding-right: 5px;
}
.margin_bottom {
margin-bottom: 10px;
}
.row [class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
.row {
margin-left: -5px;
margin-right: -5px;
}
.card-img-bottom {
color: #fff;
height: 20rem;
background: url(images/img1.jpg) center no-repeat;
background-size: cover;
}
.img-responsive {
height: 100%;
}
/* Button Position */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
/* Set full width on columns */
#media (max-width: 768px) {
.img-responsive {
width: 100%;
}
}
/* GRID ELEMENTS MEDIA QUERIES */
#media (min-width: 768px) {
.top .index-content .blue-button {
position: absolute;
bottom: 0;
}
.card {
position: relative;
}
.card-content {
position: absolute;
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0.5);
}
.card-content h4,
.card-content p {
color: white;
width: 100%;
float: left;
margin: 0 0 5px;
}
.card-content a {
float: right;
}
.index-content .card h4,
.index-content .card p {
padding: 15px 20px;
margin: 0;
}
.index-content .card p {
padding: 0 20px 15px;
margin: 0;
}
.card-content-textbox {
position: absolute;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.7);
/*right: 0;*//* top position on right*/
margin: 15px;
max-width: 300px;
height: 91%
}
}
/* Grid with different placement of position buttons */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
.inner-wrapper {
text-align: center;
background: none;
}
<div class="container">
<!-- Full width Banner -->
<div class="row">
<a href="#">
<div class="col-md-12 small-padding top bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/1200x500"></img>
<div class="card-content-textbox">
<h4>BMW & HEADLINE 2018</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
BUTTON 1
</div>
</div>
</div>
</div>
</a>
</div>
<!-- Col 4 - 8 -->
<div class="row">
<div class="col-sm-4 small-padding right bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/390x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
BUTTON 2
</div>
</div>
</div>
</div>
<div class="col-sm-8 small-padding left bottom">
<div class="index-content">
<div class="card">
<img src="http://placehold.it/800x500"></img>
<div class="card-content">
<h4>BMW & HEADLINE 2018</h4>
<!-- <p>Brødtekst</p> -->
BUTTON 2
</div>
</div>
</div>
</div>
</div>
</div>