I am having hard time, to understand why sticky div does not push other sticky div.
And I am pretty sure I have seen it working like that, but I can't figure that out.
I want Header 1 to push Header 2 not overlap on it.
HTML
<div class="header">
<h1>Header 1</h1>
</div>
<div class="item">
<h1>Item1</h1>
</div>
<div class="item">
<h1>Item2</h1>
</div>
<div class="header">
<h1>Header 2</h1>
</div>
<div class="item">
<h1>Item1</h1>
</div>
<div class="item">
<h1>Item2</h1>
</div>
CSS
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
color: #000;
font: bold 20vw Helvetica, Arial, sans-serif;
}
.header {
position: sticky;
top: 0px;
height: 100%;
width: 100%;
background: white;
}
.item {
height: 100vh;
width: 100%;
background: #00f;
}
Here is an example and what I am trying to do.
https://jsfiddle.net/7zfq491o/
You need different wrapper:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
color: #000;
font: bold 20vw Helvetica, Arial, sans-serif;
}
.header {
position: sticky;
top: 0px;
background: white;
}
.item {
height: 100vh;
background: #00f;
}
<section>
<div class="header">
<h1>Header 1</h1>
</div>
<div class="item">
<h1>Item1</h1>
</div>
<div class="item">
<h1>Item2</h1>
</div>
</section>
<section>
<div class="header">
<h1>Header 2</h1>
</div>
<div class="item">
<h1>Item1</h1>
</div>
<div class="item">
<h1>Item2</h1>
</div>
</section>
I have a problem with position when I scroll one row to the right. Code: https://codepen.io/olastanislawska/pen/GRqooyG (mobile view). Scroll first row to the right and highlight movies class in the first row, then the second row. In the first something is missing, I dont know how to fix that.
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: #rich_clark
*/
html,
body,
div,
span,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
abbr,
address,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
samp,
small,
strong,
sub,
sup,
var,
b,
i,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
a {
margin: 0;
padding: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
/* change colours to suit your needs */
ins {
background-color: #ff9;
color: #000;
text-decoration: none;
}
/* change colours to suit your needs */
mark {
background-color: #ff9;
color: #000;
font-style: italic;
font-weight: bold;
}
del {
text-decoration: line-through;
}
abbr[title],
dfn[title] {
border-bottom: 1px dotted;
cursor: help;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* change border colour to suit your needs */
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #cccccc;
margin: 1em 0;
padding: 0;
}
input,
select {
vertical-align: middle;
}
#app {
height: 100%;
position: relative;
font-family: Arial, Helvetica, sans-serif;
overflow: hidden;
}
#app::after {
content: '';
top: 0%;
right: 0%;
bottom: 0%;
left: 0%;
z-index: -1000;
background-image: url(../../markus-spiske-QmEF-d1HQVI-unsplash.jpg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: fixed;
-webkit-filter: blur(10px);
filter: blur(10px);
}
#movies .categories {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
padding: 15;
}
#movies .categories .category {
position: relative;
margin: 15px;
}
#movies .categories .category .movies {
overflow-x: auto;
white-space: nowrap;
width: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
#movies .categories .category .movies .movie {
min-width: 90%;
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
margin: 5%;
position: relative;
text-align: center;
overflow-y: hidden;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
#media (min-width: 350px) {
#movies .categories .category .movies .movie {
min-width: calc(50%);
}
}
#movies .categories .category .movies .movie.active {
color: #fff;
}
#movies .categories .category .movies .movie.active .image::after {
content: '';
top: 0%;
right: 0%;
bottom: 0%;
left: 0%;
background-color: rgba(54, 54, 54, 0.75);
position: absolute;
border: 2px solid deeppink;
}
#movies .categories .category .movies .movie.active .title {
position: absolute;
top: 5%;
width: 100%;
}
#movies .categories .category .movies .movie.active .content {
position: absolute;
bottom: 5%;
width: 100%;
}
#movies .categories .category .movies .movie.active .content button {
background-color: deeppink;
border: none;
border-radius: 4px;
margin: 10px 0;
padding: 5px 10px;
text-transform: uppercase;
-webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
cursor: pointer;
}
#movies .categories .category .movies .movie .image {
width: 100%;
height: 200px;
background: red;
}
#movies .categories .category .movies .movie .title {
position: absolute;
top: -100%;
width: 100%;
}
#movies .categories .category .movies .movie .content {
position: absolute;
bottom: -100%;
width: 100%;
}
.slider-btns {
position: absolute;
right: 15px;
}
.slider-btns i {
font-size: 22px;
cursor: pointer;
}
#navigation {
padding: 15px 0;
margin: 0 10px;
overflow-x: scroll;
}
#navigation ul.nav {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 16px;
}
#navigation ul.nav li {
padding: 5px 15px;
}
#navigation ul.nav li.active {
background-color: deeppink;
border-radius: 25px;
font-weight: bold;
-webkit-box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
margin-left: 5px;
}
#slider {
width: 100vw;
height: 75vh;
margin: 0 auto;
position: relative;
z-index: 1000;
}
#slider::before {
content: '';
top: 0%;
right: 0%;
bottom: 0%;
left: 0%;
position: absolute;
background: black;
background: -webkit-gradient(linear, left bottom, left top, from(black), color-stop(25%, rgba(0, 0, 0, 0.8)), to(rgba(0, 0, 0, 0)));
background: linear-gradient(0deg, black 0%, rgba(0, 0, 0, 0.8) 25%, rgba(0, 0, 0, 0) 100%);
}
#slider .logo {
padding: 15px;
position: absolute;
font-family: 'Dancing Script', cursive;
font-size: 30px;
color: #fff;
text-shadow: 0 0 10px deeppink;
}
#slider .image {
height: 100%;
background-image: url(../../markus-spiske-QmEF-d1HQVI-unsplash.jpg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
#slider .content {
position: absolute;
bottom: 10%;
right: 5%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: end;
-ms-flex-align: end;
align-items: flex-end;
}
#slider .content .title {
width: 100%;
}
#slider .content .title h3 {
text-align: center;
color: deeppink;
min-width: 100px;
padding: 5px;
border-radius: 10px;
font-size: 18px;
margin: 10px 0;
}
#slider .content .description {
max-width: 100%;
position: relative;
overflow-wrap: break-word;
}
#slider .content .description p {
text-align: center;
color: #fff;
font-size: 14px;
background: -webkit-linear-gradient(#eee, #333);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
-webkit-text-fill-color: transparent;
}
#slider .content button {
background-color: deeppink;
border: none;
border-radius: 4px;
margin: 10px 0;
padding: 5px 10px;
text-transform: uppercase;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
cursor: pointer;
-webkit-box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
}
/*# sourceMappingURL=main.css.map */
<body>
<div id="app">
<div id="slider">
<div class="logo">MovieApp</div>
<div class="image"></div>
<div class="content">
<div class="title"><h3>- Title -</h3></div>
<div class="description">
<p>
description description description description description
description description description description description
description description description description description
description description description description description
description description description description description
description description description description description
description description description description description
description description description description description
description description description description description
description description description
</p>
</div>
<button>More</button>
</div>
</div>
<div id="navigation">
<ul class="nav">
<li data-category="top" class="nav-item active">Top</li>
<li data-category="comedy" class="nav-item">Comedy</li>
<li data-category="horror" class="nav-item">Horror</li>
<li data-category="documentary" class="nav-item">Documentary</li>
<li data-category="thriller" class="nav-item">Thriller</li>
<li data-category="musical" class="nav-item">Musical</li>
</ul>
<div class="search"></div>
</div>
<div id="movies">
<div class="slider-btns">
<i class="fa fa-angle-left"></i>
<i class="fa fa-angle-right"></i>
</div>
<div class="categories">
<div data-category="comedy" class="category">
<div class="movies">
<div data-item="1" class="movie active">
<div class="image"></div>
<div class="title">Title 1</div>
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
<div data-item="2" class="movie">
<div class="image"></div>
<div class="title">Title 2</div>
<div class="content">Content</div>
</div>
<div data-item="3" class="movie">
<div class="image"></div>
<div class="title">Title 3</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="4" class="movie">
<div class="image"></div>
<div class="title">Title 4</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="5" class="movie">
<div class="image"></div>
<div class="title">Title 5</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
</div>
</div>
<div data-category="horror" class="category">
<div class="movies">
<div data-item="1" class="movie">
<div class="image"></div>
<div class="title">Title 1</div>
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
<div data-item="2" class="movie">
<div class="image"></div>
<div class="title">Title 2</div>
<div class="content">Content</div>
</div>
<div data-item="3" class="movie">
<div class="image"></div>
<div class="title">Title 3</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="4" class="movie">
<div class="image"></div>
<div class="title">Title 4</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="5" class="movie">
<div class="image"></div>
<div class="title">Title 5</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
</div>
</div>
<div data-category="documentary" class="category">
<div class="movies">
<div data-item="1" class="movie">
<div class="image"></div>
<div class="title">Title 1</div>
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
<div data-item="2" class="movie">
<div class="image"></div>
<div class="title">Title 2</div>
<div class="content">Content</div>
</div>
<div data-item="3" class="movie">
<div class="image"></div>
<div class="title">Title 3</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="4" class="movie">
<div class="image"></div>
<div class="title">Title 4</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="5" class="movie">
<div class="image"></div>
<div class="title">Title 5</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
</div>
</div>
<div data-category="thriller" class="category">
<div class="movies">
<div data-item="1" class="movie">
<div class="image"></div>
<div class="title">Title 1</div>
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
<div data-item="2" class="movie">
<div class="image"></div>
<div class="title">Title 2</div>
<div class="content">Content</div>
</div>
<div data-item="3" class="movie">
<div class="image"></div>
<div class="title">Title 3</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="4" class="movie">
<div class="image"></div>
<div class="title">Title 4</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="5" class="movie">
<div class="image"></div>
<div class="title">Title 5</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
</div>
</div>
<div data-category="musical" class="category">
<div class="movies">
<div data-item="1" class="movie">
<div class="image"></div>
<div class="title">Title 1</div>
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
<div data-item="2" class="movie">
<div class="image"></div>
<div class="title">Title 2</div>
<div class="content">Content</div>
</div>
<div data-item="3" class="movie">
<div class="image"></div>
<div class="title">Title 3</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="4" class="movie">
<div class="image"></div>
<div class="title">Title 4</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
<div data-item="5" class="movie">
<div class="image"></div>
<div class="title">Title 5</div>
<div class="content">
<div class="content">
<p>Content</p>
<button>More</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
Whenever I'm trying to change .tea to display: block; all the images change their position from being horizontal, to being vertical
How to position it the correct way so the images keep being horizontally aligned and the text will be underneath
.tea {
display: inline-flex;
margin-left: 225px;
padding: 20px;
justify-content: center;
}
.tea h4 {
display: inline-block;
position: relative;
text-align: center;
}
.tea2 {
display: inline-flex;
margin-left: 385px;
}
.tea img {
width: 300px;
height: 200px;
padding: 25px;
border-radius: 15px;
}
.tea2 img {
width: 300px;
height: 200px;
padding: 30px;
}
<div class="tea">
<img class="1" src="https://via.placeholder.com/150">
<h4>Myrtle Ave</h4>
<img class="2" src="https://via.placeholder.com/150">
<h4>Spiced rum</h4>
<img class="3" src="https://via.placeholder.com/150">
<h4>Berry Blitz</h4>
</div>
<div class="tea2">
<img class="1" src="https://via.placeholder.com/150">
<img class="2" src="https://via.placeholder.com/150">
</div>
You should do it like this
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
#gallery {
display: flex;
flex-wrap: wrap;
}
#gallery .image-container {
width: 25%;
background-color: lightgreen;
border-radius: 5px;
padding: 5px;
box-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
}
#gallery img {
width: 100%;
}
#gallery .title {
font: bold 24px monospace;
text-align: center;
color: white;
margin: 2%;
}
<div id="gallery">
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 1</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 2</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 3</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 4</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 5</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 6</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 7</p>
</div>
<div class="image-container">
<img src="https://openclipart.org/image/800px/svg_to_png/321159/hotwork-sign-arvin61r58.png">
<p class="title">Image 8</p>
</div>
</div>
You need to change you HTML to support what you want. Use a container wrapper around the image and image text.
Example: https://jsfiddle.net/Lqupmf5s/
<div class="tea">
<div class="img-container">
<img class="1" src="32131">
<h4>Myrtle Ave</h4>
</div>
<div class="img-container">
<img class="2" src="3213">
<h4>Spiced rum</h4>
</div>
<div class="img-container">
<img class="3" src="3213">
<h4>Berry Blitz</h4>
</div>
</div>
.tea {
display: inline-flex;
/* margin-left: 225px; */
padding: 20px;
justify-content: center; }
.tea h4{
display: inline-block;
position: relative;
text-align: center; }
.tea2 {
display: inline-flex;
margin-left: 385px; }
.tea img {
width: 300px;
height: 200px;
/* padding: 25px; */
border-radius: 15px; }
.tea2 img {
width: 300px;
height: 200px;
padding: 30px; }
I used CSS property display: flex. My content div's are not equal.
right now it looks like:
I want to make it look like so:
HTML
<div class="poplar-boxes">
<div class="popular-boxes-devider"></div>
</div>
<div class="poplar-boxes">
<div class="popular-boxes-devider">
</div>
CSS
.poplar-boxes {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: stretch;
}
.popular-boxes-devider {
flex-basis: 30%
}
Here is a JS Fiddle
Your flex item are the same in height ( popular-boxes-devider ) . The problem is that you set the border to .info which are not equal in height.
The trick is to get them equal. You need to calculate their height depending on their margin top, padding and height of the round circle above them
See snippet below
/* Added styles */
.effect2,
.icon {
height: 100%;
}
.info {
height: calc(100% - 72px);
box-sizing: border-box;
}
.popular-boxes-devider {
margin-bottom: 15px;
}
/* end Added styles */
.poplar-boxes {
min-height: 100%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.popular-boxes-devider {
flex-basis: 30%;
}
.box > .icon {
text-align: center;
position: relative;
background: #fff;
}
.box > .icon > .image {
position: relative;
z-index: 2;
margin: auto;
width: 88px;
height: 88px;
border: 4px solid white;
line-height: 88px;
border-radius: 50%;
background: #2c2c2c;
vertical-align: middle;
}
.box > .icon:hover > .image {
background: #6CB4C4;
}
.box > .icon > .image > i {
font-size: 36px !important;
color: #fff !important;
}
.box > .icon:hover > .image > i {
color: white !important;
}
.box > .icon > .info {
margin-top: -24px;
background: rgba(44, 44, 44, 0.09);
border: 1px solid #2c2c2c;
padding: 15px 0 10px 0;
}
.box > .icon:hover > .info {
background: rgba(0, 0, 0, 0.04);
border-color: #e0e0e0;
color: white;
}
.box > .icon > .info > h3.title {
font-size: 21px;
font-family: "Quicksand", sans-serif !important;
font-size: 28px;
color: #222;
font-weight: 500;
padding-top: 14px;
}
.box > .icon > .info > p {
font-size: 15px;
color: #666;
line-height: 1.5em;
margin: 20px 10px;
text-align: justify;
}
.box > .icon > .info > .more a {
font-family: "Quicksand", sans-serif !important;
font-size: 12px;
color: #222;
line-height: 12px;
text-transform: uppercase;
text-decoration: none;
}
.box > .icon:hover > .info > .more > a {
color: #fff;
padding: 6px 8px;
background-color: #63B76C;
}
/* .box .space { height: 2px; background-color: #2c2c2c;} */
.btn-default {
font-family: "Quicksand", sans-serif;
background-color: #75b1ae;
color: #FFFFFF;
}
.btn-default:hover {
background-color: #FFFFFF;
color: black;
}
.box .image img {
width: 58%;
/* vertical-align: sub; */
}
/*==================================================
* Effect 2
* ===============================================*/
.effect2 {
position: relative;
}
.effect2:before,
.effect2:after {
z-index: -1;
position: absolute;
content: "";
bottom: 13px;
left: 10px;
width: 50%;
top: 80%;
max-width: 300px;
background: #777;
box-shadow: 0 15px 10px #777;
transform: rotate(-3deg);
}
.effect2:after {
transform: rotate(3deg);
right: 10px;
left: auto;
}
<div class="poplar-boxes">
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/startup-registration.png" /></div>
<div class="info">
<h3 class="title">Startup Registration</h3>
<p>
SetyourBiz is a leading business setĀup services provider in India with 4% market share in highly unorganized sector of small scale consultants.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/foreign-investment.png" /></div>
<div class="info">
<h3 class="title">Foreign Investment (FDI)</h3>
<p>
Foreign investment is regulated by FEMA act, RBI circulars. Our expert advise and prompt services has what made us a renowned face in such sectors.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/licensing-and-registrations.png" /></div>
<div class="info">
<h3 class="title">Licensing & Registrations</h3>
<p>
It is imperative and mandatory for a start up as well as established business to obtain required licenses in order to legally operate.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/intellectual-property-rights.png" /></div>
<div class="info">
<h3 class="title">Intellectual Property Rights</h3>
<p>
Every business, invention, original creative work and design needs to be legally protected to claim the owner's right and safeguard it from infringement
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/accounting-and-tax.png" /></div>
<div class="info">
<h3 class="title">Accounting & tax</h3>
<p>
Accounting and taxes may be complex for you but it is simple for our expert team of CAs.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/secretarial-services.png" /></div>
<div class="info">
<h3 class="title">Secretarial Services</h3>
<p>
Corporate and economic laws may be cumbursome but not for our team of CS, experience excellence here.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/hr-and-legal.png" /></div>
<div class="info">
<h3 class="title">Legal Services</h3>
<p>
Reply to notices like IP Violation Notice, cheque bounce notice, NRI, Immigration Services and Drafting of Legal Documents, Agreements like vendor engagement agreement, confidentiality.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/hr-and-legal.png" /></div>
<div class="info">
<h3 class="title">Labour Laws & Payroll</h3>
<p>
Registration with Labour Department, Creation of PF / ESIC accounts and payment of dues for employees and monthly compliance of TDS are necessary compliance, rest assured with a fee of Rs. 250 per employees.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
<div class="popular-boxes-devider">
<div class="effect2 box">
<div class="icon">
<div class="image"><img src="images/icon/funding-and-restructuring.png" /></div>
<div class="info">
<h3 class="title">Funding & Restructuring</h3>
<p>
Registration with Labour Department, Creation of PF / ESIC accounts and payment of dues for employees and monthly compliance of TDS are necessary compliance, rest assured with a fee of Rs. 250 per employees.
</p>
</div>
</div>
<div class="space"></div>
</div>
</div>
</div>
#Inderjeet just put
.box > .icon > .info {
height: 25em;
}
or some value that fit you and fix the inside p accordingly
I'm new to CSS and HTML. My code is below. The footer hides a part from the last card. How do I fix this? I also want to know if this is the right way to implement this design or is there a better way?
my code:
http://plnkr.co/edit/iqoLHe46yxK335MsDknN?p=preview
<!DOCTYPE html>
<html>
<head>
<title>First</title>
<script src="jquery-3.1.1.min.js"></script>
<style>
#container{
width: 100%;
padding: 0 0 0 0%;
font-size: 0;
}
.container-header-menu{
position: fixed;
top: 0;
width: 100%;
height: 10%;
padding: 0 0 0 0%;
font-size: 0;
z-index: 10;
}
body {
margin:0px;
}
.header{
position: relative;
top: 0;
width: 100%;
background-color: #182538;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.header-left-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.header-right-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
font-size: 80%;
}
.menu{
display:inline-block;
position:relative;
top: 0;
width: 100%;
background-color: #1F2D48;
margin: 0px;
text-align: center;
font-size: 1rem;
}
.menu-text{
display: inline-block;
color: #FFFFFF;
text-align: left;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
}
.menu-item{
width:13%;
float:left;
padding-right: 12px;
}
.card-list{
position: relative;
top: 100px;
width:13%;
height:83%;
float:left;
padding-right: 12px;
overflow-y: auto;
z-index: 5;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 100%;
margin: 5px;
background-color: #F2F2F2;
z-index: 5;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.card-header{
background-color: #F2F2F2;
}
.card-container {
background-color: #FFFFFF;
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.card-container-header {
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.footer{
position: fixed;
bottom: 0;
margin: 0px;
width: 100%;
height: 6%;
padding: 0 0 0 0%;
z-index: 100;
background-color: #1F2D48;
text-align: center;
}
.footer-left-text{
color: #FFFFFF;
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.footer-right-button{
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
font-family: sans-serif;
font-size: 100%;
background-color: #FFFFFF; /* Green */
border: none;
color: #1F2D48;
padding: 8px 32px;
border-radius: 8px;
margin: 4px;
border: 2px solid #1F2D48;
}
</style>
</head>
<body>
<div id="container">
<!-- header and menu bar container -->
<div class="container-header-menu">
<!-- header -->
<div class="header">
<p class="header-left-text"><strong>Lead Tracking:</strong> John Smith</p>
<p class="header-right-text">Monday, November 19, 2016</p>
</div>
<!-- menubar -->
<div class="menu">
<div class ="menu-item">
<p class="menu-text">Mapping</p>
</div>
<div class ="menu-item">
<p class="menu-text">Geology</p>
</div>
<div class ="menu-item">
<p class="menu-text">Engineering</p>
</div>
<div class ="menu-item">
<p class="menu-text">Negotiating</p>
</div>
<div class ="menu-item">
<p class="menu-text">Deal</p>
</div>
<div class ="menu-item">
<p class="menu-text">Rejected</p>
</div>
<div class ="menu-item">
<p class="menu-text">Pass</p>
</div>
</div>
</div>
<!-- card list for mapping-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
</div>
<!-- card list for engineering-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:orange; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
</div>
</div>
<div class="footer">
<p class="footer-left-text"><strong>Footer</strong></p>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">status</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">map</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">details</button>
</div>
</body>
</html>
Pastie Link
You can fix it by adding margin-bottom to class .card-list and it must be equals to the height of your footer.
so just add margin-bottom:6%;since 6% is the height of your footer.
You can add to your .card-list css;
margin-bottom:100px;
This provides a margin for the bottom of the area, so it doesn't overlap with any other elements.
Hope it helps!
Edit*
Chillers' answer is much better compared to mine, as it compensates for scaling between resolutions and devices.