How to center main part of navbar? - html

I have a navbar which has 4 anchor tag buttons in the center (home, about, services, contact). I dont know how to center it on the navbar. I have another anchor tag on the far left of the navbar (a phone number link). It appears that the part I want to center is centered between the boundary of that far left link and the far right of the page.
I cant figure out how to center these 4 tags on the grid.
Hope that makes sense, im not too good with the jargon.
<a href="tel:1-530-680-8255" style="color:grey; display:inline-block">1-530-680-
8255</a>
<a href="tel:1-530-680-8255"><i class="fas fa-phone" style="display:inline-block">
</i>1-530-680-8255</a>
</div>
<nav class="navigation nav-block secondary-navigation nav-right">
<ul>
<!-- Dropdown Cart Overview
<li>
<div class="dropdown">
<span class="cart-indication"><span class="icon-shopping-cart"></span> <span class="badge">3</span></span>
<ul class="dropdown-list custom-content cart-overview">
<li class="cart-item">
<a href="single-product.html" class="product-thumbnail">
<img src="images/design-agency/portfolio/grid/no-margins/project-6-square.jpg" alt="" />
</a>
<div class="product-details">
<a href="single-product.html" class="product-title">
Cotton Jump Suit
</a>
<span class="product-quantity">2 x</span>
<span class="product-price"><span class="currency">$</span>15.00</span>
</div>
</li>
<li class="cart-item">
<a href="single-product.html" class="product-thumbnail">
<img src="images/design-agency/portfolio/grid/no-margins/project-7-square.jpg" alt="" />
</a>
<div class="product-details">
<a href="single-product.html" class="product-title">
Cotton Jump Suit
</a>
<span class="product-quantity">2 x</span>
<span class="product-price"><span class="currency">$</span>15.00</span>
</div>
</li>
<li class="cart-item">
<a href="single-product.html" class="product-thumbnail">
<img src="images/design-agency/portfolio/grid/no-margins/project-8-square.jpg" alt="" />
</a>
<div class="product-details">
<a href="single-product.html" class="product-title">
Cotton Jump Suit
</a>
<span class="product-quantity">2 x</span>
<span class="product-price"><span class="currency">$</span>15.00</span>
</div>
</li>
<li class="cart-subtotal">
Sub Total
<span class="amount"><span class="currency">$</span>15.00</span>
</li>
<li class="cart-actions">
View Cart
<span class="icon-check"></span> Checkout
</li>
</ul>
</div>
</li> -->
<!-- Dropdown Search Module
<li>
<div class="dropdown">
<span class="icon-magnifying-glass"></span>
<div class="dropdown-list custom-content cart-overview">
<div class="search-form-container site-search">
<form action="#" method="get" novalidate>
<div class="row">
<div class="column width-12">
<div class="field-wrapper">
<input type="text" name="search" class="form-search form-element no-margin-bottom" placeholder="type & hit enter...">
<span class="border"></span>
</div>
</div>
</div>
</form>
<div class="form-response"></div>
</div>
</div>
</div>
</li> -->
<li>
<div class="v-align-middle" style="margin-left: 60px;">
<i class="fab fa-facebook-f"></i>
</div>
</li>
<li class="aux-navigation hide">
<!-- Aux Navigation -->
<a href="#" class="navigation-show side-nav-show nav-icon">
<span class="icon-menu"></span>
</a>
</li>
</ul>
</nav>
<nav class="navigation nav-block primary-navigation nav-center">
<ul>
<li class="current">Home <i class="fas fa-home"></i></li>
<li class="current">About <i class="fas fa-at"></i></li>
<li class="current">Services <i class="fas fa-wrench"></i> </li>
<li class="current">Contact <i class="fas fa-phone"></i> </li>
</ul>
</nav>
</div>
</div>
</div>
</header>

