I have some issue with a paragraph moving on hover, after some research I found many issue related with padding and margin so I tried some edit like :
to remove the padding
to remove the margin
to remove line-height
set position static or fixed on hover
Nothing worked, this mostly looks like a layout issue but I'm not very accommodate with it.
Any help would be appreciated.
#main-footer p{
font-size:16px;
}
#main-footer hr{
margin-top:0;
border-color:#19191d;
}
#main-footer .col-sm-4 p{
line-height: 30px;
margin: 0 !important;
}
#main-footer .col-sm-4 p.address{
padding-left: 28px;
}
#main-footer .container a{
color: #ffffff;
}
#main-footer .container a:hover{
color: #d6c087;
position: static;
}
#main-footer .container a:active, a:visited, a:focus{
text-decoration: none;
}
#main-footer img{
width: 24px !important;
height: 24px !important;
}
.social-links {
list-style:none;
margin:0;
padding:0;
margin-bottom:20px;
}
.social-links li{
display:inline-block;
margin:0 5px;
border-radius:3px;
box-shadow:0 4px 0 transparent;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a {
display:block;
color:#fff;
color:rgba(255,255,255,0.3);
font-size:18px;
width:40px;
height:40px;
line-height:40px;
text-align:center;
background:rgba(0,0,0,0.2);
border-radius:50%;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a:hover {
color:#fff;
background:#38A5DB;
}
<div class="container">
<hr>
<h4>Tittle</h4>
<div class="row">
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4 text-right">
<ul class="social-links">
<li class="scrollimation fade-right d4"><i class="fa fa-instagram fa-fw"></i></li>
<li class="scrollimation fade-right d3"><i class="fa fa-facebook fa-fw"></i></li>
</ul>
<p>Footer copyright</p>
</div>
</div>
</div>
Adding this should work:
p:hover {
padding-left: 20px;
transition: .5s;
}
p {
transition:.25s;
}
Try it in action in the snippet below.
#main-footer p{
font-size:16px;
}
#main-footer hr{
margin-top:0;
border-color:#19191d;
}
#main-footer .col-sm-4 p{
line-height: 30px;
margin: 0 !important;
}
#main-footer .col-sm-4 p.address{
padding-left: 28px;
}
#main-footer .container a{
color: #ffffff;
}
#main-footer .container a:hover{
color: #d6c087;
position: static;
}
#main-footer .container a:active, a:visited, a:focus{
text-decoration: none;
}
#main-footer img{
width: 24px !important;
height: 24px !important;
}
.social-links {
list-style:none;
margin:0;
padding:0;
margin-bottom:20px;
}
.social-links li{
display:inline-block;
margin:0 5px;
border-radius:3px;
box-shadow:0 4px 0 transparent;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a {
display:block;
color:#fff;
color:rgba(255,255,255,0.3);
font-size:18px;
width:40px;
height:40px;
line-height:40px;
text-align:center;
background:rgba(0,0,0,0.2);
border-radius:50%;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a:hover {
color:#fff;
background:#38A5DB;
}
p:hover {
padding-left: 20px;
transition: .5s;
}
p {
transition:.25s;
}
<div class="container">
<hr>
<h4>Tittle</h4>
<div class="row">
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4 text-right">
<ul class="social-links">
<li class="scrollimation fade-right d4"><i class="fa fa-instagram fa-fw"></i></li>
<li class="scrollimation fade-right d3"><i class="fa fa-facebook fa-fw"></i></li>
</ul>
<p>Footer copyright</p>
</div>
</div>
</div>
I've added this:
p:hover {
padding-left: 10px;
transition: 1s;
}
The 1 second transition is just for the example, and also you can come up with better css selector for those paragraphs.
#main-footer p{
font-size:16px;
}
#main-footer hr{
margin-top:0;
border-color:#19191d;
}
#main-footer .col-sm-4 p{
line-height: 30px;
margin: 0 !important;
}
#main-footer .col-sm-4 p.address{
padding-left: 28px;
}
#main-footer .container a{
color: #ffffff;
}
#main-footer .container a:hover{
color: #d6c087;
position: static;
}
#main-footer .container a:active, a:visited, a:focus{
text-decoration: none;
}
#main-footer img{
width: 24px !important;
height: 24px !important;
}
.social-links {
list-style:none;
margin:0;
padding:0;
margin-bottom:20px;
}
.social-links li{
display:inline-block;
margin:0 5px;
border-radius:3px;
box-shadow:0 4px 0 transparent;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a {
display:block;
color:#fff;
color:rgba(255,255,255,0.3);
font-size:18px;
width:40px;
height:40px;
line-height:40px;
text-align:center;
background:rgba(0,0,0,0.2);
border-radius:50%;
-webkit-transition:all .3s ease-out;
transition:all .3s ease-out;
}
.social-links li a:hover {
color:#fff;
background:#38A5DB;
}
p:hover {
padding-left: 10px;
transition: 1s;
}
<div class="container">
<hr>
<h4>Tittle</h4>
<div class="row">
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4">
<a href="" target="_blank"><p><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname
</p>
<p class="address">address<br/>
CP City</p></a>
</div>
<div class="col-sm-4 text-right">
<ul class="social-links">
<li class="scrollimation fade-right d4"><i class="fa fa-instagram fa-fw"></i></li>
<li class="scrollimation fade-right d3"><i class="fa fa-facebook fa-fw"></i></li>
</ul>
<p>Footer copyright</p>
</div>
</div>
</div>
Tittle
<div class="row">
<div class="col-sm-4">
<a href="" target="_blank"><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname </img>
<p class="address">address
CP City</p></a>
</div>
<div class="col-sm-4">
<a href="" target="_blank"><img src="assets/icons8-google-maps-48.png" alt=""> Prettyname </img>
<p class="address">address
CP City</p></a>
</div>
<div class="col-sm-4 text-right">
<ul class="social-links">
<li class="scrollimation fade-right d4"><i class="fa fa-instagram fa-fw"></i></li>
<li class="scrollimation fade-right d3"><i class="fa fa-facebook fa-fw"></i></li>
</ul>
<p>Footer copyright</p>
</div>
</div>
</div>
If this solves your problem, plz mark it as your answer.
Related
I have been trying to get the li tag, when hovered to underline the a tag, currently when hovering over the li tag, the line goes under the entire li tag and not the a tag.
HTML, Simple icon above a tag within the function
<li id="underline"><a type="button" id="speakBtn">
<div class="icon"><i class="fas fa-play"></i></div>
<div class="title ">Text To Speech</div>
</a></li>
<li class="underline"><a type="button" id="pauseBtn">
<div class="icon"><i class="fas fa-pause"></i></div>
<div class="title whiteTxt ">Pause</div>
</a></li>
<li class="navButton"><a type="button" id="resumeBtn">
<div class="icon"><i class="fas fa-play-circle"></i></div>
<div class="title whiteTxt ">Resume</div>
</a></li>
<li class="navButton"><a type="button" id="cancelBtn">
<div class="icon"><i class="fas fa-stop"></i></div>
<div class="title whiteTxt ">Stop</div>
</a></li>
CSS
li and a default display
.wrapper .sidebar__inner .siderbar_menu li a {
padding: 10px 50px;
display: block;
height: 90px;
position: relative;
margin-bottom: 1px;
color: #fff;
text-align: center;
text-transform: uppercase;
}
.wrapper .sidebar__inner .siderbar_menu a {
background-image:linear-gradient(#fff,#fff);
background-position:bottom left;
background-size:0% 2px;
background-repeat:no-repeat;
transition:
background-size .5s,
background-position 0s 1s;
}
li and a Hover display
.wrapper .sidebar__inner .siderbar_menu li.active {
background: #a6a6a6;
}
.wrapper .sidebar__inner .siderbar_menu a:hover,
.wrapper .sidebar__inner .siderbar_menu a.active {
color: #fff;
background-position:bottom left;
background-size:100% 2px;
}
I think you want to like this:
body {
background: blue;
}
.wrapper .sidebar__inner .siderbar_menu {
list-style: none;
padding: 0;
}
.wrapper .sidebar__inner .siderbar_menu li {
text-align: center; /*Css add*/
display: inline-block; /*Css add*/
}
.wrapper .sidebar__inner .siderbar_menu li a {
padding: 10px 50px;
display: inline-block; /*Css Change*/
height: 20px;
position: relative;
margin-bottom: 1px;
color: #fff;
text-align: center;
text-transform: uppercase;
}
.wrapper .sidebar__inner .siderbar_menu a {
background-image:linear-gradient(#fff,#fff);
background-position:bottom left;
background-size:0% 2px;
background-repeat:no-repeat;
transition:
background-size .5s,
background-position 0s 1s;
}
.wrapper .sidebar__inner .siderbar_menu li.active {
background: #a6a6a6;
}
.wrapper .sidebar__inner .siderbar_menu a:hover,
.wrapper .sidebar__inner .siderbar_menu a.active {
color: #fff;
background-position:bottom left;
background-size:100% 2px;
}
<div class="wrapper">
<div class="sidebar__inner">
<ul class="siderbar_menu">
<li id="underline"><a type="button" id="speakBtn">
<div class="icon"><i class="fas fa-play"></i></div>
<div class="title ">Text To Speech</div>
</a>
</li>
<li class="underline"><a type="button" id="pauseBtn">
<div class="icon"><i class="fas fa-pause"></i></div>
<div class="title whiteTxt ">Pause</div>
</a>
</li>
<li class="navButton"><a type="button" id="resumeBtn">
<div class="icon"><i class="fas fa-play-circle"></i></div>
<div class="title whiteTxt ">Resume</div>
</a>
</li>
<li class="navButton"><a type="button" id="cancelBtn">
<div class="icon"><i class="fas fa-stop"></i></div>
<div class="title whiteTxt ">Stop</div>
</a>
</li>
</ul>
</div>
</div>
li:hover a{
text-decoration: underline;
}
you can use your class name in place of li and anchor tag.
li a:hover{
text-decoration:underline;
}
I am trying to figure out why none of my css is being applied when previewing my code. I've checked my file tree and made sure everything is linked, but it just shows up as plain text. I am using html/css/bootstrap 3.0.2 and jquery CDN. I also tried changing the order of the links, but nothing I do seems to work. I've included a portion of my code to be as clear as possible as to what is going on. Any help or suggestions is greatly appreciated.
====================================================================
Fonts
====================================================================
***/
#import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
#import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700);
#import url('font-awesome.css');
/***
====================================================================
Reset
====================================================================
***/
* {
margin:0px;
padding:0px;
border:none;
outline:none;
}
/***
====================================================================
Global Settings
====================================================================
***/
body {
font-family: 'Open Sans', sans-serif;
font-size:14px;
color:#353535;
line-height:1.6em;
font-weight:500;
background:#ffffff;
-webkit-font-smoothing: antialiased;
}
a{
text-decoration:none;
cursor:pointer;
color:#000000;
}
a:hover,a:focus,a:visited{
text-decoration:none;
outline:none;
}
h1,h2,h3,h4,h5,h6 {
position:relative;
margin:0px;
background:none;
}
h1 {
font-size:24px;
}
h2 {
font-size:20px;
}
h3 {
font-size:18px;
}
p{
font-size:14px;
line-height:1.6em;
}
/***
====================================================================
Sidebar
====================================================================
****/
#sidebar{
position:fixed;
left:0px;
top:0px;
width:250px;
height:100%;
padding:0px 20px;
border-right:2px solid #cccccc;
z-index:10;
}
#sidebar .mCSB_inside > .mCSB_container{
margin-right:12px !important;
}
#sidebar .mCS_no_scrollbar .mCSB_container{
margin-right:0px !important;
}
#sidebar .menu-box{
position:absolute;
left:0px;
top:0px;
width:100%;
height:100%;
overflow:auto;
padding:0px 0px 30px;
background:rgba(0,0,0,0.80);
transition:all 1000ms ease;
-moz-transition:all 1000ms ease;
-webkit-transition:all 1000ms ease;
-ms-transition:all 1000ms ease;
-o-transition:all 1000ms ease;
}
#sidebar .menu-box .logo{
position:relative;
text-align:center;
margin-bottom:35px;
padding:30px 20px 10px;
}
#sidebar .menu-box .logo img{
position:relative;
display:inline-block;
max-width:100%;
}
#sidebar .menu-box .sticky-menu{
position:relative;
}
#sidebar .menu-box .sticky-menu > ul{
position:relative;
display:block;
margin:0px;
padding:0px;
border-top:1px solid rgba(255,255,255,0.20);
}
#sidebar .menu-box .sticky-menu > ul > li{
position:relative;
display:block;
padding:3px 0px;
border-bottom:1px solid rgba(255,255,255,0.20);
font-size:20px;
color:#ffffff;
text-align:right;
}
#sidebar .menu-box .sticky-menu > ul > li > a{
position:relative;
display:block;
padding:7px 30px 7px 0px;
color:#ffffff;
font-size:13px;
font-weight:600;
line-height:20px;
text-transform:uppercase;
transition:all 300ms ease;
-moz-transition:all 300ms ease;
-webkit-transition:all 300ms ease;
-ms-transition:all 300ms ease;
-o-transition:all 300ms ease;
}
#sidebar .menu-box .sticky-menu > ul > li a .fa{
position:absolute;
right:-10px;
top:0px;
width:24px;
text-align:right;
color:#ffffff;
opacity:0;
font-size:12px;
display:block;
line-height:34px;
transition:all 500ms ease;
-moz-transition:all 500ms ease;
-webkit-transition:all 500ms ease;
-ms-transition:all 500ms ease;
-o-transition:all 500ms ease;
}
#sidebar .menu-box .sticky-menu > ul > li.current a .fa,
#sidebar .menu-box .sticky-menu > ul > li:hover a .fa{
right:6px;
opacity:1;
}
#sidebar .menu-box .sticky-menu > ul > li > a:hover,
#sidebar .menu-box .sticky-menu > ul > li.current > a,
#sidebar .menu-box .sticky-menu > ul > li.current-menu-item > a{
color:#cccccc;
}
#sidebar .copyright{
position:fixed;
left:0px;
bottom:5px;
width:250px;
height:30px;
font-size:13px;
color:#ffffff;
line-height:30px;
text-align:center;
}
#sidebar .copyright a{
color:#ffffff;
}
/***
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.11.2.min.js" integrity="sha256-Ls0pXSlb7AYs7evhd+VLnWsZ/AqEHcXBeMZUycz/CcA=" crossorigin="anonymous"></script>
<title>Grest Fitness| Homepage</title>
<!-- Stylesheets -->
<link href="style.css/css/bootstrap.css" rel="stylesheet">
<link href="style.css/css/style.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
<link rel="icon" href="images/favicon.png" type="image/x-icon">
<!-- Responsive -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script><![endif]
<[if lt IE 9]><script src="js/respond.js"></script>
<body class="hidden-bar-wrapper">
<div class="page-wrapper">
<!-- Preloder -->
<div id="preloder" class="preloader">
<div class="loader"></div>
</div>
<!-- Εnd Preloader -->
<!-- Main Header-->
<header class="main-header header-style-one">
<!--Header-Upper-->
<div class="header-upper">
<div class="outer-container">
<div class="inner-container clearfix">
<!-- Logo Box -->
<div class="logo-box">
<div class="logo"><img src="https://via.placeholder.com/180x78" alt="" title=""></div>
</div>
<!-- Logo -->
<div class="mobile-logo pull-left">
<img src="https://via.placeholder.com/230x46" alt="" title="">
</div>
<!-- Header Social Box -->
<div class="header-social-box clearfix">
</div>
<div class="outer-box clearfix">
<!-- Hidden Nav Toggler -->
<div class="nav-toggler">
<div class="nav-btn"><button class="hidden-bar-opener">Menu</button></div>
</div>
<!-- / Hidden Nav Toggler -->
</div>
<div class="nav-outer clearfix">
<!--Mobile Navigation Toggler-->
<div class="mobile-nav-toggler"><span class="icon"><img src="images/icons/burger.svg" alt="" /></span></div>
<!-- Main Menu -->
<nav class="main-menu navbar-expand-md">
<div class="navbar-header">
<!-- Toggle Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse clearfix" id="navbarSupportedContent">
<ul class="navigation clearfix">
<li>Home</li>
<li class="dropdown">About Us
<ul>
<li>About Us</li>
<li>Time Table</li>
<li>Comming Soon</li>
<li>Section Page 01</li>
<li>Section Page 02</li>
</ul>
</li>
<li class="dropdown">Trainers
<ul>
<li>Trainer 01</li>
<li>Trainer 02</li>
</ul>
</li>
<li class="dropdown">Shop
<ul>
<li>Shop Left Sidebar</li>
<li>Shop Right Sidebar</li>
<li>Product Single</li>
<li>Shopping Cart</li>
<li>Checkout</li>
</ul>
</li>
<li class="dropdown">Blog
<ul>
<li>Our Blog</li>
<li>Blog Classic</li>
<li>Blog Detail One</li>
<li>Blog Detail Two</li>
<li>Not Found</li>
</ul>
</li>
<li>Contact us</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
<!--End Header Upper-->
I think you missed the comment at first line in css. See:
/***
====================================================================
Fonts
====================================================================
***/
#import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700);
#import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700);
#import url('font-awesome.css');
/***
====================================================================
Reset
====================================================================
***/
* {
margin:0px;
padding:0px;
border:none;
outline:none;
}
/***
====================================================================
Global Settings
====================================================================
***/
body {
font-family: 'Open Sans', sans-serif;
font-size:14px;
color:#353535;
line-height:1.6em;
font-weight:500;
background:#ffffff;
-webkit-font-smoothing: antialiased;
}
a{
text-decoration:none;
cursor:pointer;
color:#000000;
}
a:hover,a:focus,a:visited{
text-decoration:none;
outline:none;
}
h1,h2,h3,h4,h5,h6 {
position:relative;
margin:0px;
background:none;
}
h1 {
font-size:24px;
}
h2 {
font-size:20px;
}
h3 {
font-size:18px;
}
p{
font-size:14px;
line-height:1.6em;
}
/***
====================================================================
Sidebar
====================================================================
****/
#sidebar{
position:fixed;
left:0px;
top:0px;
width:250px;
height:100%;
padding:0px 20px;
border-right:2px solid #cccccc;
z-index:10;
}
#sidebar .mCSB_inside > .mCSB_container{
margin-right:12px !important;
}
#sidebar .mCS_no_scrollbar .mCSB_container{
margin-right:0px !important;
}
#sidebar .menu-box{
position:absolute;
left:0px;
top:0px;
width:100%;
height:100%;
overflow:auto;
padding:0px 0px 30px;
background:rgba(0,0,0,0.80);
transition:all 1000ms ease;
-moz-transition:all 1000ms ease;
-webkit-transition:all 1000ms ease;
-ms-transition:all 1000ms ease;
-o-transition:all 1000ms ease;
}
#sidebar .menu-box .logo{
position:relative;
text-align:center;
margin-bottom:35px;
padding:30px 20px 10px;
}
#sidebar .menu-box .logo img{
position:relative;
display:inline-block;
max-width:100%;
}
#sidebar .menu-box .sticky-menu{
position:relative;
}
#sidebar .menu-box .sticky-menu > ul{
position:relative;
display:block;
margin:0px;
padding:0px;
border-top:1px solid rgba(255,255,255,0.20);
}
#sidebar .menu-box .sticky-menu > ul > li{
position:relative;
display:block;
padding:3px 0px;
border-bottom:1px solid rgba(255,255,255,0.20);
font-size:20px;
color:#ffffff;
text-align:right;
}
#sidebar .menu-box .sticky-menu > ul > li > a{
position:relative;
display:block;
padding:7px 30px 7px 0px;
color:#ffffff;
font-size:13px;
font-weight:600;
line-height:20px;
text-transform:uppercase;
transition:all 300ms ease;
-moz-transition:all 300ms ease;
-webkit-transition:all 300ms ease;
-ms-transition:all 300ms ease;
-o-transition:all 300ms ease;
}
#sidebar .menu-box .sticky-menu > ul > li a .fa{
position:absolute;
right:-10px;
top:0px;
width:24px;
text-align:right;
color:#ffffff;
opacity:0;
font-size:12px;
display:block;
line-height:34px;
transition:all 500ms ease;
-moz-transition:all 500ms ease;
-webkit-transition:all 500ms ease;
-ms-transition:all 500ms ease;
-o-transition:all 500ms ease;
}
#sidebar .menu-box .sticky-menu > ul > li.current a .fa,
#sidebar .menu-box .sticky-menu > ul > li:hover a .fa{
right:6px;
opacity:1;
}
#sidebar .menu-box .sticky-menu > ul > li > a:hover,
#sidebar .menu-box .sticky-menu > ul > li.current > a,
#sidebar .menu-box .sticky-menu > ul > li.current-menu-item > a{
color:#cccccc;
}
#sidebar .copyright{
position:fixed;
left:0px;
bottom:5px;
width:250px;
height:30px;
font-size:13px;
color:#ffffff;
line-height:30px;
text-align:center;
}
#sidebar .copyright a{
color:#ffffff;
}
/***
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.11.2.min.js" integrity="sha256-Ls0pXSlb7AYs7evhd+VLnWsZ/AqEHcXBeMZUycz/CcA=" crossorigin="anonymous"></script>
<title>Grest Fitness| Homepage</title>
<!-- Stylesheets -->
<link href="style.css/css/bootstrap.css" rel="stylesheet">
<link href="style.css/css/style.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
<link rel="icon" href="images/favicon.png" type="image/x-icon">
<!-- Responsive -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script><![endif]
<[if lt IE 9]><script src="js/respond.js"></script>
<body class="hidden-bar-wrapper">
<div class="page-wrapper">
<!-- Preloder -->
<div id="preloder" class="preloader">
<div class="loader"></div>
</div>
<!-- Εnd Preloader -->
<!-- Main Header-->
<header class="main-header header-style-one">
<!--Header-Upper-->
<div class="header-upper">
<div class="outer-container">
<div class="inner-container clearfix">
<!-- Logo Box -->
<div class="logo-box">
<div class="logo"><img src="https://via.placeholder.com/180x78" alt="" title=""></div>
</div>
<!-- Logo -->
<div class="mobile-logo pull-left">
<img src="https://via.placeholder.com/230x46" alt="" title="">
</div>
<!-- Header Social Box -->
<div class="header-social-box clearfix">
</div>
<div class="outer-box clearfix">
<!-- Hidden Nav Toggler -->
<div class="nav-toggler">
<div class="nav-btn"><button class="hidden-bar-opener">Menu</button></div>
</div>
<!-- / Hidden Nav Toggler -->
</div>
<div class="nav-outer clearfix">
<!--Mobile Navigation Toggler-->
<div class="mobile-nav-toggler"><span class="icon"><img src="images/icons/burger.svg" alt="" /></span></div>
<!-- Main Menu -->
<nav class="main-menu navbar-expand-md">
<div class="navbar-header">
<!-- Toggle Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse clearfix" id="navbarSupportedContent">
<ul class="navigation clearfix">
<li>Home</li>
<li class="dropdown">About Us
<ul>
<li>About Us</li>
<li>Time Table</li>
<li>Comming Soon</li>
<li>Section Page 01</li>
<li>Section Page 02</li>
</ul>
</li>
<li class="dropdown">Trainers
<ul>
<li>Trainer 01</li>
<li>Trainer 02</li>
</ul>
</li>
<li class="dropdown">Shop
<ul>
<li>Shop Left Sidebar</li>
<li>Shop Right Sidebar</li>
<li>Product Single</li>
<li>Shopping Cart</li>
<li>Checkout</li>
</ul>
</li>
<li class="dropdown">Blog
<ul>
<li>Our Blog</li>
<li>Blog Classic</li>
<li>Blog Detail One</li>
<li>Blog Detail Two</li>
<li>Not Found</li>
</ul>
</li>
<li>Contact us</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
<!--End Header Upper-->
I am trying to arrange my Social icons so that they will be placed on the same level as some text on in the footer. I will provide a Photo of the footer I have so far as well as the html and css code I have made so far. I wanted to figure out if i need to put the social icons into another div so that I can control the position that way, or would i need to utilize position element here?
footer {
background: #212529;
color: white;
width: calc(100% - 80px);
margin-left: 80px;
margin-right: -15px;
}
footer a {
color: #fff;
font-size: 14px;
transition-duration: 0.2s;
}
footer a:hover {
color: #FA944B;
text-decoration: none;
}
.copy {
font-size: 12px;
padding: 10px;
border-top: 1px solid #FFFFFF;
}
.footer-middle {
padding-top: 2em;
color: white;
}
/* Footer social icons */
ul.social-network {
list-style: none;
display: inline;
margin-left: 0 !important;
padding: 0;
}
ul.social-network li {
display: inline;
margin: 0 5px;
}
.social-network a.icoFacebook:hover {
background-color: #3B5998;
}
.social-network a.icoLinkedin:hover {
background-color: #007bb7;
}
.social-network a.icoFacebook:hover i,
.social-network a.icoLinkedin:hover i {
color: #fff;
}
.social-network a.socialIcon:hover,
.socialHoverClass {
color: #44BCDD;
}
.social-circle li a {
display: inline-block;
position: relative;
margin: 0 auto 0 auto;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
text-align: center;
width: 30px;
height: 30px;
font-size: 15px;
}
.social-circle li i {
margin: 0;
line-height: 30px;
text-align: center;
}
.social-circle li a:hover i,
.triggeredHover {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-ms--transform: rotate(360deg);
transform: rotate(360deg);
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-o-transition: all 0.2s;
-ms-transition: all 0.2s;
transition: all 0.2s;
}
.social-circle i {
color: #595959;
-webkit-transition: all 0.8s;
-moz-transition: all 0.8s;
-o-transition: all 0.8s;
-ms-transition: all 0.8s;
transition: all 0.8s;
}
.social-network a {
background-color: #F9F9F9;
}
<footer class="mainfooter" role="contentinfo">
<div class="footer-middle">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>ACTIVITÉS</h4>
<ul class="list-styled">
<li>
Rafting</li>
<li>Kayak</li>
<li>Parachute</li>
<li>Soufflerie</li>
<li>Saut élastique</li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>INFORMATIONS</h4>
<ul class="list-unstyled">
<li>Mentions légales</li>
<li>À Propos de nous</li>
<li>CGV</li>
<li>CGU</li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>OFFRES</h4>
<ul class="list-unstyled">
<li>Solo</li>
<li>Groupe</li>
<li>Famille</li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<!--Column1-->
<div class="footer-pad">
<h4>PARTENAIRES</h4>
<ul class="list-unstyled">
<li>Nos Partenaires</li>
<li>Devenir Partenaire</li>
</ul>
</div>
</div>
<div class="col-md-3">
<ul class="social-network social-circle">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-youtube"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-instagram"></i></li>
</ul>
<h4>Suivez-Nous</h4>
</div>
</div>
<div class="row">
<div class="col-md-12 copy">
<p class="text-center">© Copyright 2018 - Company Name. All rights reserved.</p>
</div>
</div>
</div>
</div>
</footer>
Add CSS to <h4>Suivez-Nous</h4> h4{ display:inline }"and change the order
You can add d-flex class to your .col-md-3 element and thus <h4> element and social icons will be in a row.
P.S. I have changed .col-md-3 to .col-md-6, cause in .col-md-3 icons start to wrap onto multiple lines
<div class="col-md-6 d-flex">
<h4>Suivez-Nous</h4>
<ul class="social-network social-circle">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-youtube"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-instagram"></i></li>
</ul>
</div>
Full code: https://jsfiddle.net/8pL49rs7/
I need the pockeat item place right beside the sidebar, and I tried many of the solutions I found on the Internet, but none of them work.
This is my code:
.header {
background-color:#ffffff;
top:0;
height:10%;
width:100%;
color:#1c1919;
font-family:century gothic;
font-size:56px;
padding:15px;
text-decoration:none;
float:center;
text-align:center;
top:2%;
}
.navbar {
position:relative;
display:inline-block;
text-align:center;
overflow:hidden;
background-color:#ffffff;
height:8%;
width: 100%;
border-top:4px solid #1c1919;
border-bottom:4px solid #1c1919;
padding:5px;
}
.navbar a {
text-align:center;
text-decoration:none;
color:#1c1919;
font-family:century gothic;
font-size:32px;
padding:0 30px;
}
.sidebar {
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
height:82%;
width:20%;
border-right:2px solid #1c1919;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active, button.accordion:hover {
opacity:0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color:#ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration:none;
font-family:century gothic;
font-size:15px;
text-align:left;
color: #1c1919;
padding:10px;
display:block;
}
.content-body {
background-color:#ffffff;
height:82%;
width:80%;
text-decoration:none;
padding:10px;
float:right;
}
.content {
height:60px;
width:50px;
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
padding:10px;
font-size:20px;
display:block;
}
<!navbar>
<div class="navbar">
HOME
NEWEST
RECOMMENDED
ALL TIME FAVE
CONTACT US
</div>
<!sidebar>
<div class="sidebar">
<button class="accordion">Gadgets</button>
<div class="panel">
<ul>
<li>Camera</li>
<li>Watch</li>
<li>Music</li>
<li>Phone</li>
<li>Bracelet</li>
</ul>
</div>
<button class="accordion">Furniture</button>
<div class="panel">
<ul>
<li>Wheelchair</li>
<li>Lights</li>
<li>Table/ Chair</li>
<li>Storage</li>
</ul>
</div>
<button class="accordion">Lifestyle</button>
<div class="panel">
<ul>
<li>Window Blinds</li>
<li>Ornaments</li>
<li>Mask</li>
<li>Socks</li>
<li>Gardening</li>
</ul>
</div>
<button class="accordion">Instruments</button>
<div class="panel">
<ul>
<li>Guitar</li>
<li>Flute</li>
<li>Tuner</li>
</ul>
</div>
<button class="accordion">Kitchen/Bathroom</button>
<div class="panel">
<ul>
<li>Ready-to-Eat</li>
<li>Bag</li>
<li>Pot</li>
<li>Kit</li>
</ul>
</div>
<button class="accordion">Pet</button>
<div class="panel">
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
</div>
<button class="accordion">Stationery</button>
<div class="panel">
<ul>
<li>Pen Pouch</li>
<li>Clock</li>
</ul>
</div>
<button class="accordion">Toy</button>
<div class="panel">
<ul>
<li>Block</li>
<li>Doll</li>
<li>Card</li>
</ul>
</div>
<button class="accordion">Other</button>
<div class="panel">
<ul>
<li>Pill Case</li>
<li>Fitness</li>
<li>Bicycle</li>
<li>Wine</li>
</ul>
</div>
</div>
<!content>
<div class="content-body">
<div class="content">
<img src="/image/bento/20170521223952w6A7Gz9kL8KlUW1g.jpg-w600.jpg" style="height:80%; width:100%">
<br>Pockeat
</div>
</div>
Where have I done wrong?
Your border of 2% eats into your sidebar width making it a total of 22%, so your sidebar needs to be 18% with a 2% border, please see the updated CSS.
I have also removed all of your height attributes and they are not needed. The content within the divs will adapt naturally. Another amendment I made is making the font you are using global by adding it into the "body" selector within your CSS.
body {
font-family:century gothic;
}
.header {
background-color:#ffffff;
width:100%;
color:#1c1919;
font-size:56px;
padding:15px;
text-decoration:none;
float:center;
text-align:center;
top:2%;
}
.navbar {
position:relative;
display:inline-block;
text-align:center;
overflow:hidden;
background-color:#ffffff;
width: 100%;
border-top:4px solid #1c1919;
border-bottom:4px solid #1c1919;
padding:5px;
}
.navbar a {
text-align:center;
text-decoration:none;
color:#1c1919;
font-size:32px;
padding:0 30px;
}
.sidebar {
background-color:#ffffff;
text-decoration:none;
width:18%;
border-right:2px solid #1c1919;
float:left;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active, button.accordion:hover {
opacity:0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color:#ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration:none;
font-size:15px;
text-align:left;
color: #1c1919;
padding:10px;
display:block;
}
.content-body {
background-color:#ffffff;
width:80%;
text-decoration:none;
padding:10px;
float:right;
}
.content {
background-color:#ffffff;
text-decoration:none;
font-size:20px;
display:block;
}
No float was added to .sidebar
total width of both (i.e. .sidebar and .content-body) should be less than 100% as you added a border to the right side of .sidebar as below,
background-color:#ffffff;
top:0;
height:10%;
width:100%;
color:#1c1919;
font-family:century gothic;
font-size:56px;
padding:15px;
text-decoration:none;
float:center;
text-align:center;
top:2%;
}
.navbar {
position:relative;
display:inline-block;
text-align:center;
overflow:hidden;
background-color:#ffffff;
height:8%;
width: 100%;
border-top:4px solid #1c1919;
border-bottom:4px solid #1c1919;
padding:5px;
}
.navbar a {
text-align:center;
text-decoration:none;
color:#1c1919;
font-family:century gothic;
font-size:32px;
padding:0 30px;
}
.sidebar {
background:#fff;
text-decoration:none;
font-family:century gothic;
height:82%;
width:20%;
border-right:2px solid #1c1919;
float:left;
overflow:hidden;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active, button.accordion:hover {
opacity:0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color:#ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration:none;
font-family:century gothic;
font-size:15px;
text-align:left;
color: #1c1919;
padding:10px;
display:block;
}
.content-body {
background-color:#ffffff;
height:82%;
width:calc(80% - 5%);
text-decoration:none;
padding:10px;
float:right;
}
.content {
height:60px;
width:50px;
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
padding:10px;
font-size:20px;
display:block;
}
<div class="navbar">
HOME
NEWEST
RECOMMENDED
ALL TIME FAVE
CONTACT US
</div>
<div class="sidebar">
<button class="accordion">Gadgets</button>
<div class="panel">
<ul>
<li>Camera</li>
<li>Watch</li>
<li>Music</li>
<li>Phone</li>
<li>Bracelet</li>
</ul>
</div>
<button class="accordion">Furniture</button>
<div class="panel">
<ul>
<li>Wheelchair</li>
<li>Lights</li>
<li>Table/ Chair</li>
<li>Storage</li>
</ul>
</div>
<button class="accordion">Lifestyle</button>
<div class="panel">
<ul>
<li>Window Blinds</li>
<li>Ornaments</li>
<li>Mask</li>
<li>Socks</li>
<li>Gardening</li>
</ul>
</div>
<button class="accordion">Instruments</button>
<div class="panel">
<ul>
<li>Guitar</li>
<li>Flute</li>
<li>Tuner</li>
</ul>
</div>
<button class="accordion">Kitchen/Bathroom</button>
<div class="panel">
<ul>
<li>Ready-to-Eat</li>
<li>Bag</li>
<li>Pot</li>
<li>Kit</li>
</ul>
</div>
<button class="accordion">Pet</button>
<div class="panel">
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
</div>
<button class="accordion">Stationery</button>
<div class="panel">
<ul>
<li>Pen Pouch</li>
<li>Clock</li>
</ul>
</div>
<button class="accordion">Toy</button>
<div class="panel">
<ul>
<li>Block</li>
<li>Doll</li>
<li>Card</li>
</ul>
</div>
<button class="accordion">Other</button>
<div class="panel">
<ul>
<li>Pill Case</li>
<li>Fitness</li>
<li>Bicycle</li>
<li>Wine</li>
</ul>
</div>
</div>
<div class="content-body">
<div class="content">
<img src="/image/bento/20170521223952w6A7Gz9kL8KlUW1g.jpg-w600.jpg" style="height:80%; width:100%">
<br>Pockeat
</div>
</div>
Just add float:left to your sidebar div & add box-sizing to globally. Check updated snippet below:
*,
*:before,
*:after {
box-sizing: border-box;
}
.header {
background-color: #ffffff;
top: 0;
height: 10%;
width: 100%;
color: #1c1919;
font-family: century gothic;
font-size: 56px;
padding: 15px;
text-decoration: none;
float: center;
text-align: center;
top: 2%;
}
.navbar {
position: relative;
display: inline-block;
text-align: center;
overflow: hidden;
background-color: #ffffff;
height: 8%;
width: 100%;
border-top: 4px solid #1c1919;
border-bottom: 4px solid #1c1919;
padding: 5px;
}
.navbar a {
text-align: center;
text-decoration: none;
color: #1c1919;
font-family: century gothic;
font-size: 32px;
padding: 0 30px;
}
.sidebar {
background-color: #ffffff;
text-decoration: none;
font-family: century gothic;
height: 82%;
width: 20%;
border-right: 2px solid #1c1919;
float: left;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active,
button.accordion:hover {
opacity: 0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color: #ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration: none;
font-family: century gothic;
font-size: 15px;
text-align: left;
color: #1c1919;
padding: 10px;
display: block;
}
.content-body {
background-color: #ffffff;
height: 82%;
width: 80%;
text-decoration: none;
padding: 10px;
float: right;
}
.content {
height: 60px;
width: 50px;
background-color: #ffffff;
text-decoration: none;
font-family: century gothic;
padding: 10px;
font-size: 20px;
display: block;
}
<div class="navbar">
HOME
NEWEST
RECOMMENDED
ALL TIME FAVE
CONTACT US
</div>
<div class="sidebar">
<button class="accordion">Gadgets</button>
<div class="panel">
<ul>
<li>Camera</li>
<li>Watch</li>
<li>Music</li>
<li>Phone</li>
<li>Bracelet</li>
</ul>
</div>
<button class="accordion">Furniture</button>
<div class="panel">
<ul>
<li>Wheelchair</li>
<li>Lights</li>
<li>Table/ Chair</li>
<li>Storage</li>
</ul>
</div>
<button class="accordion">Lifestyle</button>
<div class="panel">
<ul>
<li>Window Blinds</li>
<li>Ornaments</li>
<li>Mask</li>
<li>Socks</li>
<li>Gardening</li>
</ul>
</div>
<button class="accordion">Instruments</button>
<div class="panel">
<ul>
<li>Guitar</li>
<li>Flute</li>
<li>Tuner</li>
</ul>
</div>
<button class="accordion">Kitchen/Bathroom</button>
<div class="panel">
<ul>
<li>Ready-to-Eat</li>
<li>Bag</li>
<li>Pot</li>
<li>Kit</li>
</ul>
</div>
<button class="accordion">Pet</button>
<div class="panel">
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
</div>
<button class="accordion">Stationery</button>
<div class="panel">
<ul>
<li>Pen Pouch</li>
<li>Clock</li>
</ul>
</div>
<button class="accordion">Toy</button>
<div class="panel">
<ul>
<li>Block</li>
<li>Doll</li>
<li>Card</li>
</ul>
</div>
<button class="accordion">Other</button>
<div class="panel">
<ul>
<li>Pill Case</li>
<li>Fitness</li>
<li>Bicycle</li>
<li>Wine</li>
</ul>
</div>
</div>
<div class="content-body">
<div class="content">
<img src="/image/bento/20170521223952w6A7Gz9kL8KlUW1g.jpg-w600.jpg" style="height:80%; width:100%">
<br>Pockeat
</div>
</div>
It is because your sidebar and your content-body are too large to be floated.
If you want to use width: 80% with a padding, you should use:width: calc(80% - padding), same for borders.
.header {
background-color:#ffffff;
top:0;
height:10%;
width:100%;
color:#1c1919;
font-family:century gothic;
font-size:56px;
padding:15px;
text-decoration:none;
float:center;
text-align:center;
top:2%;
}
.navbar {
position:relative;
display:inline-block;
text-align:center;
overflow:hidden;
background-color:#ffffff;
height:8%;
width: 100%;
border-top:4px solid #1c1919;
border-bottom:4px solid #1c1919;
padding:5px;
}
.navbar a {
text-align:center;
text-decoration:none;
color:#1c1919;
font-family:century gothic;
font-size:32px;
padding:0 30px;
}
.sidebar {
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
height:82%;
width:20%;
float: left;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active, button.accordion:hover {
opacity:0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color:#ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration:none;
font-family:century gothic;
font-size:15px;
text-align:left;
color: #1c1919;
padding:10px;
display:block;
}
.content-body {
background-color:#ffffff;
height:82%;
width:80%;
text-decoration:none;
float:left;
}
.content {
height:60px;
width:50px;
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
padding:10px;
font-size:20px;
display:block;
}
<!navbar>
<div class="navbar">
HOME
NEWEST
RECOMMENDED
ALL TIME FAVE
CONTACT US
</div>
<!sidebar>
<div class="sidebar">
<button class="accordion">Gadgets</button>
<div class="panel">
<ul>
<li>Camera</li>
<li>Watch</li>
<li>Music</li>
<li>Phone</li>
<li>Bracelet</li>
</ul>
</div>
<button class="accordion">Furniture</button>
<div class="panel">
<ul>
<li>Wheelchair</li>
<li>Lights</li>
<li>Table/ Chair</li>
<li>Storage</li>
</ul>
</div>
<button class="accordion">Lifestyle</button>
<div class="panel">
<ul>
<li>Window Blinds</li>
<li>Ornaments</li>
<li>Mask</li>
<li>Socks</li>
<li>Gardening</li>
</ul>
</div>
<button class="accordion">Instruments</button>
<div class="panel">
<ul>
<li>Guitar</li>
<li>Flute</li>
<li>Tuner</li>
</ul>
</div>
<button class="accordion">Kitchen/Bathroom</button>
<div class="panel">
<ul>
<li>Ready-to-Eat</li>
<li>Bag</li>
<li>Pot</li>
<li>Kit</li>
</ul>
</div>
<button class="accordion">Pet</button>
<div class="panel">
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
</div>
<button class="accordion">Stationery</button>
<div class="panel">
<ul>
<li>Pen Pouch</li>
<li>Clock</li>
</ul>
</div>
<button class="accordion">Toy</button>
<div class="panel">
<ul>
<li>Block</li>
<li>Doll</li>
<li>Card</li>
</ul>
</div>
<button class="accordion">Other</button>
<div class="panel">
<ul>
<li>Pill Case</li>
<li>Fitness</li>
<li>Bicycle</li>
<li>Wine</li>
</ul>
</div>
</div>
<!content>
<div class="content-body">
<div class="content">
<img src="/image/bento/20170521223952w6A7Gz9kL8KlUW1g.jpg-w600.jpg" style="height:80%; width:100%">
<br>Pockeat
</div>
</div>
I think it will solve your issue.
.header {
background-color:#ffffff;
top:0;
height:10%;
width:100%;
color:#1c1919;
font-family:century gothic;
font-size:56px;
padding:15px;
text-decoration:none;
float:center;
text-align:center;
top:2%;
}
.navbar {
position:relative;
display:inline-block;
text-align:center;
overflow:hidden;
background-color:#ffffff;
height:8%;
width: 100%;
border-top:4px solid #1c1919;
border-bottom:4px solid #1c1919;
padding:5px;
}
.navbar a {
text-align:center;
text-decoration:none;
color:#1c1919;
font-family:century gothic;
font-size:32px;
padding:0 30px;
}
.sidebar {
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
height:82%;
width:20%;
border-right:2px solid #1c1919;
float: left;
}
button.accordion {
background-color: #f2f2f2;
color: #1c1919;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
button.accordion.active, button.accordion:hover {
opacity:0.7;
}
button.accordion:after {
content: '\002B';
color: #1c1919;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: "\2212";
}
div.panel {
padding: 0 18px;
background-color:#ffffff;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.panel li a {
text-decoration:none;
font-family:century gothic;
font-size:15px;
text-align:left;
color: #1c1919;
padding:10px;
display:block;
}
.content-body {
background-color:#ffffff;
height:82%;
width:calc(100% - 20% - 22px);
text-decoration:none;
padding:10px;
float:right;
}
.content {
height:60px;
width:50px;
background-color:#ffffff;
text-decoration:none;
font-family:century gothic;
padding:10px;
font-size:20px;
display:block;
}
<!--navbar -->
<div class="navbar">
HOME
NEWEST
RECOMMENDED
ALL TIME FAVE
CONTACT US
</div>
<div id="wrapper">
<!--sidebar -->
<div class="sidebar">
<button class="accordion">Gadgets</button>
<div class="panel">
<ul>
<li>Camera</li>
<li>Watch</li>
<li>Music</li>
<li>Phone</li>
<li>Bracelet</li>
</ul>
</div>
<button class="accordion">Furniture</button>
<div class="panel">
<ul>
<li>Wheelchair</li>
<li>Lights</li>
<li>Table/ Chair</li>
<li>Storage</li>
</ul>
</div>
<button class="accordion">Lifestyle</button>
<div class="panel">
<ul>
<li>Window Blinds</li>
<li>Ornaments</li>
<li>Mask</li>
<li>Socks</li>
<li>Gardening</li>
</ul>
</div>
<button class="accordion">Instruments</button>
<div class="panel">
<ul>
<li>Guitar</li>
<li>Flute</li>
<li>Tuner</li>
</ul>
</div>
<button class="accordion">Kitchen/Bathroom</button>
<div class="panel">
<ul>
<li>Ready-to-Eat</li>
<li>Bag</li>
<li>Pot</li>
<li>Kit</li>
</ul>
</div>
<button class="accordion">Pet</button>
<div class="panel">
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
</div>
<button class="accordion">Stationery</button>
<div class="panel">
<ul>
<li>Pen Pouch</li>
<li>Clock</li>
</ul>
</div>
<button class="accordion">Toy</button>
<div class="panel">
<ul>
<li>Block</li>
<li>Doll</li>
<li>Card</li>
</ul>
</div>
<button class="accordion">Other</button>
<div class="panel">
<ul>
<li>Pill Case</li>
<li>Fitness</li>
<li>Bicycle</li>
<li>Wine</li>
</ul>
</div>
</div>
<!--content-->
<div class="content-body">
<div class="content">
<img src="/image/bento/20170521223952w6A7Gz9kL8KlUW1g.jpg-w600.jpg" style="height:80%; width:100%">
<br>Pockeat
</div>
</div>
</div>
I'm having a hard time centering a logo on the nav bar for a website I'm working on. I've tried a few things but nothing has been successful. I want to have the logo in the center of the nav bar and the other items on the left and right of it. Currently, everything is spaced out evenly, including the logo, so it is not centered. Any help would be appreciated.
HTML
<nav class="main-nav-outer" id="test">
<div class="container">
<ul class="main-nav">
<li>Home</li>
<li>Services</li>
<li>Seasonal Specials</li>
<li class="small-logo">
<img src="img/logo.png" alt="">
</li>
<li>Products</li>
<li>Team</li>
<li>Contact</li>
</ul>
<a class="res-nav_click" href="#"><i class="fa-bars"></i></a>
</div>
</nav>
CSS
.main-nav-outer{
padding:0px;
border-bottom:1px solid #dddddd;
box-shadow:0 4px 5px -3px #ececec;
position:relative;
background:#fff;
}
.main-nav{
text-align:center;
margin:10px 0 0px;
padding:0;
list-style:none;
}
.main-nav li{
display:inline;
margin:0 1px;
}
.main-nav li a{
display:inline-block;
color:#222222;
text-transform:uppercase;
font-family: 'Montserrat', sans-serif;
text-decoration: none;
line-height:20px;
margin:17px 32px;
transition:all 0.3s ease-in-out;
-moz-transition:all 0.3s ease-in-out;
-webkit-transition:all 0.3s ease-in-out;
}
.main-nav li a:hover{
text-decoration:none;
color: #ec5020;
}
.small-logo{
padding:0 32px;
margin: 0;
}
.main-section{
padding:20px 0 110px;
}
you may wanna use bootstrap and try something like this
<nav class="main-nav-outer" id="test">
<div class="container">
<ul class="main-nav">
<div class="row">
<div class="col-xs-5">
<li>Home</li>
<li>Services</li>
<li>Seasonal Specials</li>
</div>
<div class="col-xs-2">
<li class="small-logo">
<img src="img/logo.png" alt="">
</li>
</div>
<div class="col-xs-5">
<li>Products</li>
<li>Team</li>
<li>Contact</li>
</div>
</div>
</ul>
<a class="res-nav_click" href="#"><i class="fa-bars"></i></a>
</div>
</nav>
just change this selector in CSS with the below code
.main-nav li a {
display: inline-block;
color: #222222;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
text-decoration: none;
line-height: 20px;
margin: 17px 10px;
transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
}
HTML:
<nav class="main-nav-outer" id="test">
<div class="container">
<ul class="main-nav">
<li>Home</li>
<li>Services</li>
<li>Seasonal Specials</li>
<li class="small-logo">
<img src="img/logo.png" alt="">
</li>
<li>Products</li>
<li>Team</li>
<li>Contact</li>
</ul>
<a class="res-nav_click" href="#"><i class="fa-bars"></i></a>
</div>
</nav>
CSS:
.main-nav-outer{
padding:0px;
border-bottom:1px solid #dddddd;
box-shadow:0 4px 5px -3px #ececec;
position:relative;
background:#fff;
}
.main-nav{
margin-left:auto;
margin-right: auto;
list-style:none;
}
.main-nav li{
display:inline;
}
.main-nav li a{
display:inline-block;
color:#222222;
text-transform:uppercase;
font-family: 'Montserrat', sans-serif;
text-decoration: none;
line-height:20px;
margin:17px 32px;
transition:all 0.3s ease-in-out;
-moz-transition:all 0.3s ease-in-out;
-webkit-transition:all 0.3s ease-in-out;
}
.main-nav li a:hover{
text-decoration:none;
color: #ec5020;
}
.small-logo{
padding:0 32px;
}
.main-section{
padding:20px 0 110px;
}
Bootply
Try this:
.navbar-brand {
float: left;
text-align: center;
width: 378px;
}
.navbar-brand span {
margin: 0 auto;
text-align: center;
color:green;
}
.navbar-nav li a{
display:inline-block;
color:#222222;
text-transform:uppercase;
font-family: 'Montserrat', sans-serif;
text-decoration: none;
line-height:20px;
transition:all 0.3s ease-in-out;
-moz-transition:all 0.3s ease-in-out;
-webkit-transition:all 0.3s ease-in-out;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<nav class="navbar navbar-fixed-top navbar-custom ">
<div class="container" >
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand visible-xs" href="#"><span class="navbar-logo">STACK OVERFLOW</span></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li class="active">Home</li>
<li>Menu Item 1</li>
<li>Menu Item 2</li>
</ul>
<a class="navbar-brand hidden-xs text-center" href="#"><span class="navbar-logo">STACK OVERFLOW</span></a>
<ul class="nav navbar-nav navbar-right">
<li class="active">Home</li>
<li>Menu Item 1</li>
</ul>
</div>
</div>
</nav>
When you click on Expand snippet you will see the result..