I've managed to make the image stick to the footer but failed to make the footer stick to the bottom when entering responsive mode. I'm a newbie to bootstrap so help is appreciated.
HTML: The footer is after the table.
<div class="instructables-container" id="instructables" style="position: relative; margin-left: 0px;height: 10px; ">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading" style="color: #2E2E2E; text-align: center;">INSTRUCTABLES</h2>
<hr class="primary">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>Instructables</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
</div>
</div>
</div>
<div class="footer" style="height:30%; background-color: white;">
<div class="robot" style="position: absolute; margin:auto; left:0; right:0; bottom: 20px;">
<img src="http://i.imgur.com/q7GBNF1.png" />
</div>
<div class="words" style="position: absolute; width:100%;background-color:#E6E6E6; bottom:0px;">
<p style=" font-size: 13px; font-family: 'Open Sans', 'Helvetica Neue', Georgia, serif;">Contact: nerolikkh#gmail.com </p>
</div>
</div>
CSS:
.instructables-container {
margin-top: 25px;
margin-bottom: 300px;
margin-left: 0px;
letter-spacing: 2px;
line-height: 2;
font-size: 15px;
font-family: Helvetica;
}
.table{
margin-top: 80px;
text-align: center;
margin-left: 11%;
border: 0px;
}
.footer {
position: absolute;
font-family: Helvetica;
letter-spacing: 3px;
width: 100%;
height: 40px;
line-height: 20px;
font-size: 4px;
text-align: center;
height:400px;
}
.instructables-container {
margin-top: 25px;
margin-bottom: 300px;
margin-left: 0px;
letter-spacing: 2px;
line-height: 2;
font-size: 15px;
font-family: Helvetica;
}
.table{
margin-top: 80px;
text-align: center;
margin-left: 11%;
border: 0px;
}
.footer {
position: absolute;
font-family: Helvetica;
letter-spacing: 3px;
width: 100%;
height: 40px;
line-height: 20px;
font-size: 4px;
text-align: center;
height:400px;
}
.test div{
z-index:1;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="instructables-container" id="instructables" style="position: relative; margin-left: 0px;height: 10px; ">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading" style="color: #2E2E2E; text-align: center;">INSTRUCTABLES</h2>
<hr class="primary">
</div>
</div>
</div>
<div class="container">
<div class="row test">
<div class="col-lg-3 col-md-6 col-xs-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>Instructables</p>
</div>
</div>
<div class="col-lg-3 col-md-6 col-xs-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
<div class="col-lg-3 col-md-6 col-xs-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
<div class="col-lg-3 col-md-6 col-xs-6 text-center">
<div class="service-box">
<p style="font-size: 60px;">x</p>
<p>xx</p>
</div>
</div>
</div>
</div>
</div>
<div class="footer" style="height:30%; background-color: white;">
<div class="robot" style="position: absolute; margin:auto; left:0; right:0; bottom: 20px;">
<img src="http://i.imgur.com/q7GBNF1.png" />
</div>
<div class="words" style="position: absolute; width:100%;background-color:#E6E6E6; bottom:0px;">
<p style=" font-size: 13px; font-family: 'Open Sans', 'Helvetica Neue', Georgia, serif;">Contact: nerolikkh#gmail.com </p>
</div>
</div>
You should add the correct classes for mobile screen so you should define the width that you want for each div in mobile screen. You can use bootstrap class for that .col-xs-6 so one of these divs will be half of screen. Here is your html code and also a jsfiddle
And it's not good to use inline style you should use it as internal or external!
Related
How can I make the hover to be equal in size despite the line difference in the paragraph? As of now the size of my hover in 'content' class is different since my p.../p in the second and third card is different in the first and fourth card. Is there a way to make my hover size to be equal in all cards? Please see below codes. Thank you
.card .content {
width: 100%;
background: #fff;
opacity: 0.65;
position: absolute;
bottom: -60%;
margin-left: -4px;
transition: all ease 0.5s;
border-radius: 4px;
box-shadow: 0px -3px 4px rgba(10, 10, 10, 0.09)
}
.card .content .category {
font-size: 17px;
font-weight: 600
}
.card .content .price {
font-size: 17px;
font-weight: 500;
color: #0d6efd
}
.card .content p {
font-weight: 500;
font-size: 12px;
text-align: center;
}
.card:hover .content {
bottom: 0%
}
.buttons button {
border-radius: 1px;
margin-bottom: 10px;
transition: all ease 0.3s
}
.content {
padding: 10px
}
hr {
border: 0;
height: 1px;
width: 60%;
position: relative;
margin: 15px auto;
}
.d-flex {
font-weight: 500;
font-size: 12px;
margin: 15px auto;
}
.fa-play-circle {
padding-right: 4px;
padding-top: 3px;
}
<body>
<div id="image">
<div class="row">
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GABEL LOFFEL</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_1.jpg" alt="">
<div class="content">
<hr>
<p>Get out your <br> Lederhosen!</p>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GARY GARI</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_2.jpg" alt="">
<div class="content">
<hr>
<p>The delicious <br> headquarters for all <br> your ginger related <br> needs!</p>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>IL PIATTO</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_3.jpg" alt="">
<div class="content">
<hr>
<p>Got wild finicky kids? <br> Head for Il Piatto for <br> kid-friendly Italian <br> Fun!</p>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>PIERRE PLATTERS</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_4.jpg" alt="">
<div class="content">
<hr>
<p>Smart talks, Smart <br> eats!</p>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
enclosed your <p></P> in content class inside a div give one custom class para and other bootstrap flex classes to justify and align center
and given css to .content
height: 280px !important;
and given css to .content .para
.content .para{ height: 100px !important; }
.card .content {
width: 100%;
background: #fff;
opacity: 0.65;
position: absolute;
bottom: -60%;
margin-left: -4px;
transition: all ease 0.5s;
border-radius: 4px;
box-shadow: 0px -3px 4px rgba(10, 10, 10, 0.09)
}
.card .content .category {
font-size: 17px;
font-weight: 600
}
.card .content .price {
font-size: 17px;
font-weight: 500;
color: #0d6efd
}
.card .content p {
font-weight: 500;
font-size: 12px;
text-align: center;
}
.card:hover .content {
bottom: 0%
}
.buttons button {
border-radius: 1px;
margin-bottom: 10px;
transition: all ease 0.3s
}
.content {
height: 280px !important;
padding: 10px;
}
.content .para {
height: 100px !important;
}
hr {
border: 0;
height: 1px;
width: 60%;
position: relative;
margin: 15px auto;
}
.d-flex {
font-weight: 500;
font-size: 12px;
margin: 15px auto;
}
.fa-play-circle {
padding-right: 4px;
padding-top: 3px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div id="image">
<div class="row">
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GABEL LOFFEL</h3>
</div>
<div class="card-img-wrapper ">
<img src="images/2.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Get out your <br> Lederhosen!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GARY GARI</h3>
</div>
<div class="card-img-wrapper ">
<img src="images/3.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>The delicious <br> headquarters for all <br> your ginger related <br> needs!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>IL PIATTO</h3>
</div>
<div class="card-img-wrapper ">
<img src="images/4.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Got wild finicky kids? <br> Head for Il Piatto for <br> kid-friendly Italian <br> Fun!
</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>PIERRE PLATTERS</h3>
</div>
<div class="card-img-wrapper ">
<img src="images/2.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Smart talks, Smart <br> eats!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/#popperjs/core#2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.min.js"></script>
Try this code in browser to see
enclosed your <p></P> in content class inside a div give one custom class para and other bootstrap flex classes to justify and align center
and given css to .content
height: 280px !important;
and given css to .content .para
.content .para{ height: 100px !important; }
and in card img used class img-fluid
.card .content {
width: 100%;
background: #fff;
opacity: 0.65;
position: absolute;
bottom: -60%;
margin-left: -4px;
transition: all ease 0.5s;
border-radius: 4px;
box-shadow: 0px -3px 4px rgba(10, 10, 10, 0.09)
}
.card .content .category {
font-size: 17px;
font-weight: 600
}
.card .content .price {
font-size: 17px;
font-weight: 500;
color: #0d6efd
}
.card .content p {
font-weight: 500;
font-size: 12px;
text-align: center;
}
.card:hover .content {
bottom: 0%
}
.buttons button {
border-radius: 1px;
margin-bottom: 10px;
transition: all ease 0.3s
}
.content {
height: 280px !important;
padding: 10px;
}
.content .para {
height: 100px !important;
}
hr {
border: 0;
height: 1px;
width: 60%;
position: relative;
margin: 15px auto;
}
.d-flex {
font-weight: 500;
font-size: 12px;
margin: 15px auto;
}
.fa-play-circle {
padding-right: 4px;
padding-top: 3px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div id="image">
<div class="row">
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GABEL LOFFEL</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_1.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Get out your <br> Lederhosen!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>GARY GARI</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_2.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>The delicious <br> headquarters for all <br> your ginger related <br> needs!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>IL PIATTO</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_3.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Got wild finicky kids? <br> Head for Il Piatto for <br> kid-friendly Italian <br> Fun!
</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
<div class="image-column col-lg-3 col-md-6">
<div class="card h-100 p-1 card-container">
<div class="card-header">
<h3>PIERRE PLATTERS</h3>
</div>
<div class="card-img-wrapper ">
<img src="assets\image_4.jpg" class="img-fluid" alt="">
<div class="content">
<hr>
<div class="para d-flex justify-content-center align-items-center">
<p>Smart talks, Smart <br> eats!</p>
</div>
<hr>
<div class="d-flex justify-content-center"> <i class="far fa-play-circle"></i> More </div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/#popperjs/core#2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.min.js"></script>
I divided a page into two columns. When I reduce the screen, is there any way to put everything in just one column?
At this moment, when I reduce the screen, the width of the cards decreases (as shown in the image). Is there a way to put all the cards in just one column (on mobile) in order to keep the width at 100%?
Is there a way to put everything in just one column and with a margin top between the elements?
Thanks.
Stackblitz - DEMO
Code
<div style="width: 100%; height: 100%; overflow-y: scroll; overflow-x: hidden;">
<div style="width: 100%; height: 85%">
<div class="modal-body row" style="overflow: auto; margin-top: 135px; height: 100%;">
<div class="col-md-6">
<div style="height: 700px;">
<div class="container">
</div>
<div class="row">
<div class="Upcard">
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row" style="height: 100%;">
<div class="col-6">
<div class="card cardBig" style="margin-left: 16px; margin-right: 16px; line-height: 1;">
<div class="card-header header">
<h1> It </h1>
</div>
<div class="card-body">
</div>
</div>
</div>
<div class="col-6">
<div class="card" style="margin-left: 8px; margin-right: 16px; line-height: 1;">
<div class="card-header header">
<h1> data </h1>
</div>
<div class="card-body">
</div>
</div>
<div class="card card-small" style="margin-left: 8px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> T </h1>
</div>
<div class="card-body" style="overflow-y: auto; overflow-x: hidden;">
</div>
</div>
<div class="card card-small" style="margin-left: 8px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> Att </h1>
</div>
<div class="card-body att" style="overflow-x: hidden; overflow-y: auto;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Please try this snippet.
.card {
width: 100%;
height: 50%;
margin-bottom: 16px;
background: red 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
opacity: 1;
border: none;
}
.cardBig {
height: calc(100% - 16px);
}
.card-small {
height: 23%;
}
/* ---------------------------UPLOAD----------------------------------- */
.container {
width: 100%;
height: 100%;
padding: 2rem;
text-align: center;
border: dashed 4px blue;
position: relative;
margin: 0 auto;
border-radius: 16px;
display: flex;
justify-content: center;
align-items: center;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div style="width: 100%; height: 100%; overflow-y: scroll; overflow-x: hidden;">
<div style="width: 100%; height: 85%">
<div class="modal-body row" style="overflow: auto; margin-top: 135px; height: 100%;">
<div class="col-md-6 col-sm-12">
<div style="height: 700px;">
<div class="container">
</div>
<div class="row">
<div class="Upcard">
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="row" style="height: 100%;">
<div class="col-md-6 col-sm-12">
<div class="card cardBig">
<div class="card-header header">
<h1> It </h1>
</div>
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="card">
<div class="card-header header">
<h1> data </h1>
</div>
<div class="card-body">
</div>
</div>
<div class="card card-small">
<div class="card-header header">
<h1> T </h1>
</div>
<div class="card-body" style="overflow-y: auto; overflow-x: hidden;">
</div>
</div>
<div class="card card-small">
<div class="card-header header">
<h1> Att </h1>
</div>
<div class="card-body att" style="overflow-x: hidden; overflow-y: auto;">
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
<p>asdasdasdasdasdasdasdas</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I have a page divided in half. On one side I have a giant box and on the other side I have a set of cards. When I inspect the page or increase / reduce its size, the cards are no longer responsive. The small cards are above the large box. The goal is that when they cross, the cards will go down.
Does anyone help me make this responsive?
Thank you very much
HTML
<div class="col-md-6">
<div class="row">
<div class="col-6">
<div class="card" style="margin-left: 16px; margin-right: 16px; line-height: 1;">
<div class="card-header header">
<h1> M </h1>
</div>
<div class="card-body">
</div>
</div>
</div>
<div class="col-6">
<div class="card" style="margin-left: 8px; margin-right: 16px;">
<div class="card-header header">
<h1> I </h1>
</div>
<div class="card-body">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="card card-small" style="margin-left: 16px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> C </h1>
</div>
<div class="card-body" style="overflow: auto;">
</div>
</div>
</div>
<div class="col-6">
<div class="card card-small" style="margin-left: 8px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> D </h1>
</div>
<div class="card-body" style="overflow: auto;">
</div>
</div>
</div>
<div class="col-6">
<div class="card card-small" style="margin-left: 16px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> S </h1>
</div>
<div class="card-body" style="overflow: auto;">
</div>
</div>
</div>
<div class="col-6">
<div class="card card-small" style="margin-left: 8px; margin-right: 16px; margin-top: 16px;">
<div class="card-header header">
<h1> T </h1>
</div>
<div class="card-body" style="overflow: auto;">
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.Title{
width: 150px;
height: 30px;
font-family: 'Noto Sans';
font-size: 20px;
letter-spacing: 0;
color: #4D4F5C;
}
.header{
width: 435px;
height: 40px;
background: #ECF2F9 0% 0% no-repeat padding-box;
border-radius: 8px 8px 0px 0px;
}
.header h1{
text-align: center;
font-family:'Noto Sans';
font-size: 14px;
letter-spacing: 0;
color: #4D4F5C;
}
The reason they aren't responsive is because you have the cards and the .drop item set to fix widths using px's. Try setting the width of the items using percentages.
How would I vertically align text to the middle of a caption that has a position of absolute. I want the text whether it be 1 line or 2 lines for it to be in the middle of the green block.
Here is a example:
https://jsfiddle.net/DTcHh/7467/
<div class="row">
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that needs</h4>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that</h4>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that needs</h4>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that needs</h4>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that</h4>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4">
<div class="holder">
<div class="background">
</div>
<div class="text">
<h4>I am some text that needs</h4>
</div>
</div>
</div>
#import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
.holder {
position:relative;
display: table;
width: 100%;
}
.background {
background: #000;
height: 150px;
width: 100%;
}
.text {
position: absolute;
left:0;
right: 0;
bottom: 0;
text-align: center;
}
h4 {
background: green;
font-size: 1em;
margin: 0;
padding: 5px 10px;
min-height: 50px;
}
UPDATED
Like this ....
FIDDLE v4
This version I believe may have it.
Changed the <h4> to a <p>
Removed from <p>
width: 100%;
display: table-cell;
Added to <p>
margin-left: auto;
margin-right: auto;
transform: translateY(25%);
Changes to <p>
padding: 5px 10px; -TO- padding: 0px 10px;
Use line-height on h4 style with value more than double of the font-size:
h4 {
background: green;
font-size: 1em;
margin: 0;
padding: 5px 10px;
min-height: 50px;
line-height: 2.2em;
}
Checkout this DEMO
there's some problems with responsive grid system to me.
http://imageshack.com/a/img537/9687/4H48G0.jpg
http://imageshack.com/a/img539/8265/ANvr0Y.jpg - problem is here
My source code:
CSS
<style type="text/css">
.wrapper {
height: 100%;
text-align: center;
margin: 0 auto;
}
img { max-width:100% !important;
height:auto;
display:block;
}
.text {
color: #fff;
text-shadow:0px 2px 10px #000;
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
font-size: 22px;
width: 100%;}
.box {
border: 1px dashed #000;
overflow: hidden;
position: relative;
}
.tb_floater {
font-size: 1.5em;
margin-top: 20%;
padding-top: 10%;
}
.box.tall {
height: 300px;
}
.box.tall > a > img {
height: auto;
}
</style>
HTML
<div class="wrapper">
<div class="container">
<div class="row">
<div class="col-md-4 box tall">
<a href="#">
<img src="http://www.websailer.com/wp-content/uploads/2013/07/www_image.jpg">
</a>
<div class="text tall">
<div class="tb_floater">
<p>Loren ipsum shit amet<br/>Loren ipsum</p>
</div>
</div>
</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-6</div>
</div>
<div class="row">
<div class="pull-right col-xs-6 col-md-4 box tall">
<a href="#">
<img src="http://www.websailer.com/wp-content/uploads/2013/07/www_image.jpg">
</a>
<div class="text tall">
<div class="tb_floater">
<p>Loren ipsum shit amet<br/>Loren ipsum</p>
</div>
</div>
</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-2</div>
<div class="col-xs-6 col-md-2 box" style="height:150px;">.col-xs-6 .col-md-6</div>
<div class="col-xs-6 col-md-6 box" style="height:150px;">.col-xs-6 .col-md-2</div>
</div>
That empty field is problem when i resize the browser, any solution ?