I am working on a personal design project where I have 5 tiles with images in them and when you mouse over any of them they display alternate text. I have included my source code but my problem seems to be when I test this by hovering over the tile I added the W3 snippet to nothing happens. If I inspect the code however and add the hover attribute in the Chrome inspect tool it seems to work just fine. What am I missing here?
Here is my code My Code
.bottom p {
text-align: center;
}
.bottom {
margin-top: 200px;
width: 50%;
}
.top {
width: 33.33333333333%;
display: inline-block;
}
.tile {
height: 200px;
justify-content: center;
align-items: center;
overflow: hidden;
padding-left: 0px;
padding-right: 0px;
border-style: solid;
border-width: 5px;
border-color: /*Navy Blue*/ #333333/* FetchMe Orange #FBAA1E*/;
text-align: center;
box-shadow: 5px 5px 10px #000000;
}
.tile p {
z-index: 4;
font-size: 24px;
position: absolute;
bottom: 0;
margin-bottom: 10px;
font-weight: bold;
text-align: center;
margin-left: 35%;
margin-right: 35%;
}
.img1 {
flex-shrink: 0;
min-width: 100%;
min-height: 100%
}
.top p {
text-align: center;
}
.fetch-form {
padding-top: 50px;
padding-bottom: 50px;
margin: 0 auto;
position: absolute;
z-index: 3;
margin-left: 110px;
margin-right: 110px;
left: 0;
right: 0;
}
.tiles {
margin-left: 0px;
margin-right: 0px;
z-index: 2;
position: absolute;
top: 150px;
left: 0px;
color: white;
display: inline-block;
padding-top: 10px;
}
.inner {
display: block;
margin-left: auto;
margin-right: auto;
}
.slider {
z-index: -1;
position: absolute;
padding-right: 0;
padding-left: 0;
margin-right: 0;
margin-left: 0;
left: 0;
right: 0;
top: 0;
height: 600px;
min-width: 100%;
}
.item {
height: 600px;
}
.container {
position: relative;
}
.overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #008CBA;
overflow: hidden;
width: 0%;
height: 100%;
transition: .5s ease;
z-index: 5;
}
.container:hover .overlay {
width: 100%;
}
.text {
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
overflow: hidden;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.image {
display: block;
width: 100%;
height: auto;
}
<div class="row">
<div class="col-xs-10 fetch-form">
<form action="order" method="POST" role="form" id="address_form">
<div class="col-xs-12 fetch-form">
<div class="row">
<div class="col-xs-8 input">
<div class="input">
<i class="icon-prepend fa fa-home"></i>
<input type="text" placeholder="Street Address (optional)" id="address" name="address" class="form-control input-lg" autocomplete="off">
</div>
</div>
<div class="col-xs-2">
<input type="hidden" name="zip_code"><input type="hidden" value="true" name="set_temp_address">
<button class="btn btn-primary btn-lg btn-block btn" type="submit">
<i class="fa fa-search"></i> Fetch Me Food!
</button>
</div>
</div>
</div>
<div class="row well well-sm" style="display: none;">
<div class="col-xs-4 text-center">
<div class="radio" >
<label><center><i class="fa fa-taxi fa-lg hidden-xs"> </i></center>
<input type="radio" id="type_delivery" name="order_type" value="DELIVERY" checked="checked">
<span class="radiosearch"> </span><span class="ordertype">Delivery</span>
</label>
</div>
</div>
<div class="col-xs-4 text-center border-left">
<div class="radio">
<label>
<center><i class="fa fa-cutlery fa-lg hidden-xs"> </i></center>
<input type="radio" id="type_takeout" name="order_type" value="TAKEOUT">
<span class="radiosearch"> </span>
<span class="ordertype"><nobr>Pick-up</nobr></span>
<nobr></nobr>
</label>
</div>
</div>
<div class="col-xs-4 text-center border-left" >
<div class="radio"><a href="/account/groups" style="color: #333333;">
<label>
<center><i class="fa fa-group fa-lg" style="margin-bottom: 6px;"> </i></center>
<span class="ordertype"><span style="margin-top:9px;" class="visible-xs">Group »</span></span> <span
class="ordertype"><span class="hidden-xs">Group Order »</span></span> </label></a></div>
</div>
</div>
</form>
</div>
<div class="col-xs-12 tiles">
<div class="inner">
<div class="col-xs-3 top tile container">
<p>Restarunts and Catering</p>
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1 image" alt="">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</div>
<div class="col-xs-3 top tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1" alt="">
<p>Our Deals</p>
</div>
<div class="col-xs-3 top tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1" alt="">
<p>Grocery Shopping</p>
</div>
</div>
</div>
<br>
<div class="col-xs-12 tiles">
<div class="inner">
<div class="col-xs-6 bottom tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" alt="" class="img1" >
<p>Tailgates</p>
</div>
<div class="col-xs-6 bottom tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" alt="" class="img1">
<p>Order Anything</p>
</div>
</div>
</div>
<div class="slider col-xs-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<!-- Slide one -->
<div class="item active">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download.jpg" alt="">
</div>
<!-- Slide two -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download.jpg" alt="">
</div>
<!--Slide three -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download+(2).jpg" alt="">
</div>
<!--Slide four -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download+(2).jpg" alt="">
</div>
</div>
</div>
</div>
</div>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
This is an issue with other tiles overlapping the containers (z-index issue). You can try something like this:
.tiles {
pointer-events: none;
}
.container {
pointer-events: auto;
}
It is because you have used .tiles class for both .col-xs-12 items which are supposed to be 2 rows of pictures.
.tiles class has top, left properties defined and are position property as absolute. Since both rows of pictures have same top and left positions from .tiles, the second one overlaps the first.
This is why hover will never happen for .container normally. hover is always happening for the second row which is on top even though 1st row is visible below.
Related
I'm trying to accomplish something that looks like this, using Bootstrap 4 and css:
What I have so far is this css:
.inner-circle {
display: block;
height: 70px;
width: 70px;
line-height: 70px;
-moz-border-radius: 50%; /* or 50% */
border-radius: 50%; /* or 50% */
background-color: #d2e4ff;
text-align: center;
font-size: 2em;
}
.outer-circle {
display: block;
height: 90px;
width: 90px;
line-height: 90px;
-moz-border-radius: 50%; /* or 50% */
border-radius: 50%; /* or 50% */
background-color: #e7f1ff;
text-align: center;
font-size: 2em;
}
and then this html:
<div class="container" style="margin-top: 50px;">
<div class="row">
<div class="col-sm-6">
<div class="row" class="h-100">
<div class="col-sm-2 h-100">
<span class="outer-circle mx-auto my-auto">
<span class="inner-circle mx-auto my-auto">
<img src="images/breakfast.svg" height="40" width="40" />
</span>
</span>
</div>
<div class="col-sm-10 my-auto">
<h4 class="display5">Cool stuff</h4>
</div>
</div>
</div>
<div class="col-sm-6"></div>
</div>
</div>
That gets me here:
Which is not quite what I want. I have been unsuccessful with trying to get the image centered within the inner circle and then the inner circle centered within the outer circle. Is this something that is easily achievable, or should I just try to make the whole thing as an image and then just insert that image?
You can use flex to center align vertically and horizontally.
.inner-circle {
display: flex;
align-items: center;
justify-content: center;
height: 70px;
width: 70px;
-moz-border-radius: 50%;
border-radius: 50%;
background-color: #d2e4ff;
}
.outer-circle {
display: flex;
align-items: center;
justify-content: center;
height: 90px;
width: 90px;
-moz-border-radius: 50%;
border-radius: 50%;
background-color: #e7f1ff;
}
<div class="container" style="margin-top: 50px;">
<div class="row">
<div class="col-sm-6">
<div class="row" class="h-100">
<div class="col-sm-2 h-100">
<span class="outer-circle mx-auto my-auto">
<span class="inner-circle mx-auto my-auto">
A
</span>
</span>
</div>
<div class="col-sm-10 my-auto">
<h4 class="display5">Cool stuff</h4>
</div>
</div>
</div>
<div class="col-sm-6"></div>
</div>
</div>
A number of ways to do this. This uses absolute positioning for the inner circle.
.inner-circle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: block;
height: 70px;
width: 70px;
line-height: 70px;
-moz-border-radius: 50%;
/* or 50% */
border-radius: 50%;
/* or 50% */
background-color: #d2e4ff;
text-align: center;
font-size: 2em;
}
.outer-circle {
display: block;
height: 90px;
width: 90px;
line-height: 90px;
position: relative;
-moz-border-radius: 50%;
/* or 50% */
border-radius: 50%;
/* or 50% */
background-color: #e7f1ff;
text-align: center;
font-size: 2em;
}
<div class="container" style="margin-top: 50px;">
<div class="row">
<div class="col-sm-6">
<div class="row" class="h-100">
<div class="col-sm-2 h-100">
<span class="outer-circle mx-auto my-auto">
<span class="inner-circle mx-auto my-auto">
<img src="https://www.iconsdb.com/icons/preview/tropical-blue/stackoverflow-6-xxl.png" height="40" width="40" />
</span>
</span>
</div>
<div class="col-sm-10 my-auto">
<h4 class="display5">Cool stuff</h4>
</div>
</div>
</div>
<div class="col-sm-6"></div>
</div>
</div>
I have a modal album which shows images with different sizes. My pbolem is that how to style the navigation arrows, so that they appear at the middle of the page, no matter what is the size of the image. Here is my code:
<div class="row img-box">
<div class="col-1">
<span #click="nextImg(-1)" class="nav-arrow">❮</span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" :src=" getImgUrl(currentMediaUrl)">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow">❯</span>
</div>
</div>
And here is the relevant css:
.modal-img {
max-height: 1080px;
}
.img-box {
display: flex;
align-items:center;
}
.nav-arrow {
font-size: 3em;
position: absolute;
top: 50%;
}
But whatever I tweak the CSS can not get the desired effect. Hence the question.
Use position fixed
.modal-img {
max-height: 1080px;
}
.img-box {
display: flex;
align-items:center;
justify-content: center;
}
.nav-arrow {
font-size: 3em;
position: fixed;
top: 120px;
}
.nav-left {
left: 10px;
}
.nav-right {
right: 10px;
}
<div class="row img-box">
<div class="col-1">
<span #click="nextImg(-1)" class="nav-arrow nav-left">❮</span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" src="https://via.placeholder.com/500C/O https://placeholder.com/">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow nav-right">❯</span>
</div>
</div>
you need to apply transform: translateY(-50%) on arrow container's, in order to put the arrows in the center.
.nav-arrow {
font-size: 3em;
position: absolute;
top: 50%;
transform: translateY(-50%)
}
or simply, remove position: absolute; top: 50%;
Does this works for you? I have added the bootstrap class align-items-center and some padding to spans
.modal-img {
max-height: 1080px;
}
.nav-arrow {
font-size: 3em;
position: relative;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row img-box align-items-center">
<div class="col-1 ">
<span #click="nextImg(-1)" class="nav-arrow pt-5 d-inline-block">❮</span>
</div>
<div class="col-9 text-center">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" src="https://via.placeholder.com/100/O https://placeholder.com/">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow pt-5 d-inline-block">❯</span>
</div>
</div>
I am working to make video section look like something similar to below design
i am facing two design breaks in the right side
thumbnail doesn't fill the "vp-hqdefault-w" it shows part of image and rest of it is hidden.
second i am not able to align video title next to thumbnail as show in image
<div class="container">
<div class="row content">
<div class="col-md-7 col-sm-6">
<div class="active-iframe-wrapper video-embed-container">
<iframe id='activeIFrame' class='active-iframe' width='100%' height='324' src="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1" ></iframe>
</div>
<p>Title of the video</p>
</div>
<div class="col-md-5 col-sm-6">
<a class="" href="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/SCRUg5s389Q/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road One</h3>
</div>
</a>
<a class="" href="http://www.youtube.com/embed/QThP5kDUJJ0?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/QThP5kDUJJ0/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Two</h3>
</div>
</a>
<a class="" href="http://www.youtube.com/embed/xIOP1PLjUTs?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/xIOP1PLjUTs/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Three</h3>
</div>
</a>
</div>
</div>
Codepen link
I am trying to make it responsive to it doesnt break
You are having this issue because you didn't add float:left property to the video thumnail div. Try this code.
.vp-video-img-w {
position: relative;
overflow: hidden;
float: left;
margin-right: 10px;
width: 30%;
}
Try below code:
.header {
padding-top: 20px;
padding-bottom: 20px;
}
.video-embed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
margin-bottom: 0px;
}
.active-iframe-wrapper {
float: left;
width: 100%;
background-color: #f5f5f5;
}
.video-embed-container iframe, .embed-container object, .embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-item-w{
background-color:#ccc;
}
.vp-hqdefault-w {
max-height: 80px;
max-width: 120px;
overflow: hidden;
position: relative;
width:30%;
}
.vp-video-img-w {
position: relative;
width: 30%;
overflow: hidden;
float: left;
}
.vp-video-details{
width:70%;
float:left;
}
.vp-video-img-w img {
max-width: 100%;
}
.video-thumbnail:after {
content: '';
display: block;
clear:both;
}
.footer {
border-top: 1px solid #444;
padding-top: 20px;
margin-top: 20px;
color: #999
}
.p {
text-align: center;
padding-top: 120px;
}
.p a {
text-decoration: underline;
color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row content">
<div class="col-md-7 col-sm-6">
<div class="active-iframe-wrapper video-embed-container">
<iframe id='activeIFrame' class='active-iframe' width='100%' height='324' src="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1" ></iframe>
</div>
<p>Title of the video</p>
</div>
<div class="col-md-5 col-sm-6">
<a class="video-thumbnail" href="http://www.youtube.com/embed/SCRUg5s389Q?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/SCRUg5s389Q/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road One</h3>
</div>
</a>
<a class="video-thumbnail" href="http://www.youtube.com/embed/QThP5kDUJJ0?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/QThP5kDUJJ0/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Two</h3>
</div>
</a>
<a class="video-thumbnail" href="http://www.youtube.com/embed/xIOP1PLjUTs?showinfo=0&modestbranding=1">
<div class="vp-video-img-w vp-hqdefault-w">
<img src="http://img.youtube.com/vi/xIOP1PLjUTs/hqdefault.jpg" title="">
</div>
<div class="vp-video-details">
<h3 class="video-title">Mr. Bean is back on the road Three</h3>
</div>
</a>
</div>
</div>
Change
.vp-video-img-w {
position: relative;
width: 100%;
overflow: hidden;
}
to
.vp-video-img-w {
position: relative;
width: 100%;
overflow: hidden;
float: left;
}
For my portfolio site I am making I have it so when you hover over the portfolio image it overlays the title and category. My problem is the overlay section is picking up the margin and padding for the spacing of the images in the grid. I cant get it to be whatever the portfolio image size is without removing the gutter between the images.
Example below:
Not sure how to fix this and any help would be appreciated.
.thumbnail {
padding: 0px !important;
margin-bottom: 25px;
border: none;
border-radius: 0;
display: block;
}
.thumbnail img {
width: 100%;
height: 100%;
margin-bottom: 0px;
display: block;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
padding: 0px 0px 0px 0px;
transition: .5s ease;
background-color: rgba(136, 24, 38, 0.6);
}
.thumbnail:hover .overlay {
opacity: 1;
height: 100%;
width: 100%;
}
.text {
color: white;
font-size: 20px;
position: absolute;
width: 70%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
<section id="work" class="bg-grey">
<div class="container-fluid text-center">
<h2>MY WORK</h2>
<!--<h4>What we have created</h4>-->
<div class="row text-center">
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="images/portfolio-img1.jpg" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="images/portfolio-img1.jpg" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="images/portfolio-img1.jpg" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</section>
When you use a absolute positioned element, always set the respective relative, position element. Let me know if you have any issues with the output.
The only CSS change is to the below class. Where I have added the property position: relative.
.thumbnail {
padding: 0px !important;
position: relative;
margin-bottom: 25px;
border: none;
border-radius: 0;
display: block;
}
So your absolute positioned div with class overlay will be positioned with respect to the div with class thumbnail
.thumbnail {
padding: 0px !important;
position: relative;
margin-bottom: 25px;
border: none;
border-radius: 0;
display: block;
}
.thumbnail img {
width: 100%;
height: 100%;
margin-bottom: 0px;
display: block;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
padding: 0px 0px 0px 0px;
transition: .5s ease;
background-color: rgba(136, 24, 38, 0.6);
}
.thumbnail:hover .overlay {
opacity: 1;
height: 100%;
width: 100%;
}
.text {
color: white;
font-size: 20px;
position: absolute;
width: 70%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<section id="work" class="bg-grey">
<div class="container-fluid text-center">
<h2>MY WORK</h2>
<!--<h4>What we have created</h4>-->
<div class="row text-center">
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="http://lorempixel.com/100/100/" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="http://lorempixel.com/100/100/" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="http://www.google.com/">
<div class="thumbnail">
<img src="http://lorempixel.com/100/100/" alt="PORTFOLIO NAME">
<div class="overlay">
<div class="text">
<h4>PORTFOLIO NAME</h4>
<p>category</p>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</section>
Sorry if this is a duplicate question, but I couldn't find an exact match to this which worked, so here it goes.
I have a web page with divs for each database entry. However, the div doesn't resize with text, causing the text to display out of div. I'm using bootstrap.
I've attached a fiddle.
Increase the width of the fiddle output to see the overflowing text.
Currently, i'm working on just the desktop version, but i'll have to build a mobile version as well. So it'll be better if you can help me out with both :)
Below is my code
.each-entry-box {
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header {
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
position: absolute;
padding: 2px;
}
.main-content {
margin: 15px;
top: 30px;
position: relative;
width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="each-entry-box">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>
Here's a working JS Fiddle,
I've floated both divs and removed the absolute positioning, I've also changed the background colour from the parent element to the child element, so as the list grows, the background will too
HTML:
<div class="each-entry-box">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>
CSS:
.each-entry-box{
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header{
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
/* position: absolute; */
padding: 2px;
float: left;
}
.main-content{
/* margin: 15px; */
/* top: 30px; */
/* position: relative; */
width: 100%;
background: #F5F5F5;
float: left;
clear: left;
}
.main-content should not have relative position. For mobile responsive styles, you can use col-sm- and col-xs-:
.each-entry-box {
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header {
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
position: absolute;
padding: 2px;
}
.main-content {
margin: 15px;
margin-top: 25px;
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="each-entry-box row">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name col-sm-9 col-xs-8">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on col-sm-3 col-xs-4">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile col-sm-3">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email col-sm-9">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>