I want the sidebar to comeout when hovered over class 'product'
<div class="sidebar">
<nav class="sidebar-nav">
<ul>
<li>Overview</li>
<li>Website Analytics</li>
<li>Connected Services</li>
<li>About Me</li>
</ul>
</nav>
</div>
<div class="main-back">
<h5>Get Your Own Website <span>Now.</span> </h5>
<p>With Little Investment You can Get High End Website <br> With Responsiveness.</p>
Order-Now
<div class="icons">
<i class="fab fa-instagram"></i>
<i class="fab fa-facebook"></i>
<i class="fab fa-twitter"></i>
</div>
</div>
<header>
<h3 class=".logo"><i class="fab fa-pied-piper-square"></i>SKILLREP</h3>
<nav class="navigation1">
<ul>
<li>PRODUCT <i class="fas fa-chevron-down"></i></li>
<li>TEMPLATE <i class="fas fa-chevron-down"></i></li>
<li>RESOURCE <i class="fas fa-chevron-down"></i></li>
</ul>
</nav>
I placed the sidebar at top:-40px using position absolute which becomes not visible when i hover over the product it is not coming out in the main page.
body .sidebar{
width: 100%;
height: 30vh;
background-color: black;
position: absolute;
top: -30vh;
}
.sidebar .sidebar-nav ul{
display: block;
margin-left: 38vw;
margin-top: 10vh;
}
.sidebar .sidebar-nav ul li a{
color: white;
line-height: 30px;
font-family: 'poppins',sans-serif;
}
body header .navigation1 ul li a:hover .sidebar{
top: 30vh;
}
Although it can be achieved accordingChange other Div style on hover
I don't recommend doing it that way. A better approach would be to use Javascript to achieve the effect.
First hide your sidebar using display:none; in CSS and then change it dynamically via JS.
function displaySidebar(x){
x.style.display="block";
}
<div class="sidebar" onmouseover="displaySidebar(this)">
<nav class="sidebar-nav">
<ul>
<li>Overview</li>
<li>Website Analytics</li>
<li>Connected Services</li>
<li>About Me</li>
</ul>
</nav>
</div>
Related
I got this said responsive grid,
where i want the nav to take up the first row,
I manged to accomplish that, however the height of the nav becomes half the page,
I've manged to figured out the the grid splits into 2 rows, based on the height the list was initially,
the row doesnt seem to take the new height of the list.
The nav has alot of empty space below it.
What i actually want the following items to appear just below it , no extra space
and BTW, without knowing the placment , how would one go about
The Html:
<div class="container">
<nav>
<header>
<h3>BestBook INC</h3>
</header>
<ul>
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
<li>Login <i class="fas fa-user fa-lg"></i>
</li>
<li class="hide">
<i class="fas fa-user-cog fa-lg"></i>
</li>
<li>register <i class="fas fa-user-plus fa-lg"></i>
</li>
<li>Log Out <i class="fas fa-sign-out-alt fa-lg "></i>
</li>
<li class="cart">
<i class="fas fa-shopping-cart fa-3x"></i>
</li>
</ul>
</nav>
The CSS:
.container{
height: 100vh;
width: 100vw;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
grid-gap: 1rem;
}
nav{
grid-column: 1/-1
}
nav ul{
display: grid;
list-style: none;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
grid-gap: 1rem;
}
nav a{
background-color: var(--primary);
text-decoration: none;
display: block;
text-align: center;
color:var(--dark);
padding: 0.48rem;
font-size: 1.1rem;
box-shadow: var(--shadow);
}
Remove height: 100vh; from container css.
Check out this pen I created.
https://codepen.io/aakash-sharma1/pen/yLNQWMvheight: 100vh;
You probably really want to use flex
header>*{
margin:0;
}
.container{
width:100vw; height:100vh; text-align:center;
}
nav>ul{
display:flex; list-style:none; padding:0;
}
nav>ul>li>a{
text-decoration:none; padding: 0.48rem; font-size:1.1rem; white-space:nowrap;
}
nav>ul>li{
flex:1;
}
.hide{
display:none;
}
<header><h3>BestBook INC</h3></header>
<div class='container'>
<nav>
<ul>
<li><a href='#'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Services</a></li>
<li><a href='#'>Contact</a></li>
<li><a href='#'>Login <i class='fas fa-user fa-lg'></i></a></li>
<li><a href='#'>register <i class='fas fa-user-plus fa-lg'></i></a></li>
<li><a href='#'>Log Out <i class='fas fa-sign-out-alt fa-lg '></i></a></li>
</ul>
</nav>
<div>
<div>one</div>
<div>two</div>
</div>
</div>
On the top of my page I have a navigation with some items ligned horizontally. When I first go on the page it is not horzontally, instead its vertically arragend. What ever when I reload the page it is normal again.
This is my navigation:
HTML:
<nav id="menu"> <i class="fa fa-bars" aria-hidden="true"></i>
<ul>
<a href="#home">
<li>Home</li>
</a>
<a href="#services">
<li>Services</li>
</a>
<a href="#work">
<li>Work</li>
</a>
<a href="#contact">
<li>Contact</li>
</a>
</ul>
</nav>
CSS:
header nav ul li {
margin-left: 25px;
float: left;
}
header nav ul li:hover {
padding-top: 3px;
}
I already tried:
header nav ul li {
margin-left: 25px;
display: inline-block;
}
...which works fine, but when I hover then all items are going down instead of just the one I hovered.
Its hard to explain my issue but you might get the same when visiting the page:
my page I use google chrome browser.
When you've got further question just ask
Thank you
Just try this HTML code once..
<nav id="menu">
<i class="fa fa-bars" aria-hidden="true"></i>
<ul>
<li>Home</li>
<li>Services</li>
<li>Work</li>
<li>Contact</li>
</ul>
</nav>
Please try using anchor-tags inside the list(li) tags.
Try with this code. It will help you.
header nav ul li {
margin-left: 25px;
float: left;
}
header nav li {
display: inline-block;
}
header nav ul li:hover {
padding-top: 3px;
}
<html>
<head>
<title></title>
</head>
<body>
<header>
<nav id="menu">
<i class="fa fa-bars" aria-hidden="true"></i>
<ul>
<a href="#home">
<li>Home</li>
</a>
<a href="#services">
<li>Services</li>
</a>
<a href="#work">
<li>Work</li>
</a>
<a href="#contact">
<li>Contact</li>
</a>
</ul>
</nav>
</header>
</body>
</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;
}
Here are some images of the text which is going out of the footer's background, only on small screens. I didn't find any satisfying solution, so here are the screen shots of both:
The background of the footer is not stretching enough.
Here is the CSS and HTML:
#footer {
height:35vh;
/*border:2px dashed red;*/
background-color:white;
font-family: brandon;
color:#004282;
font-weight:bold;
}
#footer ul {
list-style: none;
padding:4% 0 0 4%;
float:left;
}
#footer ul li {
padding:18% 0 2% 0;
}
#footer ul li a {
text-decoration:none;
}
#footer ul li a:hover {
color:purple;
}
#footer .socialbtn {
padding:3% 0 1% 0;
}
<div class="container">
<div class="row">
<div id="footer" class="col-lg-12">
<div class="col-lg-6 col-md-6 fade ">
<ul>
<li>Our offices</li>
<li>Our craft</li>
<li>Visit the workshop</li>
<li>Be a part of jan traders</li>
</ul>
</div>
<div class="socialbtn col-lg-6 col-md-6 fade">
<ul>
<li>
<i class="fa fa-facebook-f" style="color:#3D5B99;font-size:24px; "></i>
</li>
<li>
<i class="fa fa-twitter centre-block" style="color:#32CDFD;font-size:24px; "></i>
</li>
<li>
<i class="fa fa-instagram" style="color:#F9B200;font-size:24px; "></i>
</li>
</ul>
</div>
<!--
<ul class="col-lg-4 col-md-4">
<li>
<i class="fa fa-facebook-f" style="color:red;font-size:24px;"></i>
</li>
<li>
<i class="fa fa-twitter" style="color:red;font-size:24px;"></i>
</li>
<li>
<i class="fa fa-instagram" style="color:red;font-size:24px;"></i>
</li>
</ul>
-->
</div>
</div>
</div>
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;
}