Two divs on one line in top navigation bar - html

I have been looking at suggestions on how to make two divs on the same line for the past hour, but they either do not work or only work for divs with text. I am making a navigation bar for my website that contains my site logo and icons that jump to sections of my website, but I cannot get them to be on the same line.
I just want the icons (in the blue container) to be shifted up and right next to my logo. If anybody could tell me specifically what I can do to fix this, it would be greatly appreciated.
Also, I am using Bootstrap 4 if that makes any difference in solving this problem.
My navigation bar currently:
What I want the navigation bar to look like:
My Navbar HTML:
<div class="d-block d-xs-block d-md-none" id="topnav">
<div id="topnav-logo">
<img src="images/logo.png" id="logo-topnav">
</div>
<div class="text-center" id="topnav-icons">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-user" aria-hidden="true"></i>
<i class="fas fa-file-alt" aria-hidden="true"></i>
<i class="fas fa-book-open" aria-hidden="true"></i>
<i class="fas fa-address-book" aria-hidden="true"></i>
</div>
</div>
My Navbar CSS (you can ignore the comments as they are just from me trying to fix this issue):
#topnav {
/* TODO: change height back to 60px when done fixing*/
height: 120px;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
right: 0;
background: black;
/* TODO: change overflow back to hidden when done fixing*/
overflow: auto;
}
#topnav-icons {
margin-left: 60px;
width: calc(100vw - 60px);
padding-top: 11px;
padding-bottom: 11px;
background: blue;
}
#topnav-icons a {
/* float: left;
display: inline-block; */
color: var(--gray);
/* text-align: center; */
text-decoration: none;
font-size: 25px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
#sidenav-icons a:hover, #topnav-icons a:hover, #contact a:hover {
color: var(--seafoam);
}
#logo-sidenav, #logo-topnav {
height: 60px;
width: 60px;
padding: 10px;
}

Flexbox - You literally can just change d-block to d-flex on id="topnav" and it will be just about right:
Change <div class="d-block d-xs-block d-md-none" id="topnav"> to <div class="d-flex d-md-none" id="topnav">
I also removed the d-xs-block which is not needed.
I believe you can remove the height: 120px from #topnav since the height would be driven by the items themselves and you'll probably want to remove margin-left: 60px; on #topnav-icons. I've made these changes in the snippet below.
#topnav {
/* TODO: change height back to 60px when done fixing*/
/* height: 120px; */
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
right: 0;
background: black;
/* TODO: change overflow back to hidden when done fixing*/
overflow: auto;
}
#topnav-icons {
/* margin-left: 60px; */
width: calc(100vw - 60px);
padding-top: 11px;
padding-bottom: 11px;
background: blue;
}
#topnav-icons a {
/* float: left;
display: inline-block; */
color: var(--gray);
/* text-align: center; */
text-decoration: none;
font-size: 25px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
#sidenav-icons a:hover, #topnav-icons a:hover, #contact a:hover {
color: var(--seafoam);
}
#logo-sidenav, #logo-topnav {
height: 60px;
width: 60px;
padding: 10px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<div class="d-flex d-md-none" id="topnav">
<div id="topnav-logo">
<img src="http://pluspng.com/img-png/bootstrap-logo-vector-png-bootstrap-logo-512.jpg" id="logo-topnav">
</div>
<div class="text-center" id="topnav-icons">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-user" aria-hidden="true"></i>
<i class="fas fa-file-alt" aria-hidden="true"></i>
<i class="fas fa-book-open" aria-hidden="true"></i>
<i class="fas fa-address-book" aria-hidden="true"></i>
</div>
</div>

