CSS Hover List doesn't work - html

I have created a list of html lists which has an image and a text on the right.
I was trying to put a border on the top and bottom of each item list. And I also did try to remove the border at the top for the first child and the border bottom on the last child to make it equal.
Then I added a hover effect that will hover on each list and whenever active. However for some reason this is not working and the padding and border for each item is all mess up.
Tried my best to play around my boxes but still having a hard time fixing it.
Here's my CSS:
body{
color: #fff;
}
ul li {
list-style: none;
display: block;
clear: both;
}
.puff-list {
background-color: #34495e;
width: 260px;
float: left;
}
.puff-list .puffs h2{
text-align: center;
border-bottom: 1px solid #57789a;
padding: 20px 30px 35px 20px;
font-size: 23px;
font-weight: 400;
}
.puff-list .fa-puffs {
position: relative;
left: -25px;
color: #34495e;
}
.puff-list ul {
/*padding: 20px 40px;*/
padding: 0;
}
.puff-list ul li {
display: block;
list-style: none;
border-bottom: 1px solid #57789a;
padding-left: 39px;
padding-top: 15px;
}
.puff-list ul li:first-child{
border-top: none;
}
.puff-list ul li:last-child{
border-bottom: 1px solid #57789a;
}
.puff-list ul li:hover{
background-color: #5b7b9b;
cursor: pointer;
}
.puff-list .puff-details {
float: left;
margin-top: 8px;
}
.puff-list img {
margin-right: 5px;
float: left;
}
.puff-list .puff-details {
padding-left: 8px;
}
.puff-list .status {
color: #658aaf;
}
You can view the whole HTML and CSS playground on JSFIDDLE: https://jsfiddle.net/9b6w9L6m/
Any idea how can I fix this?

First you need to fix some things.
You have a float: left on your .puff-details which isn't needed, since you aren't floating any other elements on that line, so remove that.
The elements inside .puff-details are floated, which makes the "float outside" the element. Therefor you need to add the clearfix solution to make .puff-details expand:
.puff-list .puff-details {
/*float: left; < remove this line */
margin-top: 8px;
}
.puff-list .puff-details:after {
content: " ";
display: block;
height: 0;
clear: both;
}
The border on the first and last item are already working.
Complete code:
body {
color: #fff;
}
ul li {
list-style: none;
display: block;
clear: both;
}
.puff-list {
background-color: #34495e;
width: 260px;
float: left;
}
.puff-list .puffs h2 {
text-align: center;
border-bottom: 1px solid #57789a;
padding: 20px 30px 35px 20px;
font-size: 23px;
font-weight: 400;
}
.puff-list .fa-puffs {
position: relative;
left: -25px;
color: #34495e;
}
.puff-list ul {
/*padding: 20px 40px;*/
padding: 0;
}
.puff-list ul li {
display: block;
list-style: none;
border-bottom: 1px solid #57789a;
padding-left: 39px;
padding-top: 15px;
}
.puff-list ul li:first-of-type {
border-top: none;
}
.puff-list ul li:last-child {
border-bottom: 1px solid #57789a;
}
.puff-list ul li:hover {
background-color: #5b7b9b;
cursor: pointer;
}
.puff-list .puff-details {
/*float: left;*/
margin-top: 8px;
}
.puff-list .puff-details:after {
content: " ";
display: block;
height: 0;
clear: both;
}
.puff-list img {
margin-right: 5px;
float: left;
}
.puff-list .puff-details {
padding-left: 8px;
}
.puff-list .status {
color: #658aaf;
}
<aside class="puff-list" id="puff-list">
<div class="puffs">
<h2> <i class="fa fa-address-book-o"></i> Check List</h2>
</div>
<ul>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Food</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Russian</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Honey</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Mox</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Party</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Event</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Rrose</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">test</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="https://i.imgur.com/3I9Odgf.jpg" />
<div class="puff-details">
<div class="puff-name">Manga</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
</ul>
</aside>

You must add pseudo class for li like this
body{
color: #fff;
}
ul li {
list-style: none;
display: block;
clear: both;
}
.puff-list {
background-color: #34495e;
width: 260px;
float: left;
}
.puff-list .puffs h2{
text-align: center;
border-bottom: 1px solid #57789a;
padding: 20px 30px 35px 20px;
font-size: 23px;
font-weight: 400;
}
.puff-list .fa-puffs {
position: relative;
left: -25px;
color: #34495e;
}
.puff-list ul {
/*padding: 20px 40px;*/
padding: 0;
}
.puff-list ul li {
display: block;
list-style: none;
border-bottom: 1px solid #57789a;
padding-left: 39px;
padding-top: 15px;
}
.puff-list ul li:first-child{
border-top: none;
}
.puff-list ul li:last-child{
border-bottom: 1px solid #57789a;
}
.puff-list ul li:hover{
background-color: #5b7b9b;
cursor: pointer;
}
.puff-list ul li::after {
display: block;
content: "";
clear: both;
}
.puff-list .puff-details {
float: left;
margin-top: 8px;
}
.puff-list img {
margin-right: 5px;
float: left;
}
.puff-list .puff-details {
padding-left: 8px;
}
.puff-list .status {
color: #658aaf;
}
<aside class="puff-list" id="puff-list">
<div class="puffs">
<h2> <i class="fa fa-address-book-o"></i> Check List</h2>
</div>
<ul>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Food</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Russian</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Honey</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Mox</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Party</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Event</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Rrose</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">test</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li>
<img src="http://lorempixel.com/40/20" />
<div class="puff-details">
<div class="puff-name">Manga</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
</ul>
</aside>

Have you tried adding and removing border on the first and last child?
.puff-list ul li {
display: block;
list-style: none;
border-bottom: 1px solid #57789a;
padding-left: 39px;
padding-top: 15px;
}
.puff-list ul li:first-child{
border-top: none;
}
.puff-list ul li:last-child{
border-bottom: 1px solid #57789a;
}
And also try using shorthand padding instead of dividing them.

Related

How to create label on the top of image listing like Zomato in bootstrap 4