You can use floats to position elements side by side on the page and then play with the widths and padding to arrange them how you like. If you are unsure how to use CSS I suggest following some online tutorials.
nav ul {
list-style-type: none;
display: inline-block;
margin: 0px;
padding: 0px;
width: 100%;
}
nav ul li {
display: inline-block;
text-align: center;
width: 60px;
margin: 0px;
padding: 0px;
}
nav ul li span {
font-size: 0.7em;
}
nav ul li i {
font-size: 2em;
}
.left {
width: 40%;
float: left;
}
.right {
width: 60%;
float: right;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<nav>
<div class="left">
<p>000 000 0000</p>
</div>
<div class="right">
<ul>
<li><i class="fas fa-phone"></i><br><span>Contact</span></li>
<li><i class="fas fa-wrench"></i><br><span>Services</span></li>
<li><i class="fas fa-at"></i><br><span>About</span></li>
<li><i class="fas fa-home"></i><br><span>Home</span></li>
</ul>
</div>
</nav>

there is alot of existing css that came with this template. For me to run your css and html, it would change too many properties to the point where its unrecognizable. Despite that this is a perfect answer. HOWEVER: I took your css:
nav ul {
list-style-type: none;
display: inline-block;
margin: 0px;
padding: 0px;
width: 100%;
}
and i changed it to these values:
nav ul {
display: inline-block;
text-align: center;
width: 1100px;
margin: 200px;
padding: 200px;
}
Its centered. But now the container is vertically huge. Need it the original height
Screenshot

Ok lets start over. I just want to center these 4 anchor tag li's inside of this ul.
Is there someway I can wrap these four into one container, and then move them to the left with css? I just want those 4 items to appear centered in that ul.
Heres a picture of what im talking about
Below is my total header in html. Theres a lot of CSS so i dont know what to link people to but ill put what i have been playing with below.
<!-- Header -->
<header class="header header-fixed header-fixed-on-mobile header-transparent" data-bkg-threshold="100">
<div class="header-inner">
<div class="row nav-bar">
<div class="column width-12 nav-bar-inner">
<div class="logo">
<div>
<a href="tel:1-530-680-8255" style="color:grey; display:inline-block">1-530-680-
8255</a>
<a href="tel:1-530-680-8255"><i class="fas fa-phone" style="display:inline-block">
</i>1-530-680-8255</a>
</div>
</div>
<nav class="navigation nav-block secondary-navigation nav-right">
<ul>
<li class="aux-navigation hide">
<!-- Aux Navigation -->
<a href="#" class="navigation-show side-nav-show nav-icon">
<span class="icon-menu"></span>
</a>
</li>
</ul>
</nav>
<nav class="navigation nav-block primary-navigation nav-center">
<ul>
<li class="current">Home <i class="fas fa-home"></i></li>
<li class="current">About <i class="fas fa-at"></i></li>
<li class="current">Services <i class="fas fa-wrench"></i> </li>
<li class="current">Contact <i class="fas fa-phone"></i> </li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<!-- Header End -->
---CSS---
nav ul li {
display: inline-block;
text-align: center;
width: 100px;
margin: 00px;
padding: 0px;
}

Related

How to make header sticky on mobile?

The Goal
To make the header sticky when this responsive HTML5 template is resized to mobile phone dimensions.
The Problem
I cannot seem to find the correct element to add the CSS position property to. No matter what DIV I add the 'sticky' class to, it just won't stay fixed to the top of the screen.
In Action
Desktop Mode Works Fine
Mobile Size Fails
Failed Attempts
I have tried to attach a class, like this...
.makeSticky {
position: -webkit-sticky; /* Safari */
position: sticky;
top: 0;
}
...to every element even remotely close to the header. I just can't find the right one, and get it working.
Live
Here is the page running on a server: http://stpete.epizy.com/en/index.html
Code
<header class="header-area header-3">
<div class="desktop-nav d-none d-lg-block">
<div class="header-nav">
<div class="container-fluid custom-container">
<div class="header-nav-wrapper d-flex justify-content-between">
<div class="header-static-nav">
<p>Get FREE Shipping with <span class="text">$35!</span> Code: FREESHIPPING</p>
</div>
<div class="header-menu-nav">
<ul class="menu-nav">
<li>
<div class="dropdown">
<button type="button" id="setting" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Setting <i class="icon ion-chevron-down"></i></button>
<ul class="dropdown-menu" aria-labelledby="setting">
<li>Checkout</li>
<li>Sign in</li>
</ul>
</div>
</li>
<li>
<div class="dropdown">
<button type="button" id="langue" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="images/1.jpg" alt=""> English <i class="icon ion-chevron-down"></i></button>
<ul class="dropdown-menu" aria-labelledby="langue">
<li><img src="images/1.jpg" alt=""> English</li>
<li><img src="images/2.jpg" alt=""> Spanish</li>
</ul>
</div>
</li>
</ul>
</div> <!-- header menu nav -->
</div> <!-- header nav wrapper -->
</div> <!-- container -->
</div> <!-- header nav -->
<div class="header-middle">
<div class="container-fluid custom-container">
<div class="row">
<div class="col-lg-3">
<div class="header-logo-contact d-flex ">
<div class="desktop-logo">
<a href="index.html">
<img src="images/logo-white.png" alt="Global Eletronics, LLC">
</a>
</div> <!-- desktop logo -->
</div>
</div>
<div class="col-lg-9">
<div class="header-search-cart d-flex align-items-center">
<div class="header-contact d-flex align-items-center">
<i class="icon ion-ios-telephone-outline"></i>
<div class="phone media-body">
<p>24/7 Support</p>
+727-623-0753
</div>
</div>
<div class="header-search media-body">
<form action="#">
<div class="search-category">
<select>
<option value="">All categories</option>
<option value="audio">Audio Parts</option>
<option value="accessories">- - Accessories</option>
<option value="buzzers">- - Buzzers</option>
<option value="batteries">Battery Products</option>
<option value="batteries">- - Primary Batteries</option>
</select>
</div>
<input id="search-box" type="text" placeholder="Part #">
<button><i class="icon ion-android-search"></i></button>
</form>
</div>
<div class="header-cart">
<div class="cart-btn">
<a href="cart.html">
<i class="icon ion-calculator"></i>
<span class="text">RFQ Parts :</span>
<span class="count">0</span>
</a>
</div>
<!--
<div class="mini-cart">
<ul class="cart-items">
<li>
<div class="single-cart-item d-flex">
<div class="cart-item-thumb">
<img src="images/cart-1.jpg" alt="product">
<span class="product-quantity">1x</span>
</div>
</div>
</li>
</ul>
<div class="price_content">
<div class="cart-subtotals">
</div>
<div class="cart-total price_inline">
<span class="label"># Items</span>
<span class="value">12</span>
</div>
</div>
<div class="checkout text-center">
Send RFQ
</div>
</div>
-->
</div>
</div> <!-- header search cart -->
</div>
</div> <!-- row -->
</div> <!-- container -->
</div> <!-- header middle -->
<div class="header-menu">
<div class="container-fluid custom-container">
<div class="row">
<div class="col-lg-3">
<div class="header-menu-vertical">
<h4 class="menu-title">
<span>Parts by</span>
Category
</h4>
<ul class="menu-content menu-expand">
<li class="menu-item">
Semiconductor
</li>
<li class="menu-item">
Passives
</li>
<li class="menu-item">ElectroMechanical</li>
<li class="menu-item">Power & Circuit</li>
<li class="menu-item">Automation</li>
<li class="menu-item">Connectors</li>
<li class="menu-item">Cables & Wires</li>
<li class="menu-item">Test</li>
</ul> <!-- menu content -->
</div> <!-- header menu vertical -->
</div>
<div class="col-lg-9 position-static">
<div class="header-horizontal-menu">
<ul class="menu-content">
<li class="active">Home
</li> <li class="position-static">Products <i class="fal fa-chevron-down"></i>
<ul class="mega-sub-menu d-flex flex-wrap">
<li>
<a class="menu-title" href="#">Shop Grid</a>
<ul class="submenu-item">
<li>Shop Grid Column 3</li>
<li>Shop Grid Column 4</li>
<li>Shop Grid left sidebar</li>
<li>Shop Grid Right sidebar</li>
</ul>
</li>
<li>
<a class="menu-title" href="#">Shop List</a>
<ul class="submenu-item">
<li>Shop List</li>
<li>Shop List Left sidebar</li>
<li>Shop List Right sidebar</li>
</ul>
</li>
<li>
<a class="menu-title" href="#">Shop Single</a>
<ul class="submenu-item">
<li>Shop Single</li>
<li>Shop Variable</li>
<li>Shop Affiliate</li>
<li>Shop Group</li>
<li>Shop Tabs 2</li>
<li>Shop Tabs 3</li>
</ul>
</li>
<li>
<a class="menu-title" href="#">Shop Single</a>
<ul class="submenu-item">
<li>Shop Slider</li>
<li>Shop Gallery Left sidebar</li>
<li>Shop Gallery Right sidebar</li>
<li>Shop Sticky Left sidebar</li>
<li>Shop Sticky Right sidebar</li>
</ul>
</li>
<li class="custom-banner">
<img src="images/custom_banner.jpg" alt="" class="img-responsive">
</li>
</ul>
</li>
<li>Services <i class="fal fa-chevron-down"></i>
<ul class="sub-menu">
<li>About</li>
</ul>
</li>
<li>Resources <i class="fal fa-chevron-down"></i>
<ul class="sub-menu">
<li>BOM Upload Tool</li>
<li>Global Learning Lab</li>
<li>Product Advisor</li>
<li>Articles</li>
</ul>
<li>About</li>
<li>Contact</li>
</ul>
</div> <!-- header horizontal menu -->
</div>
</div> <!-- row -->
</div> <!-- container -->
</div> <!-- header menu -->
</div> <!-- desktop nav -->
<div class="mobile-nav d-lg-none">
<div class="container-fluid">
<div class="mobile-nav-top">
<div class="row align-items-center">
<div class="col-sm-4 col-3">
<div class="mobile-toggle">
<a class="mobile-menu-open" href="javascript:;"><i class="fal fa-bars"></i></a>
</div>
</div>
<div class="col-sm-4 col-5">
<div class="mobile-logo text-center">
<a href="index.html">
<img src="images/logo-white.png" alt="Logo">
</a>
</div> <!-- mobile logo -->
</div>
<div class="col-sm-4 col-4">
<div class="mobile-account-cart">
<ul class="account-cart text-right">
<li>
<div class="dropdown">
<button type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fal fa-user"></i></button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li>My account</li>
<li>Checkout</li>
<li>Sign in</li>
</ul>
</div>
</li>
<li class="header-cart">
<a href="#">
<i class="fal fa-envelope-open-dollar"></i>
<span>0</span>
</a>
<div class="mini-cart">
<ul class="cart-items">
<li>
<div class="single-cart-item d-flex">
<div class="cart-item-thumb">
<img src="images/cart-1.jpg" alt="product">
<span class="product-quantity">1x</span>
</div>
<div class="cart-item-content media-body">
<h5 class="product-name">New Balance Fresh Foam LAZR</h5>
<span class="product-price">€18.90</span>
<span class="product-color"><strong>Color:</strong> White</span>
<i class="fal fa-times"></i>
</div>
</div>
</li>
<li>
<div class="single-cart-item d-flex">
<div class="cart-item-thumb">
<img src="images/cart-2.jpg" alt="product">
<span class="product-quantity">3x</span>
</div>
<div class="cart-item-content media-body">
<h5 class="product-name">New Balance Fresh Foam LAZR</h5>
<span class="product-price">€18.90</span>
<span class="product-color"><strong>Color:</strong> White</span>
<i class="fal fa-times"></i>
</div>
</div>
</li>
</ul>
<div class="price_content">
<div class="cart-subtotals">
<div class="products price_inline">
<span class="label">Subtotal</span>
<span class="value">€30.80</span>
</div>
<div class="shipping price_inline">
<span class="label">Shipping</span>
<span class="value">€7.00</span>
</div>
<div class="tax price_inline">
<span class="label">Taxes</span>
<span class="value">€0.00</span>
</div>
</div>
<div class="cart-total price_inline">
<span class="label">Total</span>
<span class="value">€37.80</span>
</div>
</div> <!-- price content -->
<div class="checkout text-center">
Checkout
</div>
</div> <!-- mini cart -->
</li>
</ul>
</div>
</div>
</div> <!-- row -->
</div> <!-- mobile nav top -->
<div class="header-search">
<form action="#">
<div class="search-category">
<select>
<option value="0">All categories</option>
<option value="12">Laptop</option>
<option value="13">- - Hot Categories</option>
<option value="19">- - - - Dresses</option>
<option value="20">- - - - Jackets & Coats</option>
<option value="21">- - - - Sweaters</option>
<option value="22">- - - - Jeans</option>
<option value="23">- - - - Blouses & Shirts</option>
</select>
</div>
<input type="text" placeholder="Enter your search key ... ">
<button><i class="icon ion-android-search"></i></button>
</form>
</div>
</div> <!-- container -->
<div class="mobile-off-canvas-menu">
<div class="mobile-canvas-menu-top">
<ul class="menu-nav">
<li><i class="fal fa-repeat"></i> Compare (0)</li>
<h6 class="custom-title">Women is Clothes & Fashion</h6>
<p>Shop women is clothing and accessories and get inspired by the latest fashion trends.</p>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="menu-block">
<h6 class="custom-title">Simple Style</h6>
<p>A new flattering style with all the comfort of our linen.</p>
</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="menu-block">
</ul>
</li>
<li class="menu-item-has-children">
<span>Outerwear & Jackets</span>
<li>Bags & Cases</li>
</ul> <!-- menu content -->
</div> <!-- mobile main menu -->
</div> <!-- mobile off canvas menu -->
<div class="overlay"></div>
</div> <!-- mobile nav -->
</header>
CSS
/*===== header 3 =====*/
.header-3 {
background-color: #1c2454; }
.header-3 .header-nav {
background-color: #000;
border-bottom: 0; }
.header-3 .header-nav .header-nav-wrapper .header-static-nav p {
color: #fff; }
.header-3 .header-nav .header-nav-wrapper .header-static-nav p .text {
color: #fff; }
.header-3 .header-nav .header-nav-wrapper .header-menu-nav .menu-nav li + li {
margin-left: 30px; }
#media only screen and (min-width: 992px) and (max-width: 1199px) {
.header-3 .header-nav .header-nav-wrapper .header-menu-nav .menu-nav li + li {
margin-left: 20px; } }
.header-3 .header-nav .header-nav-wrapper .header-menu-nav .menu-nav li + li::before {
color: rgba(255, 255, 255, 0.4); }
.header-3 .header-nav .header-nav-wrapper .header-menu-nav .menu-nav li a {
color: #fff; }
.header-3 .header-nav .header-nav-wrapper .header-menu-nav .menu-nav li .dropdown button {
color: #fff; }
.header-3 .header-contact i {
color: #fff; }
.header-3 .header-contact .phone p {
color: #fff; }
.header-3 .mobile-toggle a {
color: #fff; }
.header-3 .mobile-account-cart .account-cart li .dropdown button {
color: #fff; }
.header-3 .mobile-account-cart .account-cart li .dropdown button i {
font-size: 24px; }
.header-3 .mobile-account-cart .account-cart li a {
color: #fff; }
.header-3 .header-menu {
background-color: #1c2454;
border-top: 1px solid rgba(255, 255, 255, 0.4); }
.header-3 .header-menu.sticky {
border-top: 0; }
I inherited this project, and the HTML was purchased from some template company. I didn't write the HTML - so any help would be greatly appreciated.
Thank you.
The sticky position needs space, and for that to work, the .header-area class needs to be sticky. Only add this rule to your media query! I just tried it, and sticky position worked like this:
.header-area {
position: sticky;
top: 0;
z-index: 9999;
}
You need to specify position: fixed to mobile navigation. The desktop nav has the same property but also has a custom animation sticky. You may also want to adjust the element below it because the menu is now fixed.
#media and (max-width: 600px) { /* Target only devices below 600px */
.header-area {
position: fixed;
z-index: 999; /* So that it is not under the other elements */
background: #1c2454; /* It was transparent */
}
.slider-area {
top: 85px; /* Can change according to your liking */
}
}
Output:

How can i make active background color for two elements in nav menu

I have a vertical navbar menu with 2 blocks.
First is nav with icons, second is text of menu.
They have a different background colors. How i can make one background color for two active nav blocks?
design of menu
<div class="menu__icons">
<ul class="menu__list">
<li>
<a class="menu__item" href="#"><img src="http://via.placeholder.com/50" alt=""></a>
</li>
<li>
<a class="menu__item" href="#"><img src="http://via.placeholder.com/50" alt=""></a>
</li>
<li>
<a class="menu__item" href="#"><img src="http://via.placeholder.com/50" alt=""></a>
</li>
<li>
<a class="menu__item" href="#"><img src="http://via.placeholder.com/50" alt=""></a>
</li>
</ul>
</div>
<div class="menu__text">
<ul class="menu__list">
<li><a class="menu__item" href="#">First</a></li>
<li><a class="menu__item" href="#">Second</a></li>
<li><a class="menu__item" href="#">Third</a></li>
<li><a class="menu__item" href="#">Fourth</a></li>
</ul>
</div>
</div>
https://jsfiddle.net/levan563/1g5ucmwq/2/
Well basically if you want to toggle .active and you don't want two separate markup of list.
Notice that font-awesome is for demonstration purposes only.
.menu__item {
width: 250px;
height: 50px;
text-align: left;
}
.menu__item.active {
background-color: #e9ebfd;
}
.menu__item.active .menu__icon {
background-color: #e9ebfd;
border-left: 4px solid #2c39ec;
}
.menu__item.active .menu__title {
background-color: #e9ebfd;
}
.menu__item a:hover {
text-decoration: none;
}
.menu__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
background-color: #fafafa;
color: #2c39ec;
}
.menu__title {
display: inline-block;
padding-left: 20px;
color: #777777;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navigation-menu">
<ul class="menu__list list-unstyled">
<li class="menu__item active">
<a href="#">
<div class="menu__icon">
<i class="fa fa-tachometer-alt"></i>
</div>
<div class="menu__title">Main Dashboard</div>
</a>
</li>
<li class="menu__item">
<a href="#">
<div class="menu__icon">
<i class="fa fa-user"></i>
</div>
<div class="menu__title">Profile</div>
</a>
</li>
<li class="menu__item">
<a href="#">
<div class="menu__icon">
<i class="fa fa-bell"></i>
</div>
<div class="menu__title">Finances</div>
</a>
</li>
<li class="menu__item">
<a href="#">
<div class="menu__icon">
<i class="fa fa-calendar"></i>
</div>
<div class="menu__title">Titles</div>
</a>
</li>
</ul>
</nav>
Related Fiddle https://jsfiddle.net/mhrabiee/dojL9get/28/
As I understand take active class for both block's li and try to use font, svg icon or transparent background images instead of block images
.menu__list .active {
background-color: red;
}
<div class="menu__icons">
<ul class="menu__list">
<li><a class="menu__item active" href="#">
<img src="https://img.icons8.com/material/24/000000/tailoring-for-men.png">
</a></li>
</ul>
</div>
<div class="menu__text">
<ul class="menu__list">
<li><a class="menu__item active" href="#">First</a></li>
</ul>
</div>
Its doable using jQuery.
Assuming you have same number of list items in both blocks,
$(function(){
$('.menu__list li').on('click', function() {
var idx = $(this).index();
$('.menu__list li').removeClass('active');
$('.menu__list li:nth-child(' + idx + ')').addClass('active');
});
});
also add .active class in css and give needed style to li items also
.active{
/**your style**/
}
.active > a{
}
.active img{
}

Footer Not Sticking To The Bottom Of The Page

My footer is not sticking to the bottom of the page. I have already tried the following:
footer { /* position must be absolute and bottom must be 0 */
height: 100px;
width: 100%;
background: rgba(255,255,255,0.2);
position: absolute;
bottom: 0;
}
footer {
height: 50px;
position: absolute;
left: 0;
right: 0;
background-color: #00A;
z-index: 150;
}
footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 30px;
}
None of these solutions (found on stackoverflow) have worked out for me so far so I have made a codepen with what I have:
http://codepen.io/sredmond/pen/revjdv
If you expand the code pen so that you see more of the result than the code you will see that it stays
NAVBAR
JUMBOTRON
CONTENT
FOOTER
<!--
Random white space
-->
What I want it to do is go like this:
NAVBAR
JUMBOTRON
CONTENT
FOOTER
Thanks!
Put your .row in div inside footer, maybe row class override your position setting.
Not:
<footer class="row"></footer>
But:
<footer><div class="row"></div></footer>
And then:
footer {
position: fixed;
left: 0; bottom: 0; right: 0;
}
EDIT
So you need flexbox (or tables, flexbox is simplier but less backward compatible):
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<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" href="/">Project</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
<li>Terms Of Service</li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-xs hidden-sm">
<li>
<a class="btn" href="https://www.facebook.com/Tech-U-276023285879783/" target="_blank" onclick="ga('send','event','engagement','facebook')"><span class="fa fa-facebook"></span></a>
</li>
<li>
<a class="btn" href="https://twitter.com/TechUHost?s=09" target="_blank" onclick="ga('send','event','engagement','twitter')"><span class="fa fa-twitter"></span></a>
</li>
<li>
<a class="btn" href="https://play.google.com/store/apps/developer?id=TechU" target="_blank" onclick="ga('send','event','engagement','android')"><span class="fa fa-android"></span></a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-md hidden-lg hidden-sm text-center">
<li class="social-icons">
<a class="btn" href="https://www.facebook.com/Tech-U-276023285879783/" target="_blank" onclick="ga('send','event','engagement','facebook')"><span class="fa fa-facebook"></span></a>
<a class="btn" href="https://twitter.com/TechUHost?s=09" target="_blank" onclick="ga('send','event','engagement','twitter')"><span class="fa fa-twitter"></span></a>
<a class="btn" href="https://play.google.com/store/apps/developer?id=TechU" target="_blank" onclick="ga('send','event','engagement','android')"><span class="fa fa-android"></span></a>
</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
<div class="content-wrapper">
<div class="content-body">
<div class="jumbotron">
<h1 class="text-center">Portfolio</h1>
</div>
<div class="row">
<div class="col-xs-12 col-md-4 text-center bottom-30">
<h4 class="bold">PeppNation</h4>
<a href="http://www.peppnation.techuhost.com" target="_blank">
<img src="/Assets/Images/Images/Portfolio/PeppNation.png" width="300"/>
</a>
</div>
<div class="col-xs-12 col-md-4 text-center bottom-30">
<h4 class="bold">Brock Report - Publications Page</h4>
<a href="http://brockreport.com/publications.aspx" target="_blank">
<img src="/Assets/Images/Images/Portfolio/BrockReport.png" width="300"/>
</a>
</div>
<div class="col-xs-12 col-md-4 text-center bottom-30">
<h4 class="bold">Camp BASIC</h4>
<a href="http://campbasicdev.dev2.nsrit.com/" target="_blank">
<img src="/Assets/Images/Images/Portfolio/CampBasic.png" width="300"/>
</a>
</div>
</div>
</div>
<footer class="content-footer">
<div class="row text-center">
<div class="col-xs-12 col-md-2">
<h4 class="bold">TechU</h4>
<p>Terms Of Service</p>
<p>© 2016 - TechU</p>
</div>
<div class="col-xs-12 col-md-3">
<h4 class="bold">Contact Information</h4>
<p>Phone: <strong>(414) 255-5423</strong></p>
<p>Email: <strong>samjredmond#yahoo.com</strong></p>
</div>
<div class="col-xs-12 col-md-3">
<h4 class="bold">Business Hours</h4>
<p>Monday - Friday: <strong>9 a.m. - 5 p.m. CST</strong></p>
<p>Saturday & Sunday: <strong>Closed</strong></p>
</div>
<div class="col-xs-12 col-md-4">
<ul class="nav navbar-nav hidden-xs footer-social-button-align">
<li>
<a class="btn" href="https://www.facebook.com/Tech-U-276023285879783/" target="_blank" onclick="ga('send','event','engagement','facebook')"><span class="fa fa-facebook"></span></a>
</li>
<li>
<a class="btn" href="https://twitter.com/TechUHost?s=09" target="_blank" onclick="ga('send','event','engagement','twitter')"><span class="fa fa-twitter"></span></a>
</li>
<li>
<a class="btn" href="https://play.google.com/store/apps/developer?id=TechU" target="_blank" onclick="ga('send','event','engagement','android')"><span class="fa fa-android"></span></a>
</li>
</ul>
<ul class="nav navbar-nav hidden-md hidden-lg hidden-sm">
<li class="social-icons">
<a class="btn" href="https://www.facebook.com/Tech-U-276023285879783/" target="_blank" onclick="ga('send','event','engagement','facebook')"><span class="fa fa-facebook"></span></a>
<a class="btn" href="https://twitter.com/TechUHost?s=09" target="_blank" onclick="ga('send','event','engagement','twitter')"><span class="fa fa-twitter"></span></a>
<a class="btn" href="https://play.google.com/store/apps/developer?id=TechU" target="_blank" onclick="ga('send','event','engagement','android')"><span class="fa fa-android"></span></a>
</li>
</ul>
</div>
</div>
</footer>
</div>
</div>
</body>
&CSS
html, body {
height: 100%;
padding-top: 0;
background-color: #cccccc;
}
.body-content {
height: 100%;
}
.content-wrapper {
display: flex;
flex-direction: column;
height: 100%
}
.content-body {
flex: 1 0 auto;
overflow-y: auto;
overflow-x: hidden;
padding-top: 50px;
}
.content-footer {
flex: 0 0 auto;
}
I tried this many times and it works perfect for me.
https://css-tricks.com/snippets/css/sticky-footer/
Hope it helps :)
The problem is, that your html and your body tag dont expand to the bottom of the screen, if you have no content. To make your html expand to the bottom add this css:
html,
body {
margin:0; /* removes any margin (especially at the bottom) */
padding:0; /* removes any padding (especially at the bottom) */
height:100%; /* will make it expand to the end */
}

Bootstrap footer - Links - Social Media Logos - Links

I'm working on a footer for my website. I added social media logos from font-awesome and put it in the middle of my footer. When I added the links, the logos weren't in the middle anymore and you cannot see the links on the right side. I'm relatively new to HTML/CSS and I don't know how to fix it. What should I change that it looks like in the 2nd picture?
And how can I change the "px" in the CSS file into "%" that it looks same on every monitor?
Sorry if my English isn't the best, Thanks in advance. :)
What it looks like
What it should look like
My code:
footer {
position: absolute;
bottom: 0;
width: 100%;
position: fixed;
height: 40px;
background-color: #999999;
}
footer ul.footerleft{
margin-left: 150px;
margin-top: 10px;
}
footer ul.footerleft li{
display: inline;
margin-right: 25px;
}
footer a{
color: #222;
}
footer a:hover{
color: #ffffff;
text-decoration: none;
}
.social:hover {
-webkit-transform: scale(1.0);
-webkit-transition-duration: 0.5s;
}
.social {
-webkit-transform: scale(0.8);
color: #222;
}
<!-- footer -->
<footer class="footer">
<nav class="navbar navbar-default navbar-custom">
<div class="container-fluid">
<div class="nav navbar-nav navbar-left">
<ul class="footerleft">
<li>
Link 1
</li>
<li>
Link 2
</li>
<li>
Link 3
</li>
</ul>
</div>
<div class="text-center center-block">
<i id="social-fb" class="fa fa-facebook-square fa-3x social"></i>
<i id="social-tw" class="fa fa-twitter-square fa-3x social"></i>
<i id="social-gp" class="fa fa-google-plus-square fa-3x social"></i>
<i id="social-em" class="fa fa-envelope-square fa-3x social"></i>
</div>
<div class="nav navbar-nav navbar-right">
<ul>
<li>
Link 4
</li>
<li>
Link 5
</li>
<li>
Text
</li>
</ul>
</div>
</div>
</nav>
</footer>
I got it to work by moving the navbar-right div to the top.
<footer class="footer">
<nav class="navbar navbar-default navbar-custom">
<div class="container-fluid">
<div class="nav navbar-nav navbar-right">
<ul class="footerright">
<li>
Link 4
</li>
<li>
Link 5
</li>
<li>
Text
</li>
</ul>
</div>
<div class="nav navbar-nav navbar-left">
<ul class="footerleft">
<li>
Link 1
</li>
<li>
Link 2
</li>
<li>
Link 3
</li>
</ul>
</div>
<div class="text-center">
<i id="social-fb" class="fa fa-facebook-square fa-3x social"></i>
<i id="social-tw" class="fa fa-twitter-square fa-3x social"></i>
<i id="social-gp" class="fa fa-google-plus-square fa-3x social"></i>
<i id="social-em" class="fa fa-envelope-square fa-3x social"></i>
</div>
</div>
</nav>
</footer>
Then added some css for the footerright:
footer ul.footerright{
margin-right: 150px;
margin-top: 10px;
}
footer ul.footerright li{
display: inline;
margin-right: 25px;
}

Bootstrap 3 Vertical Nav bar

I want to create navigation bar [vertical] with bootstrap 3.
I tried this but it didn't work.
<ul class="nav nav-pils nav-stacked">
<li>jedan</li>
<li>dva</li>
<li>tri</li>
<li>cetriri</li>
<li>pet</li>
</ul>
I tried a lot of examples but it is all with old bootstrap. How to create that navigation with new bootstrap?
nav-pills class needs two l:
<ul class="nav nav-pills nav-stacked">
<li>jedan</li>
<li>dva</li>
<li>tri</li>
<li>cetriri</li>
<li>pet</li>
</ul>
http://getbootstrap.com/components/#nav-pills
It looks like you are missing an l in nav-pills (you have it listed as nav-pils)
<ul class="nav nav-pills nav-stacked">
<li>jedan</li>
<li>dva</li>
<li>tri</li>
<li>cetriri</li>
<li>pet</li>
</ul>
http://getbootstrap.com/components/#nav-pills
you could use the pills or you just could write this:
your html:
<!--navigation-->
<div class="navbar navbar-inverse navbar-fixed-left">
<a class="navbar-brand" href="#">LOGO</a>
<ul class="nav navbar-nav">
<li><i class="fa fa-home"></i><span> Link1 </span></li>
<li><i class="fa fa-info-circle"></i><span> Link2 </span></li>
<li><i class="fa fa-heart"></i><span> Link3 </span></li>
<li><i class="fa fa-briefcase"></i><span> Link4 </span></li>
<li><i class="fa fa-envelope"></i><span> Link5 </span></li>
</ul>
</div>
<!--end navigation-->
<!-- 1st section-->
<div class="wrapper">
<div class="container" id="home">
<div class="row">
<h2>Link 1</h2>
</div>
</div>
<!-- 2nd section-->
<div class="container" id="info">
<div class="row">
<h2>Link 2</h2>
</div>
</div>
<!--3rd section-->
<div class="container" id="love">
<div class="row">
<h2>Link 3</h2>
</div>
</div>
<!--4th section-->
<div class="container" id="work">
<div class="row">
<h2>Link 4</h2>
</div>
</div>
<!--5th section-->
<div class="container" id="contact">
<div class="row">
<h2>Link 5</h2>
</div>
</div>
</div>
your css:
/* CSS used here will be applied after bootstrap.css */
.navbar-fixed-left {
width: 140px;
position: fixed;
border-radius: 0;
height: 100%;
}
.navbar-fixed-left .navbar-nav > li {
float: none; /* Cancel default li float: left */
width: 139px;
}
.navbar-fixed-left + .container {
padding-left: 160px;
}
.container {
height: 1000px;
}
.wrapper {
margin-left: 140px;
}
working example here: bootply
I came late to the party but in case you just got here and you would like to add toggle to your vertical nav:
<nav class="list-group">
<ul class="nav">
<li>
<a href="#" id="btn-1" data-toggle="collapse" data-target="#submenu1" aria-expanded="false" class="list-group-item">Item 1
</a>
<ul class="nav collapse" id="submenu1" role="menu" aria-labelledby="btn-1">
<li>
<a href="#" class="list-group-item">
Item 2
</a>
</li>
<li>
<a href="#" class="list-group-item">
Item 3
</a>
</li>
</ul>
</li>
</ul>
</nav>
Use navbar-pills. It will work.