I'm not sure if it does what you want but adding float:left on your image might be the trick.
See this jsfiddle
<div class="d-block d-xs-block d-md-none" id="topnav">
<div id="topnav-logo">
<img src="images/logo.png" id="logo-topnav">
</div>
<div class="text-center" id="topnav-icons">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-user" aria-hidden="true"></i>
<i class="fas fa-file-alt" aria-hidden="true"></i>
<i class="fas fa-book-open" aria-hidden="true"></i>
<i class="fas fa-address-book" aria-hidden="true"></i>
</div>
</div>
And CSS
#topnav {
/* TODO: change height back to 60px when done fixing*/
height: 120px;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
right: 0;
background: black;
/* TODO: change overflow back to hidden when done fixing*/
}
#topnav-icons {
margin-left: 60px;
width: calc(100vw - 60px);
padding-top: 11px;
padding-bottom: 11px;
background: blue;
}
#topnav-icons a {
/* float: left;
display: inline-block; */
color: var(--gray);
/* text-align: center; */
text-decoration: none;
font-size: 25px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
#sidenav-icons a:hover, #topnav-icons a:hover, #contact a:hover {
color: var(--seafoam);
}
#logo-sidenav, #logo-topnav {
height: 60px;
width: 60px;
float:left;
}

it should be like this :
#topnav {
/* TODO: change height back to 60px when done fixing*/
height: 120px;
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
right: 0;
background: black;
/* TODO: change overflow back to hidden when done fixing*/
overflow: auto;
}
#topnav-icons {
width: calc(100% - 80px);
padding-top: 11px;
padding-bottom: 11px;
background: blue;
float: left;
}
#topnav-logo { float: left; }
#topnav-icons a {
/* float: left;
display: inline-block; */
color: var(--gray);
/* text-align: center; */
text-decoration: none;
font-size: 25px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}
#sidenav-icons a:hover, #topnav-icons a:hover, #contact a:hover {
color: var(--seafoam);
}
#logo-sidenav, #logo-topnav {
height: 60px;
width: 60px;
padding: 10px;
}
<div class="d-block d-xs-block d-md-none" id="topnav">
<div id="topnav-logo">
<img src="images/logo.png" id="logo-topnav">
</div>
<div class="text-center" id="topnav-icons">
<i class="fa fa-home" aria-hidden="true"></i>
<i class="fa fa-user" aria-hidden="true"></i>
<i class="fas fa-file-alt" aria-hidden="true"></i>
<i class="fas fa-book-open" aria-hidden="true"></i>
<i class="fas fa-address-book" aria-hidden="true"></i>
</div>
</div>

Related

how to remove white space to the right of flexbox container?