I'm trying to create a Zomato like restaurant listing in bootstrap. On your left-hand side is the bootstrap card that I created so far, and on the right which I want to implement.
But the problem is I don't know how to embed badges on the restaurant image like below.
Sorry to say but I'm not that much expert in bootstrap. Any guidance would be appreciated.
.featured-rating-green {
background: #46cd38 !important;
}
.featured-rating,
.featured-rating-orange,
.featured-rating-green {
position: absolute;
right: 10px;
width: 60px;
height: 60px;
text-align: center;
margin: -33px 10px 0 0;
font-size: 23px;
background: #ff7474;
color: #fff;
padding: 14px;
border-radius: 50%;
}
.featured-place-wrap {
background: #fff;
margin: 0 0 30px;
border: 1px solid #ccc;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
position: relative;
}
.border-upper-radius {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.border-downer-radius {
border-bottom: 1px solid #bdbdbd;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
/**futer title box styling */
.featured-title-box {
padding: 22px 14px;
}
.featured-title-box h6 {
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
margin-bottom: 5px;
}
.featured-title-box p {
color: #9fa9b9;
display: inline-block;
margin: 0;
}
.featured-place-wrap a {
display: inline;
text-decoration: none;
color: #000;
}
.featured-title-box p span {
color: #ffb006;
padding: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="row justify-content-center light-bg mt-3">
<div class="col-sm-6 col-lg-4 col-xl-4 featured-responsive">
<div class="featured-place-wrap border-upper-radius border-downer-radius">
<a href="#">
<img src="https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg" class="img-fluid border-upper-radius" alt="#">
<span class="featured-rating-green">5.0</span>
<div class="featured-title-box">
<h6>PJ’s Midway</h6>
<p>
1 Reviews </p>
<span> • </span>
<p>
<span>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i> </span>
</p>
<ul>
<li><span class="fas fa-map-marked-alt"></span>
<p data-toggle="tooltip" data-placement="top" title="" data-original-title="901 6 Ave E, Prince Rupert, BC V8J 1X7, Canada">901 6 Ave E, Prince Rupert, BC...</p>
</li>
<li><span class="fas fa-mobile"></span>
<p> +12506242100</p>
</li>
<li><span class="fas fa-biking"></span>
<p> $2.99 Approx</p>
</li>
</ul>
<div class="bottom-icons">
<div class="badge badge-pill badge-danger">CLOSE NOW</div>
</div>
</div>
</a>
</div>
</div>
</div>
You can use CSS to solve your problem by using the positions in your styles. Consider the tag where the photo is located as the parent tag and set its position as a relative value. Think of them in the picture as their children and give them an absolute apology and adjust the position of the children relative to their parent by giving the value to the top / bottom / right / left of the children.
For more information, refer to the following link:
CSS Layout - The position Property
div.relative {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;
}
div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;
}
<div class="relative">This div element has position: relative;
<div class="absolute">This div element has position: absolute;</div>
</div>
You needed to clean image without label, your last image stretch, so, image label showing extra height also image.
you can set extra label any and it's positioned to image. here example:
update your html:
<div class='image-wrapper'>
<img src="https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg" class="img-fluid border-upper-radius" alt="#">
<p class="top-text">top text</p>
<p class="bottom-text">bottom label</p>
<p class="bottom-right-text">bottom label</p>
</div>
add new styles
.image-wrapper {
position: relative;
}
.image-wrapper .bottom-text,
.image-wrapper .bottom-right-text,
.image-wrapper .top-text {
position: absolute;
display: inline-block;
padding: 2px 5px;
background: #eee;
color: #000;
z-index: 2;
}
.image-wrapper .top-text {
background: gray;
top: 5px;
left: 5px;
}
.image-wrapper .bottom-right-text {
background: yellow;
bottom: 5px;
right: 5px;
}
.image-wrapper .bottom-text {
background: tomato;
bottom: 5px;
left: 5px;
}
.featured-rating-green {
background: #46cd38 !important;
}
.featured-rating,
.featured-rating-orange,
.featured-rating-green {
position: absolute;
right: 10px;
width: 60px;
height: 60px;
text-align: center;
margin: -33px 10px 0 0;
font-size: 23px;
background: #ff7474;
color: #fff;
padding: 14px;
border-radius: 50%;
}
.featured-place-wrap {
background: #fff;
margin: 0 0 30px;
border: 1px solid #ccc;
-webkit-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
position: relative;
}
.border-upper-radius {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.border-downer-radius {
border-bottom: 1px solid #bdbdbd;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
/**futer title box styling */
.featured-title-box {
padding: 22px 14px;
}
.featured-title-box h6 {
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
margin-bottom: 5px;
}
.featured-title-box p {
color: #9fa9b9;
display: inline-block;
margin: 0;
}
.featured-place-wrap a {
display: inline;
text-decoration: none;
color: #000;
}
.featured-title-box p span {
color: #ffb006;
padding: 0;
}
.image-wrapper {
position: relative;
}
.image-wrapper .bottom-text,
.image-wrapper .bottom-right-text,
.image-wrapper .top-text {
position: absolute;
display: inline-block;
padding: 2px 5px;
background: #eee;
color: #000;
z-index: 2;
}
.image-wrapper .top-text {
background: gray;
top: 5px;
left: 5px;
}
.image-wrapper .bottom-right-text {
background: yellow;
bottom: 5px;
right: 5px;
}
.image-wrapper .bottom-text {
background: tomato;
bottom: 5px;
left: 5px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="row justify-content-center light-bg mt-3">
<div class="col-sm-6 col-lg-4 col-xl-4 featured-responsive">
<div class="featured-place-wrap border-upper-radius border-downer-radius">
<a href="#">
<div class='image-wrapper'>
<img src="https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg" class="img-fluid border-upper-radius" alt="#">
<p class="top-text">top text</p>
<p class="bottom-text">bottom label</p>
<p class="bottom-right-text">bottom label</p>
</div>
<span class="featured-rating-green">5.0</span>
<div class="featured-title-box">
<h6>PJ’s Midway</h6>
<p>
1 Reviews </p>
<span> • </span>
<p>
<span>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i> </span>
</p>
<ul>
<li><span class="fas fa-map-marked-alt"></span>
<p data-toggle="tooltip" data-placement="top" title="" data-original-title="901 6 Ave E, Prince Rupert, BC V8J 1X7, Canada">901 6 Ave E, Prince Rupert, BC...</p>
</li>
<li><span class="fas fa-mobile"></span>
<p> +12506242100</p>
</li>
<li><span class="fas fa-biking"></span>
<p> $2.99 Approx</p>
</li>
</ul>
<div class="bottom-icons">
<div class="badge badge-pill badge-danger">CLOSE NOW</div>
</div>
</div>
</a>
</div>
</div>
</div>
Based on Ashish Yadav's answer, I added a div to put the 42min on the right side.
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="row justify-content-center light-bg mt-3">
<div class="col-sm-6 col-lg-4 col-xl-4 featured-responsive">
<div class="featured-place-wrap border-upper-radius border-downer-radius">
<a href="#">
<!-- removing image tag from here as we have to place ribbons ovwer the element, do i switced to div with background image -->
<div src="https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg" class="img-fluid border-upper-radius" alt="#" style="
background: url("https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg");
min-height: 300px;
background-size: cover;
position: relative;
">
<div style="
top:20px;
position: absolute;
color: black;
">
promoted
</div>
<div style="
position: absolute;
bottom: 20px;
">
<div style="
bottom: 20px;
background: red;
">Pro extra 10% off</div>
<div style="
margin-top: 10px;
background: blue;
">lorem ipsum</div>
</div>
<div style="
margin-top: 10px;
background: blue;
position: absolute;
right: 0;
bottom: 20px;
">42 min</div>
</div>
<span class="featured-rating-green">5.0</span>
<div class="featured-title-box">
<h6>PJ’s Midway</h6>
<p>
1 Reviews
</p>
<span> • </span>
<p>
<span>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i> </span>
</p>
<ul>
<li>
<span class="fas fa-map-marked-alt"></span>
<p data-toggle="tooltip" data-placement="top" title="" data-original-title="901 6 Ave E, Prince Rupert, BC V8J 1X7, Canada">901 6 Ave E, Prince Rupert, BC...</p>
</li>
<li>
<span class="fas fa-mobile"></span>
<p> +12506242100</p>
</li>
<li>
<span class="fas fa-biking"></span>
<p> $2.99 Approx</p>
</li>
</ul>
<div class="bottom-icons">
<div class="badge badge-pill badge-danger">CLOSE NOW</div>
</div>
</div>
</a>
</div>
</div>
</div>
Hi I have made a few changes in your HTML
like changing img tag to div with the background image.
For now, I have added inline CSS, you can put it in your CSS as per your usage
Read about CSS layout and position for further knowledge css positions and layouts
preview:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="row justify-content-center light-bg mt-3">
<div class="col-sm-6 col-lg-4 col-xl-4 featured-responsive">
<div class="featured-place-wrap border-upper-radius border-downer-radius">
<a href="#">
<!-- removing image tag from here as we have to place ribbons ovwer the element, do i switced to div with background image -->
<div src="https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg" class="img-fluid border-upper-radius" alt="#" style="
background: url("https://i.ibb.co/2v7vxmJ/FSox-Hdp-BY8fr-Oyb-D9c-NA.jpg");
min-height: 300px;
background-size: cover;
position: relative;
">
<div style="
top:20px;
position: absolute;
color: black;
">
promoted
</div>
<div style="
position: absolute;
bottom: 20px;
">
<div style="
bottom: 20px;
background: red;
">Pro extra 10% off</div>
<div style="
margin-top: 10px;
background: blue;
">lorem ipsum</div>
</div>
</div>
<span class="featured-rating-green">5.0</span>
<div class="featured-title-box">
<h6>PJ’s Midway</h6>
<p>
1 Reviews
</p>
<span> • </span>
<p>
<span>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i> </span>
</p>
<ul>
<li>
<span class="fas fa-map-marked-alt"></span>
<p data-toggle="tooltip" data-placement="top" title="" data-original-title="901 6 Ave E, Prince Rupert, BC V8J 1X7, Canada">901 6 Ave E, Prince Rupert, BC...</p>
</li>
<li>
<span class="fas fa-mobile"></span>
<p> +12506242100</p>
</li>
<li>
<span class="fas fa-biking"></span>
<p> $2.99 Approx</p>
</li>
</ul>
<div class="bottom-icons">
<div class="badge badge-pill badge-danger">CLOSE NOW</div>
</div>
</div>
</a>
</div>
</div>
</div>

How to change arrow rotation when select box is active using CSS

Basically, i'm creating a custom select box when i finished the design part using css and when i wanted to add the "before" and "active" options so that the "arrow" and "menu" changes when the select box is active, I had some problems, when i add "active" to the class name in the browser the arrow is supposed to rotate but nothing happens instead.
HTML
<div class="custom_select_box_1_index">
<ul id="DefaultCategoryIndex"class="default_option_category_index">
<li>
<div class="option_allcategories">
<p>All Categories</p>
<i id="ArrowCategoryIndex" class="fa fa-chevron-up"></i>
</div>
</li>
</ul>
<ul id="OptionsCategoryIndex" class="select_option_category_index">
<li>
<div id="CategoryObjects" class="option objects">
<div class="icon"><i id="icon" class="fas fa-cube"></i></div>
<p class="category_text">Objects</p>
</div>
</li>
<li>
<div id="CategoryVehicules" class="option vehicules">
<div class="icon"><i id="icon" class="fas fa-car"></i></div>
<p class="category_text">Vehicules</p>
</div>
</li>
<li>
<div id="CategoryTechnology" class="option technology">
<div class="icon"><i id="icon" class="fas fa-mobile"></i></div>
<p class="category_text">Technology</p>
</div>
</li>
<li>
<div id="CategoryBooks" class="option books">
<div class="icon"><i id="icon" class="fas fa-book"></i></div>
<p class="category_text">Books</p>
</div>
</li>
<li>
<div id="CategoryGaming" class="option gaming">
<div class="icon"><i id="icon" class="fas fa-gamepad"></i></div>
<p class="category_text">Gaming</p>
</div>
</li>
<li>
<div id="CategoryOther" class="option other">
<div class="icon"><i id="icon" class="fas fa-ellipsis-h"></i></div>
<p class="category_text">Other...</p>
</div>
</li>
</ul>
</div>
CSS:
.custom_select_box_1_index{
font-family: Helvetica;
font-size: 19px;
color: var(--second-black);
box-sizing: content-box;
width: 250px;
height: 50px;
}
.custom_select_box_1_index > ul li{
list-style: none;
}
.custom_select_box_1_index .default_option_category_index:before{
content: "";
padding-top: 1px;
padding-bottom: 1px;
border-radius: 10px;
background-color: var(--white);
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.05);
cursor: pointer;
transform: rotate(180deg);
color: var(--black);
position: absolute;
margin-left: 170px;
margin-top: -39px;
cursor: pointer;
}
.custom_select_box_1_index .select_option_category_index{
background-color: var(--white);
border-radius: 10px;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.05);
z-index: 1;
display: none
}
.select_option_category_index li{
position: relative;
margin-left: -38px;
background-color: var(--white);
border-radius: 10px;
width: 230px;
padding: 3px 8px;
cursor: pointer;
}
.custom_select_box_1_index .select_option_category_index li:hover{
background: var(--grey);
}
.category_text{
position: relative;
left: 30px;
}
.custom_select_box_1_index .option{
display: flex;
align-items: center;
}
.icon{
display: flex;
align-items: center;
margin-left: 15px;
}
#icon{
color: var(--black);
}
.custom_select_box_1_index:active .select_option_category_index{
display: block;
}
.custom_select_box_1_index:active .default_option_category_index:before{
transform: rotate(0deg);
}
I want the arrow to rotate back to 0deg when the select bar is active (without using JavaScript).
You can leverage the CSS adjacent sibling selector +:
.custom_select_box_1_index {
font-family: Helvetica;
font-size: 19px;
color: var(--second-black);
box-sizing: content-box;
width: 250px;
height: 50px;
}
.custom_select_box_1_index>ul li {
list-style: none;
}
.custom_select_box_1_index .default_option_category_index:before {
content: "";
padding-top: 1px;
padding-bottom: 1px;
border-radius: 10px;
background-color: var(--white);
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);
cursor: pointer;
transform: rotate(180deg);
color: var(--black);
position: absolute;
margin-left: 170px;
margin-top: -39px;
cursor: pointer;
}
.custom_select_box_1_index .select_option_category_index {
background-color: var(--white);
border-radius: 10px;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);
z-index: 1;
display: none
}
.select_option_category_index li {
position: relative;
margin-left: -38px;
background-color: var(--white);
border-radius: 10px;
width: 230px;
padding: 3px 8px;
cursor: pointer;
}
.custom_select_box_1_index .select_option_category_index li:hover {
background: var(--grey);
}
.category_text {
position: relative;
left: 30px;
}
.custom_select_box_1_index .option {
display: flex;
align-items: center;
}
.icon {
display: flex;
align-items: center;
margin-left: 15px;
}
#icon {
color: var(--black);
}
.custom_select_box_1_index:active .select_option_category_index {
display: block;
}
.custom_select_box_1_index:active .default_option_category_index:before {
transform: rotate(90deg);
}
.option_allcategories p:active+.fa-chevron-up {
transform: rotate(180deg);
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<div class="custom_select_box_1_index">
<ul id="DefaultCategoryIndex" class="default_option_category_index">
<li>
<div class="option_allcategories">
<p>All Categories</p>
<i id="ArrowCategoryIndex" class="fa fa-chevron-up"></i>
</div>
</li>
</ul>
<ul id="OptionsCategoryIndex" class="select_option_category_index">
<li>
<div id="CategoryObjects" class="option objects">
<div class="icon"><i id="icon" class="fas fa-cube"></i></div>
<p class="category_text">Objects</p>
</div>
</li>
<li>
<div id="CategoryVehicules" class="option vehicules">
<div class="icon"><i id="icon" class="fas fa-car"></i></div>
<p class="category_text">Vehicules</p>
</div>
</li>
<li>
<div id="CategoryTechnology" class="option technology">
<div class="icon"><i id="icon" class="fas fa-mobile"></i></div>
<p class="category_text">Technology</p>
</div>
</li>
<li>
<div id="CategoryBooks" class="option books">
<div class="icon"><i id="icon" class="fas fa-book"></i></div>
<p class="category_text">Books</p>
</div>
</li>
<li>
<div id="CategoryGaming" class="option gaming">
<div class="icon"><i id="icon" class="fas fa-gamepad"></i></div>
<p class="category_text">Gaming</p>
</div>
</li>
<li>
<div id="CategoryOther" class="option other">
<div class="icon"><i id="icon" class="fas fa-ellipsis-h"></i></div>
<p class="category_text">Other...</p>
</div>
</li>
</ul>
</div>

I want to place my icons in the middle of the circle [duplicate]

This question already has answers here:
How can I center text (horizontally and vertically) inside a div block?
(27 answers)
How to vertically align an image inside a div
(37 answers)
How can I vertically align elements in a div?
(28 answers)
Closed 2 years ago.
How can I place my icons in the middle of the circle, based on the following picture:
Here is my HTML code:
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</div>
</footer>
Here is my CSS code that needs to be modified to place the icons in the middle of the white circles:
ul.socialnetworks {
margin: 0;
border:15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks > li {
display: inline-block;
}
ul.socialnetworks > li > a {
display: inline-block;
font-size: 25px;
line-height: 50px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
You can try something like this:
.item{
border-radius:50%;
background-color:black;
border:15px solid white;
width:50px;
height:50px;
display:inline-flex;
}
body{
background-color:black;
}
.item i{
margin-top: 25%;
margin-left: 25%;
color:white;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<div class="item">
<i class="material-icons">add_task</i>
</div>
<div class="item">
<i class="material-icons">add_task</i>
</div>
<div class="item">
<i class="material-icons">add_task</i>
</div>
Icons with class .fab have parameter display: inline-block. This means that vertical-align: middle can be used.
Just add it to your css:
.fab {
vertical-align: middle;
}
ul.socialnetworks {
margin: 0;
border:15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks > li {
display: inline-block;
}
ul.socialnetworks > li > a {
display: inline-block;
font-size: 25px;
line-height: 50px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
.fab {
vertical-align: middle;
}
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</ul>
</div>
</footer>
set the line-height equal to height line-height: 58px;
ul.socialnetworks {
margin: 0;
border: 15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks>li {
display: inline-block;
}
ul.socialnetworks>li>a {
display: inline-block;
font-size: 25px;
line-height: 58px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</div>
</footer>

How to resize list-style-images?

Just doing some practice by recreating the tumblr website, Im having some issues with the right side where it says "Recommended Blogs". I want to implement the use of a small user icon logo instead of the list style bullet. Is it possible to resize the images in css? or would i have to resize the image in photoshop?
Take a look at My Code pen
HTML
<html>
<head>
<title>Tumblr</title>
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link rel="stylesheet" type="text/css" href="tumblrstyle.css">
</head>
<body>
<!-- Header Navigation -->
<div class="top-head">
<header>
<div id="top-head-left">
<h1>T</h1>
<input type="text" name="" placeholder="">
<i class="fas fa-search"></i>
</div>
<div id="top-head-right">
<i class="fas fa-home fa-2x"></i>
<i class="far fa-compass fa-2x"></i>
<i class="fas fa-envelope fa-2x"></i>
<i class="far fa-comment fa-2x"></i>
<i class="fas fa-bolt fa-2x"></i>
<i class="fas fa-user fa-2x"></i>
</div>
</header>
</div>
<!-- End Header -->
<!-- RightBar -->
<div class="container">
<div class="right-side">
<div class="right-side nav">
<h3>Recommended Blogs</h3>
<ul id="navi">
<li>empty</li>
<li>empty</li>
<li>empty</li>
<li>empty</li>
</ul>
</div>
<div class="radar">
<h3>radar</h3>
<ul>
<li>empty</li>
<p>
</p>
</ul>
</div>
</div>
<!-- Post Controls -->
<div class="controller">
<img src="https://image.freepik.com/free-vector/abstract-summer-sun-logo- design_1436-184.jpg">
<div class="post-group">
<div class="icons">
<i class="fas fa-home fa-5x"></i>
</div>
<div class="icons">
<i class="far fa-compass fa-5x"></i>
</div>
<div class="icons">
<i class="fas fa-envelope fa-5x"></i>
</div>
<div class="icons">
<i class="far fa-comment fa-5x"></i>
</div>
<div class="icons">
<i class="fas fa-bolt fa-5x"></i>
</div>
<div class="icons">
<i class="fas fa-user fa-5x"></i>
</div>
</div>
</div>
</body>
</html>
CSS
/*Reset*/
* {
margin: 0;
padding: 0;
}
body {
background: lightgray;
}
header {
padding: 0 10px;
}
header h1 {
display: inline;
margin-right: 15px;
}
.container {
width: 60%;
margin: auto;
overflow: visible;
}
div h3 {
border-bottom: 1px solid black;
}
/*Header*/
.top-head {
background: lightblue;
height: 60px;
border-bottom: 5px solid black;
padding: 0px 20px;
}
#top-head-left {
float: left;
padding-top: 5px;
}
#top-head-left input[type="text"] {
width: 200px;
background: yellow;
padding: 5px 0px;
}
#top-head-right {
float: right;
padding-top: 12px;
}
/*RightsideBar*/
.right-side {
float: right;
}
.nav ul {
list-style-image: url('https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj');
}
.nav ul li {
}
.radar ul {
list-style: none;
}
/*Post Controller*/
.controller {
margin-top: 50px;
}
.controller img {
width: 10%;
float: left;
margin-right: 20px;
border-radius: 10px;
}
.post-group {
float: left;
background: white;
height: 68px;
border-radius: 10px;
padding-top: 8px;
padding-bottom: 22px;
}
.icons {
float: left;
}
.icons a {
color: orange;
padding: 0 12px;
}
/* https://78.media.tumblr.com/avatar_3aed9115be2f_128.pnj
https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj
https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj
https://78.media.tumblr.com/avatar_996dede0302e_128.pnj */
#navi {
list-style-type: none;
}
#navi > li::before {
content: '';
display: inline-block;
height: 40px;
width: 40px;
background-size: 40px;
background-image: url('https://78.media.tumblr.com/avatar_0f16d6a6a019_128.pnj');
background-repeat: no-repeat;
margin-right: 10px;
background-position: center center;
vertical-align: middle;
}
Please don't mind my selectors

How do I fit my element inside a container div

So I have an interface where I want a sidemenu to the left, and the rest of the area should contain a chat-field. The problem is that the chat-field is overflowing the container, and half of the chat-field goes outside the container div.
How do I fit the chat-field in the container with these settings? The container is named #chat-canvas
Here's a JSFiddle: https://jsfiddle.net/v5k1Lhgf/1/
* {
margin: 0;
padding: 0;
box-sizing: border-box !important;
}
html, body, #body {
background-color: #ffffff;
font-size: 15px;
color: #565656;
width: 100%;
padding: 0;
margin-left: 0;
margin-right: 0;
font-family: 'roboto', sans-serif;
font-weight: 300;
}
#body, .app html, body {
background-color: #f9f9f9;
font-size: 15px;
color: #565656;
width: 100%;
height: 100%;
padding: 0;
margin-left: 0;
margin-right: 0;
font-family: 'roboto', sans-serif;
font-weight: 300;
min-height: 100%;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
transition: all 3s ease-in-out;
height: 100%;
min-height: 100%;
}
*,*:before,*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#chat-canvas {
width: 94% !important;
height: 100%;
position: absolute;
float: left;
display: inline-block;
overflow: hidden;
}
.app-nav {
position: relative;
height: 100%;
width: 6%;
display: inline-block;
}
.tl-menu {
position: absolute;
overflow: hidden;
float: left;
top: 0;
height: 100%;
list-style-type: none;
margin: 0;
padding: 0;
background: #1b1e24;
z-index: 9999;
}
.tl-menu img{
max-height: 80%;
}
.tl-menu li a {
display: block;
height: 5em;
width: 5em;
line-height: 5em;
text-align: center;
color: #999;
position: relative;
border-bottom: 1px solid rgba(104,114,134,0.05);
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
transition: background 0.1s ease-in-out;
}
.tl-menu li a:hover,
.tl-menu li:first-child a{
color: #55fec6;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tl-menu li a:active {
background: #afdefa;
color: #FFF;}
/* class for current item */
.tl-menu li.tl-current a {
background: #343a47;
color: #bbe6fe;
}
.tl-menu li a:before {
font-family: 'entypo', sans-serif;
speak: none;
font-style: normal;
font-weight: normal;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.4em;
-webkit-font-smoothing: antialiased;
}
.tl-menu li a.icon-logo:before {
font-weight: 700;
font-size: 300%;
}
/* ---------- CHAT ---------- */
.people-list {
width: 30%;
float: right;
}
.people-list .search {
padding: 20px;
}
.people-list input {
border-radius: 3px;
border: none;
padding: 14px;
color: white;
background: #6A6C75;
width: 90%;
font-size: 14px;
}
.people-list .fa-search {
position: relative;
left: -25px;
}
.people-list ul {
padding: 20px;
height: 770px;
}
.people-list ul li {
padding-bottom: 20px;
}
.people-list img {
float: left;
}
.people-list .about {
float: left;
margin-top: 8px;
}
.people-list .about {
padding-left: 8px;
}
.people-list .status {
color: #92959E;
}
.chat {
width: 70%;
float: left;
position: absolute;
background: #F2F5F8;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
color: #434651;
}
.chat .chat-header {
padding: 20px;
border-bottom: 2px solid white;
}
.chat .chat-header img {
float: left;
}
.chat .chat-header .chat-about {
float: left;
padding-left: 10px;
margin-top: 6px;
}
.chat .chat-header .chat-with {
font-weight: bold;
font-size: 16px;
}
.chat .chat-header .chat-num-messages {
color: #92959E;
}
.chat .chat-header .fa-star {
float: right;
color: #D8DADF;
font-size: 20px;
margin-top: 12px;
}
.chat .chat-history {
padding: 30px 30px 20px;
border-bottom: 2px solid white;
overflow-y: scroll;
height: 575px;
}
.chat .chat-history .message-data {
margin-bottom: 15px;
}
.chat .chat-history .message-data-time {
color: #a8aab1;
padding-left: 6px;
}
.chat .chat-history .message {
color: white;
padding: 18px 20px;
line-height: 26px;
font-size: 16px;
border-radius: 7px;
margin-bottom: 30px;
width: 90%;
position: relative;
}
.chat .chat-history .message:after {
bottom: 100%;
left: 7%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-bottom-color: #86BB71;
border-width: 10px;
margin-left: -10px;
}
.chat .chat-history .my-message {
background: #86BB71;
}
.chat .chat-history .other-message {
background: #94C2ED;
}
.chat .chat-history .other-message:after {
border-bottom-color: #94C2ED;
left: 93%;
}
.chat .chat-message {
padding: 30px;
}
.chat .chat-message textarea {
width: 100%;
border: none;
padding: 10px 20px;
font: 14px/22px "Lato", Arial, sans-serif;
margin-bottom: 10px;
border-radius: 5px;
resize: none;
}
.chat .chat-message .fa-file-o, .chat .chat-message .fa-file-image-o {
font-size: 16px;
color: gray;
cursor: pointer;
}
.chat .chat-message button {
float: right;
color: #94C2ED;
font-size: 16px;
text-transform: uppercase;
border: none;
cursor: pointer;
font-weight: bold;
background: #F2F5F8;
}
.chat .chat-message button:hover {
color: #75b1e8;
}
.online, .offline, .me {
margin-right: 3px;
font-size: 10px;
}
.online {
color: #86BB71;
}
.offline {
color: #E38968;
}
.me {
color: #94C2ED;
}
.align-left {
text-align: left;
}
.align-right {
text-align: right;
}
.float-right {
float: right;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.chat-container {
bottom: 0;
left: 0;
right: 0;
height: auto;
margin: 0 auto;
width: 750px;
background: #444753;
border-radius: 5px;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
<body class="app">
<!-- NAV -->
<div class="app-nav">
<ul class="tl-menu">
<li><img src="https://i.imgur.com/ngO5Ohx.png" alt="Mendr Logo" height="50" width="50"></li>
<li><img src="{{user.picture}}"></li>
<li><i class="fa fa-plus" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-wechat" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-map" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-search" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-sign-out" style="font-size:30px; margin-top:20px;"></i></li>
</ul>
</div>
<!-- END NAV -->
<!-- CHAT -->
<div id="chat-canvas">
<div class="clearfix chat-container">
<div class="people-list" id="people-list">
<div class="search">
<input type="text" placeholder="search" />
<i class="fa fa-search"></i>
</div>
<ul class="list">
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_01.jpg" alt="avatar" />
<div class="about">
<div class="name">Vincent Porter</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_02.jpg" alt="avatar" />
<div class="about">
<div class="name">Aiden Chavez</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 7 mins ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_03.jpg" alt="avatar" />
<div class="about">
<div class="name">Mike Thomas</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_04.jpg" alt="avatar" />
<div class="about">
<div class="name">Erica Hughes</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_05.jpg" alt="avatar" />
<div class="about">
<div class="name">Ginger Johnston</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_06.jpg" alt="avatar" />
<div class="about">
<div class="name">Tracy Carpenter</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 30 mins ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_07.jpg" alt="avatar" />
<div class="about">
<div class="name">Christian Kelly</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 10 hours ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_08.jpg" alt="avatar" />
<div class="about">
<div class="name">Monica Ward</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_09.jpg" alt="avatar" />
<div class="about">
<div class="name">Dean Henry</div>
<div class="status">
<i class="fa fa-circle offline"></i> offline since Oct 28
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_10.jpg" alt="avatar" />
<div class="about">
<div class="name">Peyton Mckinney</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
</ul>
</div>
<div class="activity-info">
<div class="chat">
<div class="chat-header clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_01_green.jpg" alt="avatar" />
<div class="chat-about">
<div class="chat-with">Chat with Vincent Porter</div>
<div class="chat-num-messages">already 1 902 messages</div>
</div>
<i class="fa fa-star"></i>
</div> <!-- end chat-header -->
<div class="chat-history">
<ul>
<li class="clearfix">
<div class="message-data align-right">
<span class="message-data-time" >10:10 AM, Today</span>
<span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>
</div>
<div class="message other-message float-right">
Hi Vincent, how are you? How is the project coming along?
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:12 AM, Today</span>
</div>
<div class="message my-message">
Are we meeting today? Project has been already finished and I have results to show you.
</div>
</li>
<li class="clearfix">
<div class="message-data align-right">
<span class="message-data-time" >10:14 AM, Today</span>
<span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>
</div>
<div class="message other-message float-right">
Well I am not sure. The rest of the team is not here yet. Maybe in an hour or so? Have you faced any problems at the last phase of the project?
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:20 AM, Today</span>
</div>
<div class="message my-message">
Actually everything was fine. I'm very excited to show this to our team.
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:31 AM, Today</span>
</div>
<i class="fa fa-circle online"></i>
<i class="fa fa-circle online" style="color: #AED2A6"></i>
<i class="fa fa-circle online" style="color:#DAE9DA"></i>
</li>
</ul>
</div> <!-- end chat-history -->
<div class="chat-message clearfix">
<textarea name="message-to-send" id="message-to-send" placeholder ="Type your message" rows="3"></textarea>
<i class="fa fa-file-o"></i>
<i class="fa fa-file-image-o"></i>
<button>Send</button>
</div> <!-- end chat-message -->
</div> <!-- end chat -->
</div>
</div>
</div>
</body>
Please check snippet in full page for a better view
Replacing height: 100% with min-height: 100% in selector #chat-canvas will make your chat-canvas cover its child chat-field
* {
margin: 0;
padding: 0;
box-sizing: border-box !important;
}
html, body, #body {
background-color: #ffffff;
font-size: 15px;
color: #565656;
width: 100%;
padding: 0;
margin-left: 0;
margin-right: 0;
font-family: 'roboto', sans-serif;
font-weight: 300;
}
#body, .app html, body {
background-color: #f9f9f9;
font-size: 15px;
color: #565656;
width: 100%;
height: 100%;
padding: 0;
margin-left: 0;
margin-right: 0;
font-family: 'roboto', sans-serif;
font-weight: 300;
min-height: 100%;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
transition: all 3s ease-in-out;
height: 100%;
min-height: 100%;
}
*,*:before,*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#chat-canvas {
width: 94% !important;
min-height: 100%;
position: absolute;
float: left;
display: inline-block;
overflow: hidden;
}
.app-nav {
position: relative;
height: 100%;
width: 6%;
display: inline-block;
}
.tl-menu {
position: absolute;
overflow: hidden;
float: left;
top: 0;
height: 100%;
list-style-type: none;
margin: 0;
padding: 0;
background: #1b1e24;
z-index: 9999;
}
.tl-menu img{
max-height: 80%;
}
.tl-menu li a {
display: block;
height: 5em;
width: 5em;
line-height: 5em;
text-align: center;
color: #999;
position: relative;
border-bottom: 1px solid rgba(104,114,134,0.05);
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
transition: background 0.1s ease-in-out;
}
.tl-menu li a:hover,
.tl-menu li:first-child a{
color: #55fec6;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tl-menu li a:active {
background: #afdefa;
color: #FFF;}
/* class for current item */
.tl-menu li.tl-current a {
background: #343a47;
color: #bbe6fe;
}
.tl-menu li a:before {
font-family: 'entypo', sans-serif;
speak: none;
font-style: normal;
font-weight: normal;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.4em;
-webkit-font-smoothing: antialiased;
}
.tl-menu li a.icon-logo:before {
font-weight: 700;
font-size: 300%;
}
/* ---------- CHAT ---------- */
.people-list {
width: 30%;
float: right;
}
.people-list .search {
padding: 20px;
}
.people-list input {
border-radius: 3px;
border: none;
padding: 14px;
color: white;
background: #6A6C75;
width: 90%;
font-size: 14px;
}
.people-list .fa-search {
position: relative;
left: -25px;
}
.people-list ul {
padding: 20px;
height: 770px;
}
.people-list ul li {
padding-bottom: 20px;
}
.people-list img {
float: left;
}
.people-list .about {
float: left;
margin-top: 8px;
}
.people-list .about {
padding-left: 8px;
}
.people-list .status {
color: #92959E;
}
.chat {
width: 70%;
float: left;
position: absolute;
background: #F2F5F8;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
color: #434651;
}
.chat .chat-header {
padding: 20px;
border-bottom: 2px solid white;
}
.chat .chat-header img {
float: left;
}
.chat .chat-header .chat-about {
float: left;
padding-left: 10px;
margin-top: 6px;
}
.chat .chat-header .chat-with {
font-weight: bold;
font-size: 16px;
}
.chat .chat-header .chat-num-messages {
color: #92959E;
}
.chat .chat-header .fa-star {
float: right;
color: #D8DADF;
font-size: 20px;
margin-top: 12px;
}
.chat .chat-history {
padding: 30px 30px 20px;
border-bottom: 2px solid white;
overflow-y: scroll;
height: 575px;
}
.chat .chat-history .message-data {
margin-bottom: 15px;
}
.chat .chat-history .message-data-time {
color: #a8aab1;
padding-left: 6px;
}
.chat .chat-history .message {
color: white;
padding: 18px 20px;
line-height: 26px;
font-size: 16px;
border-radius: 7px;
margin-bottom: 30px;
width: 90%;
position: relative;
}
.chat .chat-history .message:after {
bottom: 100%;
left: 7%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-bottom-color: #86BB71;
border-width: 10px;
margin-left: -10px;
}
.chat .chat-history .my-message {
background: #86BB71;
}
.chat .chat-history .other-message {
background: #94C2ED;
}
.chat .chat-history .other-message:after {
border-bottom-color: #94C2ED;
left: 93%;
}
.chat .chat-message {
padding: 30px;
}
.chat .chat-message textarea {
width: 100%;
border: none;
padding: 10px 20px;
font: 14px/22px "Lato", Arial, sans-serif;
margin-bottom: 10px;
border-radius: 5px;
resize: none;
}
.chat .chat-message .fa-file-o, .chat .chat-message .fa-file-image-o {
font-size: 16px;
color: gray;
cursor: pointer;
}
.chat .chat-message button {
float: right;
color: #94C2ED;
font-size: 16px;
text-transform: uppercase;
border: none;
cursor: pointer;
font-weight: bold;
background: #F2F5F8;
}
.chat .chat-message button:hover {
color: #75b1e8;
}
.online, .offline, .me {
margin-right: 3px;
font-size: 10px;
}
.online {
color: #86BB71;
}
.offline {
color: #E38968;
}
.me {
color: #94C2ED;
}
.align-left {
text-align: left;
}
.align-right {
text-align: right;
}
.float-right {
float: right;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.chat-container {
bottom: 0;
left: 0;
right: 0;
height: auto;
margin: 0 auto;
width: 750px;
background: #444753;
border-radius: 5px;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
<body class="app">
<!-- NAV -->
<div class="app-nav">
<ul class="tl-menu">
<li><img src="https://i.imgur.com/ngO5Ohx.png" alt="Mendr Logo" height="50" width="50"></li>
<li><img src="{{user.picture}}"></li>
<li><i class="fa fa-plus" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-wechat" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-map" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-search" style="font-size:30px; margin-top:20px;"></i></li>
<li><i class="fa fa-sign-out" style="font-size:30px; margin-top:20px;"></i></li>
</ul>
</div>
<!-- END NAV -->
<!-- CHAT -->
<div id="chat-canvas">
<div class="clearfix chat-container">
<div class="people-list" id="people-list">
<div class="search">
<input type="text" placeholder="search" />
<i class="fa fa-search"></i>
</div>
<ul class="list">
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_01.jpg" alt="avatar" />
<div class="about">
<div class="name">Vincent Porter</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_02.jpg" alt="avatar" />
<div class="about">
<div class="name">Aiden Chavez</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 7 mins ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_03.jpg" alt="avatar" />
<div class="about">
<div class="name">Mike Thomas</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_04.jpg" alt="avatar" />
<div class="about">
<div class="name">Erica Hughes</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_05.jpg" alt="avatar" />
<div class="about">
<div class="name">Ginger Johnston</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_06.jpg" alt="avatar" />
<div class="about">
<div class="name">Tracy Carpenter</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 30 mins ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_07.jpg" alt="avatar" />
<div class="about">
<div class="name">Christian Kelly</div>
<div class="status">
<i class="fa fa-circle offline"></i> left 10 hours ago
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_08.jpg" alt="avatar" />
<div class="about">
<div class="name">Monica Ward</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_09.jpg" alt="avatar" />
<div class="about">
<div class="name">Dean Henry</div>
<div class="status">
<i class="fa fa-circle offline"></i> offline since Oct 28
</div>
</div>
</li>
<li class="clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_10.jpg" alt="avatar" />
<div class="about">
<div class="name">Peyton Mckinney</div>
<div class="status">
<i class="fa fa-circle online"></i> online
</div>
</div>
</li>
</ul>
</div>
<div class="activity-info">
<div class="chat">
<div class="chat-header clearfix">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/195612/chat_avatar_01_green.jpg" alt="avatar" />
<div class="chat-about">
<div class="chat-with">Chat with Vincent Porter</div>
<div class="chat-num-messages">already 1 902 messages</div>
</div>
<i class="fa fa-star"></i>
</div> <!-- end chat-header -->
<div class="chat-history">
<ul>
<li class="clearfix">
<div class="message-data align-right">
<span class="message-data-time" >10:10 AM, Today</span>
<span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>
</div>
<div class="message other-message float-right">
Hi Vincent, how are you? How is the project coming along?
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:12 AM, Today</span>
</div>
<div class="message my-message">
Are we meeting today? Project has been already finished and I have results to show you.
</div>
</li>
<li class="clearfix">
<div class="message-data align-right">
<span class="message-data-time" >10:14 AM, Today</span>
<span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>
</div>
<div class="message other-message float-right">
Well I am not sure. The rest of the team is not here yet. Maybe in an hour or so? Have you faced any problems at the last phase of the project?
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:20 AM, Today</span>
</div>
<div class="message my-message">
Actually everything was fine. I'm very excited to show this to our team.
</div>
</li>
<li>
<div class="message-data">
<span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
<span class="message-data-time">10:31 AM, Today</span>
</div>
<i class="fa fa-circle online"></i>
<i class="fa fa-circle online" style="color: #AED2A6"></i>
<i class="fa fa-circle online" style="color:#DAE9DA"></i>
</li>
</ul>
</div> <!-- end chat-history -->
<div class="chat-message clearfix">
<textarea name="message-to-send" id="message-to-send" placeholder ="Type your message" rows="3"></textarea>
<i class="fa fa-file-o"></i>
<i class="fa fa-file-image-o"></i>
<button>Send</button>
</div> <!-- end chat-message -->
</div> <!-- end chat -->
</div>
</div>
</div>
</body>
You should use calc(%100 - 200px); as a value to the width. Look up calc CSS it will work because I had the same problem.
Here you go: https://www.w3schools.com/cssref/func_calc.asp
I tried to solve your problem. please check https://jsfiddle.net/komal10041992/v5k1Lhgf/4/. I removed overflow property, gave height:auto and width: 100%