.social-buttons ul li .fab:hover{
font-size: 30px;
}
.social-buttons{
position: absolute;
top: 100px;
left: 20px;
}
.social-buttons ul{
list-style: none;
}
.social-buttons ul li{
position: relative;
height: 50px;
width: 50px;
background-color: white;
border-radius: 10px;
margin: 10px 0px;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.social-buttons ul li .fab{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
font-size: 25px;
}
.social-buttons ul li .fab:hover{
font-size: 30px;
}
<script src="https://kit.fontawesome.com/fc692f1356.js" crossorigin="anonymous"></script>
<div class="social-buttons">
<ul>
<a href="#">
<li>
<i class="fab fa-instagram"></i>
</li>
</a>
<a href="#">
<li>
<i class="fab fa-pinterest"></i>
</li>
</a>
<a href="#">
<li>
<i class="fab fa-facebook-f"></i>
</li>
</a>
<a href="#">
<li>
<i class="fab fa-youtube"></i>
</li>
</a>
</ul>
I wrote the above code. It only increases the font size when hovering on only icons.
In the above fiddle . I want to change the font size(icon size) of .fab(icons) when the user hovers on .social-buttons ul li(the box covering the social media icons)
Replace .social-buttons ul li .fab:hover{ with .social-buttons ul li:hover .fab{.
Please note that your HTML is currently invalid. You have useless a tags wrapping your list items. Remove those, they're not allowed at that point. ul can only have li children. If you want the link-like mouse cursor, just add cursor: pointer; on the li.
.social-buttons {
position: absolute;
top: 100px;
left: 20px;
}
.social-buttons ul {
list-style: none;
}
.social-buttons ul li {
position: relative;
height: 50px;
width: 50px;
background-color: white;
border-radius: 10px;
margin: 10px 0px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
cursor: pointer;
}
.social-buttons ul li .fab {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 25px;
}
.social-buttons ul li:hover .fab {
font-size: 30px;
}
<script src="https://kit.fontawesome.com/fc692f1356.js" crossorigin="anonymous"></script>
<div class="social-buttons">
<ul>
<li>
<i class="fab fa-instagram"></i>
</li>
<li>
<i class="fab fa-pinterest"></i>
</li>
<li>
<i class="fab fa-facebook-f"></i>
</li>
<li>
<i class="fab fa-youtube"></i>
</li>
</ul>
</div>
Related
I want the website to open the link after pressing the button, and not like it is now that I have to press the icon to open the link. I have to click on the small icon for the link to open and I want to make this link open as if you press the button
and if someone would like it, here are nice transitions, maybe someone will be useful
li {
display: block;
float: left;
}
nav ul {
list-style-type: none;
}
nav li {
width: 30px;
height: 30px;
text-align: center;
position: relative;
transition: 0.3s;
margin: 3rem;
}
nav li::before,
nav li::after {
content: '';
position: absolute;
width: inherit;
height: inherit;
top: 0;
left: 0;
transition: 0.3s;
}
nav li::before {
background-color: white;
z-index: -1;
box-shadow: 0.2rem 0.2rem 0.5rem rgba(0, 0, 0, 0.2);
}
nav li::after {
background-color: #66CCFF;
transform: translate(1.5rem, 1.5rem);
z-index: -2;
}
nav li:hover {
transform: translate(1.5rem, 1.5rem);
color: white;
}
nav li:hover::before {
background-color: #66CCFF;
}
nav li:hover::after {
background-color: white;
transform: translate(-1.5rem, -1.5rem);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<nav id="social">
<ul>
<li><i class="fa fa-facebook-f"></i></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-github"></i></li>
</ul>
</nav>
You should create a button and do this, and if its not what u want then please explain your question
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<title></title>
</head>
<body>
<nav id="social">
<ul>
<li><i class="fa fa-facebook-f"><button type="button" name="button">Fb</button></i></li>
<li><i class="fa fa-instagram"><button type="button" name="button">Fb</button></i></li>
<li><i class="fa fa-twitter"><button type="button" name="button">Fb</button></i></li>
<li><i class="fa fa-github"><button type="button" name="button">Fb</button></i></li>
</ul>
</nav>
</body>
</html>
I already know. I thought you can't give a href out of the list, but you can
<li><i class="fa fa-github"></i></li>
Try adding this style. This basically expands your anchor to occupy the full <li> size.
nav li a {
height: 100%;
display: block;
}
Full previewable code:
li {
display: block;
float: left;
}
nav ul {
list-style-type: none;
}
nav li {
width: 30px;
height: 30px;
text-align: center;
position: relative;
transition: 0.3s;
margin: 3rem;
}
nav li::before,
nav li::after {
content: '';
position: absolute;
width: inherit;
height: inherit;
top: 0;
left: 0;
transition: 0.3s;
}
nav li::before {
background-color: white;
z-index: -1;
box-shadow: 0.2rem 0.2rem 0.5rem rgba(0, 0, 0, 0.2);
}
nav li::after {
background-color: #66CCFF;
transform: translate(1.5rem, 1.5rem);
z-index: -2;
}
nav li:hover {
transform: translate(1.5rem, 1.5rem);
color: white;
}
nav li:hover::before {
background-color: #66CCFF;
}
nav li:hover::after {
background-color: white;
transform: translate(-1.5rem, -1.5rem);
}
nav li a {
height: 100%;
display: block;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<nav id="social">
<ul>
<li><i class="fa fa-facebook-f"></i></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-github"></i></li>
</ul>
</nav>
I'm tying to get a ul to drop down a few link icons, but no matter what I type, the only thing that changes is the orientation of the icons. I feel like I'm missing something rather simple, but nor Google or Foundation's website have helped. I've tried calling to the nested ul using .menu li a i {}, but that's wrong. I've tried other ways as well with no positive results.
/* Styles go here */
.menu-hover-lines {
margin-top: 30px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 500;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: #333;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li.active>a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
.menu li a>i {
display: none;
}
.menu i:hover {
display: inline;
}
<script src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />
<ul class="menu dropdown vertical menu-hover-lines" data-dropdown-menu="">
<li>
Get in touch
<ul class="menu">
<li>
<a href="#">
<i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i>
</a>
</li>
<li>
<a href="http://twitter.com">
<i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i>
</a>
</li>
<li>
<a href="http://instagram.com">
<i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i>
</a>
</li>
</ul>
</li>
</ul>
you have to add a div to the outside of all your content for the hover effect
/* Styles go here */
.menu-hover-lines {
margin-top: 30px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 500;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: #333;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li.active>a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
ul .menu {
display: none;
}
.drop_down:hover ul .menu{
display: inline;
}
<script src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />
<div class="drop_down">
<ul class="menu dropdown vertical menu-hover-lines" data-dropdown-menu="">
<li>
Get in touch
<ul class="menu">
<li class="content">
<a href="#">
<i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i>
</a>
</li>
<li class="content">
<a href="http://twitter.com">
<i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i>
</a>
</li>
<li class="content">
<a href="http://instagram.com">
<i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i>
</a>
</li>
</ul>
</li>
</ul>
</div>
For some reason I can't get my last nav link to stay with the rest of them. I can do this if i set .dropdown ul li .menu position to absolute, but then the drop down links are pushed to the right and not centered. Padding-right nor margin-right doesn't resolve this issue.
JSFiddle
Before
After
Position: Absolute
.title {
font-family: 'Philosopher', sans-serif;
margin-left: 20px;
color: white;
float: left;
padding-right: 70px;
padding-top: 5px;
}
#body {
background-color: black;
}
.dropdown ul {
padding-top: 10px;
}
.dropdown ul li .menu {
position: absolute;
float: none;
}
.menu-hover-lines {
margin-top: 35px;
float: right, bottom;
text-align: center;
text-transform: uppercase;
font-weight: 400;
letter-spacing: 3px;
transition: all 0.35s ease;
}
.menu-hover-lines li a {
padding: 0.75rem 0;
color: white;
position: relative;
margin-left: 1rem;
margin-right: 4rem;
margin-top: 20px;
}
.menu-hover-lines li:first-child a {
margin-left: 10px;
}
.menu-hover-lines li.active > a {
background-color: transparent;
}
/* Nav transition settings */
.menu-hover-lines a::before,
.menu-hover-lines a::after {
height: 3px;
position: absolute;
content: '';
transition: all 0.40s ease;
background-color: #932929;
width: 0;
}
.menu-hover-lines a::before {
top: 0;
left: 0;
}
.menu-hover-lines a::after {
bottom: 0;
right: 0;
}
/* Nav text settings on hover*/
.menu-hover-lines a:hover,
.menu-hover-lines li.active > a {
color: #8e8e8e;
transition: all 0.40s ease;
}
.menu-hover-lines a:hover::before,
.menu-hover-lines .active a::before,
.menu-hover-lines a:hover::after,
.menu-hover-lines .active a::after {
width: 100%;
}
.dropdown li .menu {
display: none;
}
.dropdown li:hover .menu {
display: inline-block;
float: none;
}
<!-- Nav Bar -->
<div class="dropdown" >
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li >Collections
<ul class="menu">
<li>Autos</li>
<li>Models</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
I think you need to add left:0 and top:100% to your dropdown-menu with position:absolute. Remember to add position:relative to your .menu>li...
I have added .dropdown-menu class in the dropdown ul...
Also I noticed that you have written float: right, bottom in your css which is not valid...
Stack Snippet
body {
font: 13px Verdana;
}
.menu {
padding: 0;
display: flex;
}
.menu>li {
margin: 0 10px;
list-style: none;
position: relative;
}
.menu li a {}
.dropdown-menu {
padding: 0;
position: absolute;
top: 100%;
left: 0;
border: 1px solid;
padding: 10px;
}
.dropdown-menu>li {
list-style: none;
}
<!-- Nav Bar -->
<div class="dropdown">
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li>Collections
<ul class="dropdown-menu">
<li>Autos</li>
<li>Models</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
I am working on a navigation sidebar with icons which on hover display text along with icon with reference to JFarrow's https://codepen.io/JFarrow/pen/fFrpg
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">Dashboard</span>
</a>
</li>
But in my case I would like to hide icons when I hover on the sidebar and display only text.
May I know a best way to do this?
A pure css solution would be the next:
Hope this helps
Hice icon image
nav.main-menu:hover i:before {
display: none;
}
Adapt sidebar width
nav.main-menu:hover {
width:200px;
}
Reduce icon space
nav.main-menu:hover .fa{
width: 10px;
}
Added snipet so everyone can try it
#import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
}
#import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 20px;
}
.main-menu:hover,
nav.main-menu.expanded {
width: 250px;
overflow: visible;
}
.main-menu {
background: #212121;
border-right: 1px solid #e5e5e5;
position: absolute;
top: 0;
bottom: 0;
height: 100%;
left: 0;
width: 60px;
overflow: hidden;
-webkit-transition: width .05s linear;
transition: width .05s linear;
-webkit-transform: translateZ(0) scale(1, 1);
z-index: 1000;
}
.main-menu>ul {
margin: 7px 0;
}
.main-menu li {
position: relative;
display: block;
width: 250px;
}
.main-menu li>a {
position: relative;
display: table;
border-collapse: collapse;
border-spacing: 0;
color: #999;
font-family: arial;
font-size: 14px;
text-decoration: none;
-webkit-transform: translateZ(0) scale(1, 1);
-webkit-transition: all .1s linear;
transition: all .1s linear;
}
.main-menu .nav-icon {
position: relative;
display: table-cell;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 18px;
}
.main-menu .nav-text {
position: relative;
display: table-cell;
vertical-align: middle;
width: 190px;
font-family: 'Titillium Web', sans-serif;
}
.main-menu>ul.logout {
position: absolute;
left: 0;
bottom: 0;
}
.no-touch .scrollable.hover {
overflow-y: hidden;
}
.no-touch .scrollable.hover:hover {
overflow-y: auto;
overflow: visible;
}
a:hover,
a:focus {
text-decoration: none;
}
nav {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav ul,
nav li {
outline: 0;
margin: 0;
padding: 0;
}
.main-menu li:hover>a,
nav.main-menu li.active>a,
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-menu>.active>a,
.dropdown-menu>.active>a:hover,
.dropdown-menu>.active>a:focus,
.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,
.dashboard-page nav.dashboard-menu ul li.active a {
color: #fff;
background-color: #5fa2db;
}
.area {
float: left;
background: #e2e2e2;
width: 100%;
height: 100%;
}
#font-face {
font-family: 'Titillium Web';
font-style: normal;
font-weight: 300;
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
}
nav.main-menu:hover i:before {
display: none;
}
nav.main-menu:hover {
width: 200px;
}
nav.main-menu:hover .fa {
width: 10px;
}
<html>
<head>
</head>
<body>
<div class="area"></div>
<nav class="main-menu">
<ul>
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
Dashboard
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-laptop fa-2x"></i>
<span class="nav-text">
UI Components
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-list fa-2x"></i>
<span class="nav-text">
Forms
</span>
</a>
</li>
<li class="has-subnav">
<a href="#">
<i class="fa fa-folder-open fa-2x"></i>
<span class="nav-text">
Pages
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-bar-chart-o fa-2x"></i>
<span class="nav-text">
Graphs and Statistics
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-font fa-2x"></i>
<span class="nav-text">
Typography and Icons
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-table fa-2x"></i>
<span class="nav-text">
Tables
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-map-marker fa-2x"></i>
<span class="nav-text">
Maps
</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-info fa-2x"></i>
<span class="nav-text">
Documentation
</span>
</a>
</li>
</ul>
<ul class="logout">
<li>
<a href="#">
<i class="fa fa-power-off fa-2x"></i>
<span class="nav-text">
Logout
</span>
</a>
</li>
</ul>
</nav>
</body>
</html>
You will need to set width:0 and visibility:hidden to the fa on .main-menu:hover
Also use flexbox...don't use table on <a> elements.
.main-menu:hover .fa {
width: 0;
visibility: hidden;
}
Stack Snippet
#import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
}
#import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
width: 60px;
height: 36px;
line-height: 36px;
text-align: center;
font-size: 20px;
}
.main-menu:hover,
nav.main-menu.expanded {
width: 250px;
overflow: visible;
}
.main-menu {
background: #212121;
border-right: 1px solid #e5e5e5;
position: absolute;
top: 0;
bottom: 0;
height: 100%;
left: 0;
width: 60px;
overflow: hidden;
-webkit-transition: width .05s linear;
transition: width .05s linear;
-webkit-transform: translateZ(0) scale(1, 1);
z-index: 1000;
}
.main-menu>ul {
margin: 7px 0;
}
.main-menu li {
position: relative;
display: block;
width: 250px;
}
.main-menu li>a {
position: relative;
display: flex;
align-items: center;
border-spacing: 0;
color: #999;
font-family: arial;
font-size: 14px;
text-decoration: none;
-webkit-transform: translateZ(0) scale(1, 1);
-webkit-transition: all .1s linear;
transition: all .1s linear;
}
.main-menu .nav-icon {
position: relative;
width: 60px;
height: 36px;
text-align: center;
vertical-align: middle;
font-size: 18px;
}
.main-menu .nav-text {
position: relative;
width: 190px;
font-family: 'Titillium Web', sans-serif;
}
.main-menu>ul.logout {
position: absolute;
left: 0;
bottom: 0;
}
.no-touch .scrollable.hover {
overflow-y: hidden;
}
.no-touch .scrollable.hover:hover {
overflow-y: auto;
overflow: visible;
}
a:hover,
a:focus {
text-decoration: none;
}
nav {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav ul,
nav li {
outline: 0;
margin: 0;
padding: 0;
}
.main-menu li:hover>a,
nav.main-menu li.active>a,
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-menu>.active>a,
.dropdown-menu>.active>a:hover,
.dropdown-menu>.active>a:focus,
.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,
.dashboard-page nav.dashboard-menu ul li.active a {
color: #fff;
background-color: #5fa2db;
}
.area {
float: left;
background: #e2e2e2;
width: 100%;
height: 100%;
}
#font-face {
font-family: 'Titillium Web';
font-style: normal;
font-weight: 300;
src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
}
.main-menu:hover .fa {
width: 0;
visibility: hidden;
}
.main-menu:hover a {
padding-left: 20px;
}
<div class="area"></div>
<nav class="main-menu">
<ul>
<li><i class="fa fa-home fa-2x"></i><span class="nav-text">Dashboard</span></li>
<li class="has-subnav"><i class="fa fa-laptop fa-2x"></i><span class="nav-text">UI Components</span></li>
<li class="has-subnav"><i class="fa fa-list fa-2x"></i><span class="nav-text">Forms</span></li>
<li class="has-subnav"><i class="fa fa-folder-open fa-2x"></i><span class="nav-text">Pages</span></li>
<li><i class="fa fa-bar-chart-o fa-2x"></i><span class="nav-text">Graphs and Statistics</span></li>
<li><i class="fa fa-font fa-2x"></i><span class="nav-text">Typography and Icons</span></li>
<li><i class="fa fa-table fa-2x"></i><span class="nav-text">Tables</span></li>
<li><i class="fa fa-map-marker fa-2x"></i><span class="nav-text">Maps</span></li>
<li><i class="fa fa-info fa-2x"></i><span class="nav-text">Documentation</span></li>
</ul>
<ul class="logout">
<li><i class="fa fa-power-off fa-2x"></i><span class="nav-text">Logout</span></li>
</ul>
</nav>
Default the icon to display none and then add hover css property. Something like this,
<li>
<a href="http://justinfarrow.com">
<i class="fa fa-home fa-2x my_icon"></i>
<span class="nav-text">
Dashboard
</span>
</a>
</li>
<style>
.my_icon{
display :none;
}
.my_icon:hover{
display :visible;
}
</style>
I have been trying everything I can think of, (not very good at this)
Im trying to center the text in those buttons vertically, here is the code:
<div id="menu">
<ul class="clearfix">
<li><i class="fa fa-home"></i> Home</li>
<li><i class="fa fa-hdd-o"></i> Services</li>
<li><i class="fa fa-area-chart"></i> Pricings & plans</li>
<li><i class="fa fa-envelope"></i> Contact</li>
<li><i class="fa fa-users"></i> The Team</li>
<!-- <li><i class="fa fa-sign-in"></i> Login</li>
<li><a href="#"><i class="fa fa-user"></i> Register</li>-->
</ul>
and the CSS:
#menu {
margin: 20px auto 0 auto;
width: 60%
}
#menu ul {
padding:0px;
list-style-type:none;
}
#menu a {
background-color: #EBEBEB;
font-size: 15px;
line-height: 10px;
height: 60px;
width: 100px;
position: relative;
padding: 0 20px;
float: left;
margin-top: 5px;
display: block;
color: #385c5b;
letter-spacing: 0.5px;
text-transform: uppercase;
font-weight: bold;
text-align: center;
text-shadow: 1px 1px 1px rgba(255,255,255,0.3);
border-radius: 3px 3px 0 0;
border-color:#eaeaea;
box-shadow:1px 1px 5px rgba(0,0,0,0.7);
margin-bottom: 5px;
}
#menu a:hover {
background-color:#5ba4b5;
}
#menu li {
float:left;
display:block;
margin-right:5px;
}
Thanks for any replies or other techniques.
You can use line-height see this http://jsfiddle.net/sfnxkav5/
#menu ul li a{
line-height:50px;
}
This won't center it exactly but it is suitable for the height you have given
You can use display:table-cell on the anchor tags
JSfiddle Demo
#menu {
margin: 20px auto 0 auto;
width: 60%
}
#menu ul {
padding: 0px;
list-style-type: none;
}
#menu a {
background-color: #EBEBEB;
font-size: 15px;
height: 60px;
width: 100px;
position: relative;
padding: 0 20px;
margin-top: 5px;
color: #385c5b;
letter-spacing: 0.5px;
text-transform: uppercase;
font-weight: bold;
text-align: center;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.3);
border-radius: 3px 3px 0 0;
border-color: #eaeaea;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.7);
display: table-cell;
vertical-align: middle;
}
#menu a:hover {
background-color: #5ba4b5;
}
#menu li {
float: left;
display: block;
margin-right: 5px;
margin-bottom: 5px;
}
<div id="menu">
<ul class="clearfix">
<li><i class="fa fa-home"></i> Home
</li>
<li><i class="fa fa-hdd-o"></i> Services
</li>
<li><a id="a" href="#"><i class="fa fa-area-chart" ></i> Pricings & plans</a>
</li>
<li><i class="fa fa-envelope"></i> Contact
</li>
<li><i class="fa fa-users"></i> The Team
</li>
<!-- <li><i class="fa fa-sign-in"></i> Login</li>
<li><a href="#"><i class="fa fa-user"></i> Register</li>-->
</ul>