I'm trying to use flexbox to create a responsive layout of a product list page but this code leaves a lot of whitespace to the right of the page, ive tried using justify-content:space-between but that did not work as well. Adding overflow:hidden to .container class did nothing as well.
edit:someone said it works fine on their end but this is how
my screen looks
*{
margin:0;
padding: 0;
box-sizing: border-box;
text-transform: capitalize;
text-decoration: none;
transition: all .2s linear;
}
body{
overflow-x: hidden;
}
.container{
min-height: 100vh;
display:flex;
flex-direction: row;
justify-content:center;
flex-wrap: wrap;
padding: 40px 0;
}
.card{
height:500px;
width:280px ;
overflow: hidden;
position: relative;
align-self: center;
margin: 40px;
}
.card img{
width: 100%;
height: 80%;
object-fit: cover;
}
.card .info
{
text-align: center;
line-height: 25px;
}
.card .info .stars i
{
color: gold;
padding: 10px 0;
}
.card .info .price{
font-size: 20px;
color:#f00333;
letter-spacing: 1px;
}
.card .info h3{
color: #333;
padding-top: 5px;
}
.card .discount
{
position: absolute;
top:15px;
left:15px;
height:50px;
width:50px;
display: grid;
background-color: rgba(255, 0, 0, 0.6);
color:#fff;
font-weight: bold;
border-radius: 50%;
text-align: center;
line-height: 50px;
}
.card .panel
{
position: absolute;
top:15px;
right: -50%;
width: 45px;
background: rgba(255, 255, 255, 0.644);
display: flex;
align-items: center;
flex-flow: column;
}
.card:hover .panel{
right: 15px;
opacity: 1;
}
.card button
{
position: absolute;
left:50%;
bottom: 0%;
height: 40px;
width: 140px;
border: none;
outline:none;
background: rgba(0,0,0,0.6);
color:#fff;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transform: translateX(-50%);
opacity: 0;
transition-delay: .2s;
}
.card:hover button{
opacity: 1;
bottom: 25%;
}
.card button:hover{
background: (255,0,0,0.6);
}
.card .panel a{
font-size: 20px;
color: #333;
margin: 15px 0;
}
.card .panel a:hover{
color: rgba(255,0,0,0.9);
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<div class="container">
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
</div>
It Works Fine.
In Your Browser do a hard refresh.
I hope it will do the job done.
Hard Refresh : Ctrl + F5
Click here. It are some docs on hard Refresh If you want to know more.
Or If Nothing Works use position : absolute or Bootstrap.

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%

Font Awesome Icon Alignment

I'm trying to get my home button in the header within a div but it is aligning under the div/header.
I have this code:
.home-button {
background: #333;
width: 59px;
height: 60px;
float: right;
line-height: 180px;
text-align: center;
vertical-align: bottom;
}
div.home-button i.fa {
display: inline-block;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<div class="home-button">
<i class="fa fa-home" aria-hidden="true"></i>
</div>
but it is displaying with the icon below the div...
Any advice?
you need to change your line-height to 60px( same value has your height) if you want it vertically aligned
don't need to set other rules to i, because font-awesome.cssalready handles that
.home-button {
background: #333;
width: 59px;
height: 60px;
line-height:60px;
float:right;
text-align: center;
vertical-align: bottom;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" />
<div class="home-button">
<i class="fa fa-home" aria-hidden="true"></i>
</div>
It's because you have set your line-height 180px. Text is than vertically aligned to this value instead of set height of 60px
.home-button {
margin-top: 50px;
background: #333;
width: 59px;
height: 60px;
float: right;
line-height: 60px;
text-align: center;
vertical-align: bottom;
}
div.home-button i.fa {
color: #ddd;
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet"/>
<div class="home-button">
<i class="fa fa-home" aria-hidden="true"></i>
</div>
Remove line-height from .home-button and add it to i tag like this:
.home-button {
background: #333;
width: 59px;
height: 60px;
float: right;
text-align: center;
}
.home-button i {
display: inline-block;
line-height: 60px;
color: #fff;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<div class="home-button">
<i class="fa fa-home" aria-hidden="true"></i>
</div>

How can I display my social media icons at the same level as my copyright?

footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {} p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
float: right;
color: #fff;
padding-right: 30px;
}
<footer class="footer">
<div class="wrapper">
<p class="copyright">© GROUP TITLE 2015, social media icons supposed to be there ----></p>
<div class="social">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
</footer>
How can I display my social media icons at the same level as my copyright line, (defining, at the bottom of my footer but not under it - see snippet)?
HTML
<footer class="footer">
<div class="wrapper">
<p class="copyright">© GROUP TITLE 2015</p>
<div class="social">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
</footer>
CSS
footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {
}
p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
float: right;
color: #fff;
padding-right: 30px;
}
The copyright displays at the correct position of the footer, but how can I display my social media icons on the same level (height) without setting a padding or margin?
you can try this one:
footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {
}
p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
color: #fff;
position: absolute;
right: 5%;
top: 85%;
}
DEMO HERE
.social {
font-size: 19px;
color: #fff;
position: absolute;
right: 5%;
top: 72%;
}
You can try this. I have created fiddle for it you need to change your html structure as follows. If you don't want separately arrange the social section.
<p class="copyright">© GROUP TITLE 2015,
<span class="social">social media icons supposed to be there ---->
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</span>
</p>
And small change in css:
.social {
font-size: 19px;
/* float: right; */
color: #fff;
padding-right: 30px;
/* width: 100%; */
height: 10px;
}
I hope this what you are looking for it.
Fiddle