EDIT
I've added this css to span.label using this fiddle
span.label{
width:100px; color:#FFFFFF;
background-color:#F43B05;
float:right; padding:3px;
position:absolute; top:50px; left:5px;
}
And I've got this:
I need to put a label on an image using bootstrap.
I have this image with a label:
And here is the code for it:
<span class="label label-success">4</span>
<input class="img1" type="image" style="width:60px;height:60px" src="../images/molar_left_t.png" id="oone" name="one" alt="button"/>
<div title="3rd Molar - Upper Rigth Jaw" id="div_one" class="collapse"><?php echo $resTeeth['one'] ?>
</div>
But this is not what I want. What I want is to add this number 4 green label on top of the image and not on the side of it.
I tried this:
<span class="label label-danger">4
<input class="img1" type="image" style="width:60px;height:60px" src="../images/molar_left_t.png" id="oone" name="one" alt="button"/>
<div title="3rd Molar - Upper Rigth Jaw" id="div_one" class="collapse"><?php echo $resTeeth['one'] ?>
</div>
</span>
And I've got this:
I am sure this will be your answer.
Thanks
/* CSS used here will be applied after bootstrap.css */
.badge-notify{
background-color:red !important;
position:relative;
top: -20px;
left: -35px;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="container">
<button class="btn btn-default btn-lg btn-link" style="font-size:36px;">
<span class="glyphicon glyphicon-comment"></span>
</button>
<span class="badge badge-notify">3</span>
</div>
Just use float:left for span.label and then set margins to set the position of the label element.
try this:
<div class="container">
<img src="" />
<span class="lbl">something</span>
</div>
.container{
position:relative;
}
.container img, .container .lbl{
position:absolute;
top:0px;
left:0px;
}
I've made two examples here, like the ones I suggested in the comments.
JSFiddle
div
{
position: relative;
width: 300px;
height: 300px;
}
span
{
position: absolute;
background: red;
color: white;
height: 60px;
width: 60px;
text-align: center;
font-family: Tahoma, sans-serif;
font-size: 40px;
line-height: 55px;
border-radius: 10px;
bottom: 0;
right: 0;
}
.icon
{
position: relative;
}
.icon:after
{
content:"4";
position: absolute;
display: block;
background: red;
color: white;
height: 60px;
width: 60px;
text-align: center;
font-family: Tahoma, sans-serif;
font-size: 40px;
line-height: 55px;
border-radius: 10px;
bottom: 0;
right: 0;
}
Related
I am able to make my text in the center but using px values. When I try using percentage it is not working. I tried display:table; and display:table-cell and also display:flex;
justify-content: center; //horizontal centering
align-items:center; but it did not work.
My parent div has height: 7.7% .
Note: I have updated my full header code
Below is JSFIDDLE link:
https://jsfiddle.net/Anthony_Chien/f7n77068/#&togetherjs=gR8VEaLgqR
HTML:
<div class="vav-main">
<nav class="navbar navbar-default navheader">
<div class="navbar-header navlogo">
<span>DS</span>
</div>
<div class="navheadersec2">
<div class="navheadermargin">
<div class="btn-group">
<button class="btn btn-default btn-md dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="headerspanbox"> <div class="headerdivbox"></div> </span>Default <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
</ul>
</div>
<!--<div class="header-icons">
<span class="icons-group"><img src="assets/images/icons/undo.png" /></span>
<span class="icons-label">Undo</span>
</div>-->
<span class="btn-group icons-grp"><img src="assets/images/icons/undo.png" /><br>Undo</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/redo.png" /><br>Redo</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/zoom-in.png" /><br></span>
<span class="btn-group icons-grp"><img src="assets/images/icons/zoom-out.png" /><br></span>
<span class="btn-group icons-grp"><img src="assets/images/icons/group.png" /><br>Group</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/pattern.png" /><br>Pattern</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/lock.png" /><br>Lock</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/select.png" /><br>Select</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/resize.png" /><br>Scale</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/rotate.png" /><br>Rotate</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/rotate.png" /><br>Forward</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/backward.png" /><br>Backward</span>
<span class="btn-group icons-grp"><img src="assets/images/icons/panel.png" /><br>Panel</span>
</div>
</div>
<div class="navheadersec3">
<div class="navheadermargin">
<div class="headersec3para">
<p class="headerpara">Code</p>
<p class="headerpara">Some text</p>
</div>
<p class="header-price">2,550</p>
<span class="btn-group icons-grp info-icon"><img src="assets/images/icons/info.png" /></span>
<p class="header-price add-to-cart">ADD</p>
</div>
</div>
</nav>
</div>
CSS:
.vav-main{
width: 100%;
height: 100%;
}
.navheader{
width: 100%;
height: 7.7%;
background-color: #ffffff;
border: solid 1px #b8b8b8;
}
.navlogo {
width: 5%;
height: 100%;
background-color: #ffffff;
position:relative; /* Add this property */
transform:translate(-50% -50%); /* Add this property */
top:50%; /* Add this property */
left:50%; /* Add this property */
}
.navlogo span {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
}
.navheadersec2 {
width: 64.76%;
display: inline-block;
border-right: solid 1px #b8b8b8;
height: 100%;
}
.navheadersec3{
width: 30.214%;
display: inline-block;
margin-left: -4px;
}
.navheadermargin .headersec3para{
width: 30.53%;
height: 100%;
float: left;
margin-left: 6.10%;
}
.headersec3para .headerpara:first-child{
font-size: 12px;
margin: 0px !IMPORTANT;
font-weight: bold;
}
.headersec3para .headerpara{
font-size: 10px;
margin: 0px !IMPORTANT;
}
.header-price{
margin: 0px;
height: 100%;
width: 16.03%;
float: left;
text-align: center;
line-height: 34px;
font-weight: bold;
font-size: 18px;
font-family: SourceSansPro;
}
.info-icon{
margin: auto;
text-align: center;
line-height: 34px;
}
.info-icon > img{
width: 20px;
height: 20px;
}
.add-to-cart{
width: 30.534%;
font-size: 15px;
color: #009cff;
}
.navheadermargin{
margin-top: 10px;
height: 34px;
margin-bottom: 10px;
}
.navheadermargin .btn-group{
margin-left: 1.3%;
height: 100%;
width: 13.510%;
float: left;
}
.navheadermargin .header-icons{
float: left;
width: 24px;
height: 100%;
}
.header-icons .icons-group{
height: 21px;
}
.header-icons .icons-group img{
height: 20px;
width: 20px;
}
.header-icons .icons-label{
height: 15px;
font-family: SourceSansPro;
font-size: 10px;
}
.navheadermargin .btn-group button{
height: 100%;
width: 100%;
}
.headerspanbox{
display: inline-block;
}
.headerspanbox .headerdivbox{
background-color: #1fb6ff;
margin-right: 10px;
height: 14px;
width: 18px;
}
Screenshot Image:
.vav-main{
width: 100%;
height: 100%;
}
.navheader{
width: 100%;
height: 7.7%;
background-color: #ffffff;
border: solid 1px #b8b8b8;
}
.navlogo {
width: 5%;
height: 100%;
background-color: #ffffff;
position:relative; /* Add this property */
transform:translate(-50% -50%); /* Add this property */
top:50%; /* Add this property */
left:50%; /* Add this property */
}
.navlogo span {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
}
.vav-main> .navbar {
margin-bottom: 0px;
min-height:initial;
}
<div class="vav-main">
<nav class="navbar navbar-default navheader">
<div class="navbar-header navlogo">
<span>DS....</span>
</div>
</nav>
</div>
You can use flex for achieve the same.
update fiddle below
working fiddle
.vav-main{
width: 100%;
height: 100%;
}
.navheader{
width: 100%;
height: 7.7%;
background-color: #ffffff;
border: solid 1px #b8b8b8;
}
.navlogo {
height: 100%;
width:100%;
background-color: #ffffff;
display:flex;
justify-content:center;
align-items:center;
flex-flow:column nowrap;
}
.navlogo span {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
}
.navlogo span a {
align-self:center;
}
.vav-main> .navbar {
margin-bottom: 0px;
min-height:initial;
}
<div class="vav-main">
<nav class="navbar navbar-default navheader">
<div class="navbar-header navlogo">
<span>DS....</span>
</div>
</nav>
</div>
You can use display: table; on your container, and display: table-cell; on your children, to center vertically and horizontally your navigation elements. Ypu can then set container and elements width based on the layout you need.
Possible example :
.vav-main{
position: relative;
width: 100%;
height: 100%;
}
.navbar{
display: table;
width: 100%;
background-color: #ffffff;
border: solid 1px #b8b8b8;
}
.navlogo {
height: 100;
background-color: #ffffff;
width: 5%;
}
.navlogo span {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
}
.navbar-header {
display: table-cell;
padding: 3.5%;
vertical-align: middle;
text-align: center;
}
<div class="vav-main">
<nav class="navbar navbar-default">
<div class="navbar-header navlogo">
<span>DS</span>
</div>
<div class="navbar-header">
........
</div>
</nav>
</div>
.navheader{
width: 100%;
height: 100px;
background-color: #ffffff;
border: solid 1px #b8b8b8;
}
.navlogo {
width: 5%;
height: 100%;
background-color: #ffffff;
}
.navlogo span {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
display:table;height:100%;width:100px;
}
.navlogo span a{
display:table-cell;vertical-align:middle;text-align:center;margin:0;
}
<div class="vav-main">
<nav class="navbar navbar-default navheader">
<div class="navbar-header navlogo">
<span>DS</span>
</div>
</nav>
</div>
Might be you are doing that using bootstrap if so then you could try it like as below, remove span tag as both a and span tags are inline elements, so you could use one if needed.
.nav-main {
width: 100%;
height: 100%;
}
.nav-main > .navheader {
width: 100%;
height: 7.7%;
background-color: #ffffff;
}
.navlogo {
width: 100%;
height: 100%;
background-color: #ffffff;
text-align: center;
}
.navlogo > a {
font-family: SourceSansPro;
font-size: 24px;
font-weight: bold;
display: inline-block;
margin-top: 8px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="nav-main">
<nav class="navbar navbar-default navheader">
<div class="navbar-header navlogo">
DS
</div>
<div>
</div>
</nav>
</div>
I don't modify on your code, I just write tinny block of code. Hope this will be helpful for you. As you see, the text inside lime block always align center by horizonal and middle by vertical.
$('#header .text').css('left', 'calc(50% - '+$('#header .text').css('width')+' / 2)');
$('#header .text').css('top', 'calc(50% - '+$('#header .text').css('height')+' / 2)');
#header{
width:100%;
height:200px;
border:1px blue solid;
}
#box{
width:30%;
height:80%;
background-color:lime;
text-align:center;
position:relative;
}
#box .text{
border:1px red solid;
position:absolute;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='header'>
<div id='box'>
<div class='text'>abchghjghj</div>
</div>
</div>
I wrote a responsive footer as shown in screen shot:
The text HELP and back icon aren't floating to left, but are struck in middle. How can I move it to left?
Here is the code:
HTML code:
<div id = "footer">
<span id = "logout" class="pull-right">
<span id = "logoutIcon"></span>
<span id = "logoutText">
LOGOUT
</span>
</span>
<span id = "logout1" class="pull-right">
<span id = "logoutIcon1"></span>
<span id = "logoutText1">
HELP
</span>
</span>
</div>
CSS code::
#footer {
background-color: #125e9a;
bottom: 0;
height: 5%;
position: absolute;
width: 100%;
}
#logout1 {
display: block;
height: 100%;
margin-left: 3%;
padding: 2.5%;
width: 30%;
}
#logoutIcon1 {
background-image: url("../JunosImages/mob/back-arrow_normal_tab.png");
background-repeat: no-repeat;
background-size: 100% 100%;
display: block;
float: left;
height: 14px;
margin-top: 2%;
width: 10px;
}
#logoutText1 {
color: #fff;
float: left;
font-size: 14px;
font-weight: 600;
margin-left: 7%;
}
You pulled right both buttons. Just replace pull-right class with pull-left in the second button and swap these buttons.
Also don’t use ID selectors in CSS.
are u use bootstrap so please check the below ans...
class="pull-left";
i would do it like this:
<!DOCTYPE html>
<html>
<head>
<style>
.footer {
background-color: #125e9a;
bottom: 0;
height: 5%;
position: absolute;
width: 100%;
}
.footer-links{
display: block;
float:left;
margin-left: 3%;
padding: 0.5%;
width: 98px;
}
.arrow{
background-color: green;
height: 14px;
margin-top: 2%;
width: 10px;
}
.footer .button-text{
color: #fff;
font-size: 14px;
font-weight: 600;
margin-left: 7%;
}
.footer-links-wrapper{
width: 215px;
}
</style>
</head>
<body>
<div id="footer" class="footer">
<div class="footer-links-wrapper">
<span id="help" class="pull-left footer-links">
<span id="left-arrow" class="arrow left-arrow"> << </span>
<span id="help-text" class="button-text">
HELP
</span>
</span>
<span id="logout" class="pull-right footer-links">
<span id="logout-text" class="button-text">
LOGOUT
</span>
<span id="right-arrow" class="arrow right-arrow"> >> </span>
</span>
</div>
</div>
</body>
</html>
always better to write styles in classes and not by id
use "=" in attributes without spaces
name of classes and ids have to explain what you do (one way of comments)
in your code missing other styles, for look what you did in local browser
(The title might sound stupid but I don't know how to put it more sophisticated.)
As you can see in the follwing screenshots, I have 3 stacked divs.
<div class="col-xs-3">
<div class="center-horizontal-inline">
<a class="upvote" href="#" data-id="iZheLNnewWtMhPTQd">
</div>
<div class="score">
115
<span class="badge score-diff vertical-align"> +5 </span>
</div>
<div class="center-horizontal-inline">
</div>
The one in the middle contains the number (115). The other two the vote-arrows. For the one containing the number, I want to add a "badge" (in bootstrap context) right next to the number, let's say to the right. You can see my attempt shining through the colored overlay.
The goal is to leave the number centered respectively to the arrow-icons, while placing the badge with an offset (or "right next to") respectively to the number.
My attempt was to set a float: right; for the badge, but as you can see, the number has an offset now. When I try position: absolute; on the badge, there is no offset (as wanted), but I can't get the badge right next to the number, I can only attach it to the right border because I don't have the number as positioning-reference anymore.
Hope my explanation was clear enough. I also didn't know how to search for that problem...
EDIT 1:
As I want it to look like (positioning-wise):
Here we go, using relative and absolute positions together:
DEMO: http://jsfiddle.net/1qbo7uwn/
HTML
<div class="score">
<span class="score-wrap">
<span class="score-main">123</span>
<span class="score-diff">8</span>
</span>
</div>
CSS
.score {
width: 80px;
border: 2px solid blue;
padding: 10px 0;
text-align: center;
}
.score-wrap {
display: inline-block;
position: relative;
}
.score-main {
border: 2px solid green;
}
.score-diff {
position: absolute;
border: 2px solid red;
left: 100%;
top: -2px;
}
Added some span tags in the HTML.
EDIT: vertical align of everything, by setting line height.
http://jsfiddle.net/1qbo7uwn/1/
As you said you are okay with HTML modification. Here's my attempt:
Demo Fiddle
HTML
<div class="wrap">
<div class="vote up">
<i class="fa fa-angle-up"></i>
</div>
<div class="stat">
<span class="score">115
<span class="badge">+5</span>
</span>
</div>
<div class="vote inactive">
<i class="fa fa-angle-down"></i>
</div>
</div>
CSS
.wrap{
margin: 100px;
text-align:center;
}
.vote{
font-size:36px;
}
.up{
color:green;
}
.down{
color:red;
}
.inactive{
color:gray;
}
.score{
position: relative;
display:block;
padding: 5px 0;
}
.badge{
background: #eee;
padding:5px 10px;
border-radius: 30px;
position: absolute;
top:0;
margin-left:10px;
}
Try
Demo: http://jsfiddle.net/tamilcselvan/rjv1xxo2/1/
.center-horizontal-inline {
font-size: 2em;
text-align: center;
}
.score {
text-align: center;
}
.score:after {
content:attr(data-badge);
position: absolute;
margin-left: .4em;
font-size: x-small;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: 700;
line-height: 1;
color: #FFF;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
background-color: #777;
border-radius: 10px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-xs-3">
<div class="center-horizontal-inline vote"> <i class="glyphicon glyphicon-chevron-up"></i>
</div>
<div class="score" data-badge="+5">115</div>
<div class="center-horizontal-inline"> <i class="glyphicon glyphicon-chevron-down"></i>
</div>
</div>
Okay so I am trying to integrate a link into the flow of the paragraph (directly to the right of '1.' but for some reason it is not showing up? How do I make it integrate into the flow.
Here is a http://jsfiddle.net/5CMfv/ for reference
Thanks
<div id="home-infobox">
<div class="infobox_picture">
<img src="images/image1.png" width="91" height="90">
<a style="position:absolute; padding-left:30px;"><h1>Image1</h1><p>Kappa kappa kaap 1. <p>more</p></a>
</div>
<div class="infobox_picture">
<img src="images/news.jpg" width="92" height="90">
<a style="position:absolute; padding-left:30px;"><h1>NEWS</h1><p>DKappakpapapapa</p> </a>
</div>
<div class="infobox_picture">
<img src="images/314.JPG" width="93" height="90">
<a style="position:absolute; padding-left:30px;"><h1>The Team</h1><p>KappaKappa </p> </a>
</div>
</div>
#home-infobox{
height: 335px;
background-color:#425eb4;
background-repeat: no-repeat;
background-position: left top;
width: 450px;
float: left;
position: absolute;
top:250px;
left:80px;
}
#home-infobox{
height: 335px;
background-color:#425eb4;
background-repeat: no-repeat;
background-position: left top;
width: 450px;
float: left;
position: absolute;
top:250px;
left:80px;
}
.infobox_picture {
margin-top: 15px;
margin-right: 10px;
margin-bottom: 15px;
margin-left: 10px;
clear: both;
background-position: center bottom;
background-repeat: no-repeat;
background-color: white;
height: 90px;
position: relative;
}
.home-infobox ~ .home-infobox:before {
content: '';
position: absolute;
left: 0;
top: -8px;
width: 100%;
border-top: 1px solid black;
}
#home_infobox p a{
color: #3B4B7E;
text-decoration: none;
z-index:999;
position:relative;
}
#home_infobox p a:hover{
color: #475883;
text-decoration: underline;
}
h1 {font-family:'Montserrat', sans-serif; font-size:15px; position:relative; z- index:999}
h2 {font-family: 'Montserrat', sans-serif; font-size:25px; position:relative;}
h3 {font-family:'Montserrat', sans-serif; font-size:15px; position:relative; z-index:999}
You have invalid HTML:
<p>Kappa kappa kaap 1.<p>more</p>
should be:
<p>Kappa kappa kaap 1. more</p>
On further inspection, you have other HTML issues as well.
http://validator.w3.org/
You can do it like this:
<div class="infobox_picture">
<img src="images/image1.png" width="91" height="90">
<div style="display:inline-block; position:absolute; padding-left:30px;">
<h1>Image1</h1>
<p>Kappa kappa kaap 1.</p>
<p>more</p>
</div>
</div>
An a element always has to have an href attribute. It's better to put an 'a' inside a text element. So, i'va put a div element on de place where you had an 'a' element, and added the display:inline-block css-property to make this block element behave somewhat like the inline 'a' element.
I want a sidebar which takes the full height of the screen and doesn't change when scrolling down.
So when I scroll only the contents changes but the navbar stays always the same.
I made a first example: http://jsfiddle.net/CwSD6/
But the none-scroll functionality is missing...
Regards
EDIT:
You need to use position: fixed, and top, bottom, left with value 0.
http://jsfiddle.net/CwSD6/1/
it can be done by doing position: fixed; in <aside>
see this fiddle jsfiddle
Try this:
aside
{
position: fixed;
width: 200px;
height: 100%;
top: 0;
left: 0;
border: 1px solid #111;
}
Hope this helps
I use the jQuery method as using fixed or absolute usually screws with my grid layout. In the example below my grid collapses when under 990px width so you would need to change this assuming you are doing responsive.
$(window).resize(function() {
var doc_height = $(document).height();
var doc_width = $(document).width()
if (doc_width > 990) {
$('#sidebar').css("height", doc_height);
} else {
$('#sidebar').css("height", 'auto');
}
});
Although this may not be the most efficient way, you don't need to set variables. I find it helps with readability.
Kind Regards,
M
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: -1;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
p {
font-size: 1.125rem;
}
label {
display: flex;
align-items: center;
font-size: 1.125rem;
margin-bottom: 0.5rem;
}
HTML code start here
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="css/adminhome.css">
<link href=”https://cdn.jsdelivr.net/npm/bootstrap#5.1.1/dist/css/bootstrap.min.css” rel=”stylesheet” integrity=”sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU” crossorigin=”anonymous”>
<link href="https://allfont.net/allfont.css?fonts=montserrat-bold" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
<title>home</title>
</head>
<body>
<header>
<div class="tpe">
<p>Admin</p>
</div>
<div class="headbar">
<a href="adminallusers.html" class="allusers">
<i class="fas fa-users"></i>
<span class="users">All Users</span>
</a>
<a href="#" class="admin">
<i class="fas fa-user"></i>
<span class="user">Admin</span>
</a>
</div>
</header>
<nav>
<ul>
<li>
<a href="#">
<i class="fas fa-home"></i>
<span class="nav-item">Home</span>
</a>
</li>
<li>
<a href="#">
<i class="fas fa-ticket-alt"></i>
<span class="nav-item">Tickets</span>
</a>
</li>
<li>
<a href="#">
<i class="fas fa-upload"></i>
<span class="nav-item">Upload</span>
</a>
</li>
<li>
<a href="#">
<i class="fas fa-tasks"></i>
<span class="nav-item">Status</span>
</a>
</li>
<li>
<a href="#" class="logout">
<i class="fas fa-sign-out-alt"></i>
<span class="nav-item">Log out</span>
</a>
</li>
</ul>
</nav>
</body>
</html>
HTML end here
CSS start from here
#import url('https://allfont.net/allfont.css?fonts=montserrat-bold');
*{
margin: 0;
padding:0;
outline: none;
border: none;
text-decoration: none;
box-sizing: border-box;
font-family: Montserrat, "Open Sans", Helvetica, Arial, sans-serif;
}
body{
background-color: white;
}
header{
position: fixed;
background:#404258;
height: 45px;
width: 100%;
overflow: hidden;
transition: width 0.2s linear;
}
header .tpe p{
font-size: 28px;
font-weight:900;
float: left;
color:white;
text-transform: uppercase;
margin-left:130px;
}
header a{
position: relative;
color: white;
font-size: 15px;
font-weight: 600;
display: table;
width: 300px;
padding: 10px;
}
header:hover{
background-color: none;
}
.admin{
padding:1px;
background:none;
text-decoration: none;
float: right;
margin-top:0px;
width:10%;
margin-right:-10px;
font-size: 15px;
font-weight:550;
color: white;
}
.allusers{
padding:1px;
background:none;
text-decoration: none;
float: right;
width:20%;
margin-top:0px;
margin-right:-100px;
font-size: 15px;
font-weight:550;
color: white;
}
.user{
position:relative;
top:10px;
margin-right:-50px;
width: 250px;
}
.users{
position:relative;
top:10px;
margin-right:auto;
width: 250px;
}
nav{
position: fixed;
top:45px;
bottom:-60px;
height: 100%;
left: 0;
background:#404258;
width: 90px;
overflow: hidden;
transition: width 0.2s linear;
}
nav a{
position: relative;
color: white;
font-size: 14px;
font-weight:600;
display: table;
width: 300px;
padding: 10px;
}
.fas{
position: relative;
width: 70px;
height: 40px;
top: 14px;
font-size: 20px;
text-align: center;
}
.nav-item{
position:relative;
top:12px;
margin-left:10px;
}
nav a:hover{
background: #A6ADC2;
}
nav:hover{
width: 200px;
transition: all 0.5s ease;
}
.logout{
position: absolute;
bottom: -20;
}
CSS end here