first time posting a question here, hope someone can help!
I want to create a list of social media icon/links
<div class="social-links">
<ul>
<li class="m-link">
<i class="far fa-envelope"></i>
</li>
<li class="m-link">
<i class="fab fa-linkedin-in"></i>
</li>
<li class="m-link">
<i class="far fa-address-card"></i>
</li>
</ul>
</div>
.m-link {
width: 2em;
height: 2em;
text-align: center;
list-style: none;
margin: 10px 30px;
display: inline-block;
font-size: 2.5em;
line-height: 2em;
color: #e2e2e2;
border: 1px solid #e2e2e2;
border-radius: 50%;
cursor: pointer;
transition: 0.5s;
}
.m-link:hover {
background-color: #e2e2e2;
color: #0b0a08;
box-shadow: 0 0 15px #9ecaed;
}
.m-link a {
text-decoration: none;
color: #e2e2e2;
}
My problem is that in this way the hover color doesn't apply on the icon/link, I tried to add an extra hover just for the ".m-link a" like so..
.m-link a:hover {
color: #0b0a08;
}
but in this way the color apply only when my cursor is on the link and not when I hover on the list element.
Still a beginner here, someone help pleaseeee!!
You need to target the element inside the element on hover, like this
.m-link:hover a > i { /* 'on hover on .m-link class element, then i inside a will take this css code */
background-color: #e2e2e2;
color: #0b0a08;
box-shadow: 0 0 15px #9ecaed;
}
.m-link {
width: 2em;
height: 2em;
text-align: center;
list-style: none;
margin: 10px 30px;
display: inline-block;
font-size: 2.5em;
line-height: 2em;
color: #e2e2e2;
border: 1px solid #e2e2e2;
border-radius: 50%;
cursor: pointer;
transition: 0.5s;
}
.m-link:hover a > i {
background-color: #e2e2e2;
color: #0b0a08;
box-shadow: 0 0 15px #9ecaed;
}
.m-link a {
text-decoration: none;
color: #e2e2e2;
}
<script src="https://kit.fontawesome.com/9114d9acc8.js" crossorigin="anonymous"></script>
<div class="social-links">
<ul>
<li class="m-link">
<i class="far fa-envelope"></i>
</li>
<li class="m-link">
<i class="fab fa-linkedin-in"></i>
</li>
<li class="m-link">
<i class="far fa-address-card"></i>
</li>
</ul>
</div>
Related
I'm trying to give hover effect to .login-2-submenu a background effect on all li tags but not effecting at all , tried all possible methods. i tried to give ul to class but not worked i also tried to classs in li not worked as well ,
Am I missing something?
here is my html code
<nav>
<ul class="flex">
<li class="px-2"> <input class="searchbox px-2" type="search" name="search"
placeholder="Search for products, brands and more" autocomplete="off"><i class="fa-solid fa-magnifying-glass"></i>
</li>
<li class="btn-li px-2"> <button>Login</button>
<div class="login-submenu">
<div class="login1-1-submenu">
<h4>New Customer?</h4>
<a class="black" href="#">Sign Up</a>
</div>
<div class="login-2-submenu">
<ul>
<l1 class="block px border"><a class="black" href=""><i class="fa-solid fa-user"></i>My
Profile</a></l1>
<l1 class="block px border"><a class="black" href=""><i
class="fa-solid fa-circle-plus"></i>Flipkart Plus Zone</a></l1>
<l1 class="block px border"><a class="black" href=""><i
class="fa-solid fa-bag-shopping"></i>Orders</a></l1>
<l1 class="block px border"><a class="black" href=""><i
class="fa-solid fa-heart"></i>Wishlist</a></l1>
<l1 class="block px border"><a class="black" href=""><i
class="fa-solid fa-circle-dollar-to-slot"></i>Rewards</a></l1>
<l1 class="block px border"><a class="black" href=""><i
class="fa-solid fa-gift"></i>Gift Cards</a></l1>
</ul>
</div>
</div>
</li>
<li class="px-4"> Become a Seller</li>
<li class="px-4 toggle"> More
<div class="sub-menu">
<ul>
<li><i class="fa-solid fa-bell"></i>Notification Preferances</li>
<li><i class="fa-solid fa-question"></i>24/7 Customer Care
</li>
<li><i class="fa-solid fa-arrow-trend-up"></i>Advertise</li>
<li><i class="fa-solid fa-download"></i>Download App</li>
</ul>
</div>
</li>
<li class="px-5"> <i class="fa-solid fa-cart-shopping"></i>Cart</li>
</ul>
</nav>
and css
.sub-menu {
display: block;
position: absolute;
right: 170px;
top: 50px;
background-color: white;
width: 250px;
box-shadow: 0 3px 10px rgb(0 0 0 / 0.2);
}
.sub-menu ul {
text-align: left;
margin: 0;
padding: 0;
}
.sub-menu ul li {
padding: 15.3px 10px;
border-bottom: 1px solid #d0d9d4;
}
.sub-menu .fa-solid {
padding: 0 10px;
color: #2874f0;
}
.sub-menu ul li:hover {
background-color: #ebf2f0;
}
.sub-menu ul li a {
color: black;
}
/* -----------------------------------------------------------------------login-submenu---------------------------------------------- */
.login-submenu {
background-color: white;
position: absolute;
top: 50px;
right: 465px;
box-shadow: 0 3px 10px rgb(0 0 0 / 0.2);
height: 345px;
width: 250px;
}
.login-submenu ul {
padding: 0;
margin: 0;
}
.login-submenu .fa-solid {
padding: 0 10px;
color: #2874f0;
}
.sign {
color: blue !important;
font-size: 15px;
font-weight: 600;
transform: translate(160px, 0);
}
.login-submenu ul li:hover {
background-color: #28cf8c !important;
}
.login1-1-submenu {
display: flex;
border-bottom: 1px solid #d0d9d4;
padding: 15px 10px;
}
.login1-1-submenu h4 {
color: rgba(20, 20, 20, 0.9);
}
.login1-1-submenu a {
padding-left: 50px;
color: blue;
font-weight: 600;
}
.login1-1-submenu:hover {
background-color: #ebf2f0;
}
.login-2-submenu ul li:hover {
background-color: #ebf2f0 !important;
}
I'm tried to give hover effect to login-2-submenu but not working but other hover effect are working.
<l1 class="block px border"> just look this code, you have typed l1 instead of li
all li tags are misspelled in under .login-2-submenu
I am trying to achieve this
I want my navbar to work so that on hover it fills up to each side of the background of the original nav divs background. Because otherwise it keeps on making small squares inside of the UL. I don't know why setting padding inside the class i specified in the a links does not fix this problem. I left borders around each element to make it easier to follow what im saying. When I hover on home it only stays in a small box around the letters and the color doesnt extend to the end.
.nav_links{
font-weight: bold;
font-size: 1.5rem;
padding: .5rem;
list-style-type: none;
border: 5px solid black;
}
.nav_link{
padding: 1rem;
text-decoration: none;
color: #F4D06F;
text-transform: capitalize;
display: block;
padding: 0.5rem 1rem;
transition: all 0.5s ease-in-out;
padding: 0.5rem 1rem;
border: 5px solid black;
}
.nav_link:hover{
border: black;
background: var(--Cwhite);
padding: .5rem;
}
li:not(:last-child) {
margin-bottom: 5px;
}
<header class="header" id="header">
<div class="banner">
<h1 class="banner-title">Pen Pen Pizza</h1>
<div class="banner-icons">
<a href="#" class="banner_social-icon">
<i class="fab fa-facebook fa-fw"></i>
</a>
<a href="#" class="banner_social-icon">
<i class="fab fa-twitter fa-fw"></i>
</a>
<a href="#" class="banner_social-icon">
<i class="fab fa-google-plus fa-fw"></i>
</a>
<a href="#" class="banner_social-icon">
<i class="fab fa-instagram fa-fw"></i>
</a>
</div>
</div>
<div class="navBtn">
<i class="fas fa-bars"></i>
</div>
<nav class="nav">
<ul class="nav_links">
<li>Home</li>
<li>About</li>
<li>Contest</li>
<li>Work</li>
<li>Contact</li>
</ul>
</nav>
</header>
The problem is that the ul element has a browser default padding-left of about 40px.
So if you need your li element to flush to the left you have to custom style your nav-links which is a ul element.
.nav_links{
font-weight: bold;
font-size: 1.5rem;
padding-left: 0 !important;
list-style-type: none;
border: 5px solid black;
}
maybe I've misunderstood something _
but shouldn't
.nav_link:hover {
border: black;
background: var(--Cwhite);
padding: .5rem;
}
be
.nav_link:hover {
border: black;
background: var(--white);
padding: .5rem;
}
I am trying to make the color of the side bar. when I try to make the browser window small the color at the bottom left is like a faded black and white and I am trying to make the scrollbar hidden but still can scroll and also looking a CSS code that can make the word steady when I close and open my side navigation menu.
Thank you for helping me in advance.
enter image description here
my css code
.contentnav{
height: 100%;
color: rgba(255,255,255,1);
background: rgba(0, 0, 0, 0.6);
top: 0;
left: 0;
padding-top: 50px;
transition: left 0.3s linear;
width: 50px;
display: block;
}
.contentnav::-webkit-scrollbar-thumb{
background: #115a01;
outline: 1px solid rgba(255,255,255,1);
}
.contentnav::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
.contentnav::-webkit-scrollbar {
width: 0.4em;
}
.contentnav ul li ul{
display: none;
}
.contentnav ul i{
margin-left: 10px;
color: #FFFFFF;
text-shadow: 1px 1px 1px #000;
padding: 5px;
width: 25px;
padding-bottom: 8px;
cursor: pointer;
vertical-align:middle;
}
.contentnav ul{
list-style: none;
margin:0px;
padding:0px;
}
.contentnav ul span{
position: absolute;
margin-left: 21px;
cursor: pointer;
margin-top: 5px;
float: left;
}
.contentnav i:hover{
color: rgba(0,204,102,1);
}
my html code
<div class="contentnav" id="contentmenu">
<ul>
<li>
<i class="fas fa-home"></i>
<span id="same" class="nav-text">Home</span>
</li>
<li>
<i class="fas fa-book"></i>
<span id="same" class="nav-text">L</span>
<ul>
<li>-Bo</li>
<li>-B</li>
<li>-R</li>
<li>-E</li>
<li>-P</li>
</ul>
</li>
<li>
<i class="fas fa-hourglass-half"></i>
<span id="same" class="nav-text">Online</span>
</li>
<li>
<i class="fas fa-bookmark"></i>
<span id="same" class="nav-text">E</span>
<ul>
<li>-S</li>
<li>-Fee</li>
</ul>
</li>
<li>
<i class="fas fa-file-alt"></i>
<span id="same" class="nav-text">C</span>
</li>
<li>
<i class="fas fa-clipboard"></i>
<span id="same" class="nav-text">G</span>
</li>
<li>
<i class="fas fa-info-circle"></i>
<span id="same" class="nav-text">Announcement</span>
</li>
<li>
<i class="far fa-calendar-alt"></i>
<span id="same" class="nav-text">Calendar</span>
</li>
<li>
<i class="fab fa-hire-a-helper"></i>
<span id="same" class="nav-text">Guides</span>
</li>
<li>
<i class="fas fa-sign-out-alt"></i>
<span id="same" class="nav-text">Logout</span>
</li>
</ul>
</div>
I think this should do the trick.
Remove this and
.contentnav::-webkit-scrollbar-thumb{
background: #115a01;
outline: 1px solid rgba(255,255,255,1);
}
.contentnav::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
.contentnav::-webkit-scrollbar {
width: 0.4em;
}
Replace it with this.
.contentnav::-webkit-scrollbar-button
{
display: block;
height: 13px;
border-radius: 0px;
background-color: #AAA;
}
.contentnav::-webkit-scrollbar-button:hover
{
background-color: #AAA;
}
.contentnav::-webkit-scrollbar-thumb
{
background-color: #CCC;
}
.contentnav::-webkit-scrollbar-thumb:hover
{
background-color: #CCC;
}
.contentnav::-webkit-scrollbar-track
{
background-color: #efefef;
}
.contentnav::-webkit-scrollbar-track:hover
{
background-color: #CCC;
}
.contentnav::-webkit-scrollbar
{
width: 15px;
}
.new-application-menu {
background-color: #47484c;
height: 100%;
padding: 0px;
z-index: 10;
box-shadow: -1px 0px 2px #000000;
}
.new-application-menu ul {
color: #fff;
/* border: 1px solid white; */
}
.new-application-menu ul li {
padding: 8px;
border-bottom: 0.01px solid rgba(255, 255, 255, 0.2);
background-color: #27A9E3;
}
.new-application-menu ul li p {
font-size: 12px;
padding: 5px;
}
.new-application-menu ul li i {
font-size: 12px;
color: rgba(255, 255, 255, 0.8);
}
<div class="col-md-1 new-application-menu">
<ul class="nav navbar-nav text-center">
<li><img src="assets/Img/logo2.png" width="55" height="95"></li>
<li> <i class="material-icons" style="font-size:36px">description</i>
<p>بانک جامع اطلاعاتی</p>
</li>
<li> <i class="material-icons" style="font-size:36px">assessment</i>
<p>نبض شهر</p>
</li>
<li> <i class="material-icons" style="font-size:36px">colorize</i>
<p>آزمایشگاه شهری</p>
</li>
<li> <i class="material-icons" style="font-size:36px">remove_red_eye</i>
<p>رصد طرح های توسعه ی شهری</p>
</li>
<li> <i class="material-icons" style="font-size:36px">location_city</i>
<p>رصد پروژه های شهری</p>
</li>
</ul>
</div>
When I'm using this code and my list feature's height exceeds my page size, it automatically adds a scrollbar to my page and it causes to my grid system to overlay each other. How can I prevent this overlay?
You can use your custom class like .myLogo as i added
.new-application-menu {
background-color: #47484c;
height: 100%;
padding: 0px;
z-index: 10;
box-shadow: -1px 0px 2px #000000;
}
.new-application-menu ul
{
color: #fff;
/* border: 1px solid white; */
}
.new-application-menu ul li
{
padding: 8px;
border-bottom: 0.01px solid rgba(255,255,255,0.2);
background-color: #27A9E3;
}
.new-application-menu ul li p
{
font-size: 12px;
padding: 5px;
}
.new-application-menu ul li i
{
font-size: 12px;
color: rgba(255,255,255,0.8);
}
.myLogo{ width:100px; height:100px;}
<div class="col-md-1 new-application-menu">
<ul class="nav navbar-nav text-center">
<li><img src="assets/Img/logo2.png" width="55" height="95" class="myLogo"></li>
<li> <i class="material-icons" style="font-size:36px">description</i><p>بانک جامع اطلاعاتی</p></li>
<li> <i class="material-icons" style="font-size:36px">assessment</i> <p>نبض شهر</p></li>
<li> <i class="material-icons" style="font-size:36px">colorize</i><p>آزمایشگاه شهری</p> </li>
<li> <i class="material-icons" style="font-size:36px">remove_red_eye</i><p>رصد طرح های توسعه ی شهری</p> </li>
<li> <i class="material-icons" style="font-size:36px">location_city</i><p>رصد پروژه های شهری</p> </li>
</ul>
</div>
I'm training my bad css skills and I can't figure out how create a left navbar (see the image below).
Note: I already have a top navbar... And in the middle of both will exist the content of page.
<aside>
<div class="navbar navbar-fixed-left">
<ul class="nav navbar-nav">
<li style="border-right: 0px solid #bdc3c7; border-top: 0.5px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i> CREATE
</a>
</li>
<li style="border-top: 1px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i> CREATE
</a>
</li>
<li style="border-top: 1px solid #bdc3c7; border-bottom: 1px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i> CREATE
</a>
</li>
</ul>
</div>
</aside>
And my css:
.navbar-fixed-left {
width: 180px;
position: fixed;
border-radius: 0;
height: 100%;
background-color: #F0F0F0;
border-right: 1px solid #bdc3c7;
}
.navbar-fixed-left .navbar-nav > li {
float: none;
width: 178px;
}
.navbar-fixed-left + .container {
padding-left: 160px;
}
.navbar-fixed-left .navbar-nav > li > .dropdown-menu {
margin-top: -50px;
margin-left: 140px;
}
aside {
margin-top: 55px;
}
You can try CSS Flexbox. Make your ul li a element a flex container & wrap your text inside a wrapper (in my case .text). And apply the following properties:
ul li a {
display: flex;
text-decoration: none;
}
Have a look at the snippet below:
body {
margin: 0;
}
.navbar-fixed-left {
width: 180px;
position: fixed;
border-radius: 0;
height: 100%;
background-color: #F0F0F0;
border-right: 1px solid #bdc3c7;
}
.navbar-fixed-left + .container {
padding-left: 160px;
}
.navbar-fixed-left .navbar-nav > li > .dropdown-menu {
margin-top: -50px;
margin-left: 140px;
}
aside {
margin-top: 55px;
}
ul {
list-style: none;
padding: 0;
margin: 0;
}
ul li a {
display: flex;
text-decoration: none;
}
ul li a:hover {
background: #E0E1E6;
}
ul li a i {
padding: 10px;
border-right: 1px solid #bdc3c7;
}
ul li a .text {
padding: 10px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<aside>
<div class="navbar navbar-fixed-left">
<ul class="nav navbar-nav">
<li style="border-right: 0px solid #bdc3c7; border-top: 0.5px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i><span class="text">CREATE</span>
</a>
</li>
<li style="border-top: 1px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i><span class="text">CREATE</span>
</a>
</li>
<li style="border-top: 1px solid #bdc3c7; border-bottom: 1px solid #bdc3c7;">
<a href="#">
<i class="fa fa-plus" aria-hidden="true" style="color: grey;"></i><span class="text">CREATE</span>
</a>
</li>
</ul>
</div>
</aside>
Hope this helps!
Try this following code,
<!DOCTYPE html>
<html lang="en">
<head>
<title>Menu</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />
</head>
<body class="no-skin">
<div id="sidebar" class="sidebar responsive ace-save-state">
<ul class="nav nav-list">
<li class="">
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-list"></i>
<span class="menu-text"> Applications </span>
<b class="arrow fa fa-angle-down"></b>
</a>
<b class="arrow"></b>
</li>
<li class="">
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-list"></i>
<span class="menu-text"> Applications </span>
<b class="arrow fa fa-angle-down"></b>
</a>
<b class="arrow"></b>
</li>
</ul><!-- /.nav-list -->
</div>
</body>
</html>
To get the related CSS files, Click Here https://github.com/suthagar23/AdmissionSystem/tree/master/public
EDIT: I think the issue is snippet output's viewport is smaller and eats some styles, you will have to tweak values through #media querys if you wish to preserve responsiveness with the code you provided:
Full resizable JSFiddle here (a few CSS were changed vs the snippet below, to make it look ok on bigger viewport)
Big viewport:
Smaller viewport:
Isolate icons from text menu by wrapping text on <span>. Make lis relative and icons absolute and adjust values as desired:
.navbar-fixed-left {
width: 180px;
position: fixed;
border-radius: 0;
height: 100%;
background-color: #F0F0F0;
border-right: 1px solid #bdc3c7;
}
ul.nav.navbar-nav {
margin-top: 0;
}
.navbar-fixed-left .navbar-nav li {
float: none;
width: 194px;
border-top: 1px solid #bdc3c7;
position: relative;
border-right: 1px solid lightgray;
}
li:nth-child(3) {
border-bottom: 1px solid #bdc3c7;
}
.navbar-fixed-left .navbar-nav li a:hover {
background-color: gainsboro;
}
.navbar-fixed-left + .container {
padding-left: 160px;
}
.navbar-fixed-left .navbar-nav > li > .dropdown-menu {
margin-top: -50px;
margin-left: 140px;
}
span {
margin-left: 60px;
color: gray;
}
aside {
margin-top: 55px;
}
i.fa {
border-right: 1px solid #bdc3c7;
padding: 10px 15px;
position: absolute;
top: 0;
bottom: 0;
line-height: 20px;
}
.color1 {
border-left: 3px solid red;
margin-left: -1px;
}
.color2 {
border-left: 3px solid blue;
margin-left: -1px;
}
.color3 {
border-left: 3px solid green;
margin-left: -1px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<aside>
<div class="navbar navbar-fixed-left">
<ul class="nav navbar-nav">
<li>
<a href="#">
<i class="fa fa-plus color1" aria-hidden="true" style="color: grey;"></i><span>CREATE</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-plus color2" aria-hidden="true" style="color: grey;"></i><span>CREATE</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-plus color3" aria-hidden="true" style="color: grey;"></i><span>CREATE</span>
</a>
</li>
</ul>
</div>
</aside>