So I have a header with a navbar and some links like this.
When I hover on a link I have a border around it that looks like this.
Now only the HOME and CONTACT links are working and showing the cursors as a pointer and displaying the borders on hover but the other four aren't working or even showing a cursor to indicate that it's a link. How to fix this? Thanks.
Here's my header code:
<header>
<div class="navbar" id="navbar">
<div class="link" id="link">
HOME
</div>
<div class="link" id="link">
ABOUT
</div>
<div class="link" id="link">
OUR SERVICES
</div>
<div class="link" id="link">
PORTFOLIO
</div>
<div class="link" id="link">
CLIENT ALBUMS
</div>
<div class="link" id="link">
CONTACT
</div>
</div>
<div class="burger-menu">
<a href="javascript:void(0);" class="burger-style" id="showNavs">
<i class="fa fa-bars" style="color: black;"></i>
</a>
</div>
</header>
And here's my CSS:
#media screen and (min-width: 600px) {
header > .navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1em;
padding-top: 1.2em;
margin-left: 3em;
margin-right: 3em;
}
#link {
text-align: center;
margin-left: calc(5px + 1vw);
padding: .5em;
border: 2px solid white;
}
#link:hover {
transition: .5s;
border: 2px solid black;
padding-top: .5em;
padding-bottom: .5em;
padding-left: 2.5em;
padding-right: 2.5em;
}
}
It doesn't work even though I already changed from classes to ids.
Here's my Jquery code but I don't think this is really relevant for this problem.
$(document).ready(function() {
var navbar = $("#navbar")
var showNavs = $("#showNavs")
$("#showNavs").click(function() {
navbar.toggle("slow")
})
var form = $("#contact-form")
var firstName = form.find("#firstName")
var lastName = form.find("#lastName")
var textarea = form.find("#textarea")
form.submit(function(e) {
e.preventDefault();
firstName.val('')
lastName.val('')
textarea.val('')
})
var newsletterForm = $("#newsletter-form")
newsletterForm.submit(function(e) {
e.preventDefault();
$(this).find("#email").val('')
})
})
Here's a full demo of my site.
Wedding Planner Website
The links are working fine when the browser isn't resized.
To Change the cursor to a pointer when you hover over something element add The Following In Your Styles:
cursor: pointer;
this will work regardless of the element when a user hovers over the element.
If It Works Please Mark As Correct!
Kamestart
(If It Does Not Work Please Share Your Code And Write In The Comments. It Will Help A lot.)
Edit: It Wont Work. If You Want To Stay On The Same Fir Testing Purposes Use # in the href attr. if it is empty it will not be recognised as a link.
I suggest you wrap your div's with anchor tag so the whole box will be clickable and also I looked at your site, there's a class="text-container" which is overlapping your Navbar when the window is resized, hope you'll know the reason now.
.navbar{
display:flex;
justify-content: space-evenly;
}
<header>
<div class="navbar" id="navbar">
<a href="">
<div class="link" id="link">
HOME
</div>
</a>
<a href="#about">
<div class="link" id="link">
ABOUT
</div>
</a>
<a href="">
<div class="link" id="link">
OUR SERVICES
</div>
</a>
<a href="#gallery">
<div class="link" id="link">
PORTFOLIO
</div>
</a>
<a href="">
<div class="link" id="link">
CLIENT ALBUMS
</div>
</a>
<a href="#contact">
<div class="link" id="link">
CONTACT
</div>
</a>
</div>
<div class="burger-menu">
<a href="javascript:void(0);" class="burger-style" id="showNavs">
<i class="fa fa-bars" style="color: black;"></i>
</a>
</div>
Related
Below is my current header structure. The page (root) component is implied.
As you see social-links block's geometry is currently handled by the header__social-links mix (absolute position relative to the header).
How do I properly extract social-links to the global (page) scope making it an independent block (fixed position on the page)?
If I introduce the site or page block wrapping the header then I can apply page__social-links mix to solve that. Should header then be transformed into the page__header?
<body>
<header class="header hero" role="banner">
<img class="header__logo" src="assets/logo.png" alt="">
<div class="social-links header__social-links">
<a class="link social-links__link" href="#">
<svg class="social-links__icon">...</svg>
</a>
...
<a class="link social-links__link social-links__link--last" href="#">
<svg class="social-links__icon">...</svg>
</a>
</div>
<div class="navbar header__navbar">
<nav class="site-links navbar__site-links">
<a class="link site-links__link" href="#">1</a>
<a class="link site-links__link" href="#">2</a>
<a class="link site-links__link" href="#">3</a>
<a class="link site-links__link" href="#">4</a>
</nav>
</div>
</header>
...
</body>
You should separate the two scopes header and social-links as parent / child. It is important that BEM blocks are isolated. When using two classes from different blocks on the same elements, we risks future interference, and regression, when we will update one block without checking the other one.
The separation is also important to be able to move the social-links block.
// Show the fixed header on scroll
var fixedHeader = document.querySelector('.page__social-links');
document.addEventListener('scroll', function() {
if (window.scrollY > 100) {
fixedHeader.classList.remove('page__social-links--hidden');
} else {
fixedHeader.classList.add('page__social-links--hidden');
}
});
body {
margin: 0;
height: 300vh;
}
.page__social-links {
position: fixed;
top: 0;
left: 0;
right: 0;
background: hotpink;
}
/* Hide the fixed header by default */
.page__social-links--hidden {
display: none;
}
.header {
border-bottom: 1px solid hotpink;
}
.social-links {
text-align: center;
}
.social-links__link {
padding: 0 0.5em;
line-height: 3em;
}
<div class="page">
<div class="page__header">
<header class="header hero" role="banner">
<img class="header__logo" src="assets/logo.png" alt="" />
<div class="header__social-links">
<div class="social-links">
<a class="link social-links__link" href="#">
twitter
</a>
<a class="link social-links__link social-links__link--last" href="#">
facebook
</a>
</div>
</div>
</header>
</div>
<div class="page__social-links page__social-links--hidden">
<div class="social-links">
<a class="link social-links__link" href="#">
twitter
</a>
<a class="link social-links__link social-links__link--last" href="#">
facebook
</a>
</div>
</div>
</div>
Cheers,
Thomas.
So I have footer section on the website I'm currently building, and the problem is order of them showing. I want to social icons be above ©
Have a look: footer
html:
<div id="footerbot">
<div class="container">
<div class="row">
<div class="col-md-6">
<h5 class="fbh">©2018 - Appo, All Right Reserved</h5>
</div>
<div class="col-md-6">
<img src="img/facebook.png" href="#">
<img src="img/twitter.png" href="#">
<img src="img/dribble.png" href="#">
<img src="img/gplus.png" href="#">
<img src="img/youtube.png" href="#">
</div>
</div> <!-- end of row -->
</div>
css:
#footerbot {
background-color: rgba(34, 48, 71, 0.8);
}
#footerbot img {
display: block;
float: right;
top: 50%;
padding-top: 35px;
padding-left: 15px;
}
#footerbot h5 {
color: #00FFF0;
line-height: 100px;
}
I tried to add class 'order-md-6' to each div with col-md-6, but first of all it didn't work, and secondly it broke layout - it 'pushed' both elements to center. Is it even possible in bootstrap4? I also have a problem centering these items u can see on image I've upload. I'm struggling with this for 2hours and I have no idea how to get this done. I would appreciate any help. Thanks
Bootstrap 4 uses flexbox to position the columns in their rows so you can add the following to your CSS to the control the order of the columns:
.col-md-6:last-child {
order: -1;
}
Not sure if what you provided is the full code sample of your footer or not, but if that's your full html, you're missing a closing tag.
Also, assuming all you want are the icons to go above the copyright line and centered, try this:
#footerbot .socialIcons {
text-align: center;
}
<div id="footerbot">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="socialIcons">
<img src="img/facebook.png" href="#">
<img src="img/twitter.png" href="#">
<img src="img/dribble.png" href="#">
<img src="img/gplus.png" href="#">
<img src="img/youtube.png" href="#">
</div>
<h5 class="fbh">©2018 - Appo, All Right Reserved</h5>
</div>
</div> <!-- end of row -->
</div>
</div>
I have 3 icons that i want to align them in the center i tried different code but nothing is working so far, i tried putting a margin right to it, but the problem with that is that it's adding an unnecessary space between them, so i want them to be close to each other, is there a way to put margin-right to it and remove the space from there ?
i just want to align them below my paragraph but in the center of it.
heres my code so far.
#body a img {
width: 50px;
height: 50px;
margin-top: 50px;
margin-right: 200px;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Will it be a simple text-align missing ?
#body a img {
width: 50px;
height: 50px;
}
.icons {
text-align:center;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Here you are DEMO
#body a img {
width: 50px;
height: 50px;
}
.icons {
text-align: center;
}
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias</p>
<div class="icons">
<a href="https://www.youtube.com/themunkiuke">
<img class="icon1" src="images/youtube.png">
</a>
<a href="http://www.twitch.tv/siminios">
<img class="icon2" src="images/twitch.png">
</a>
<a href="http://yinochi.deviantart.com/gallery/">
<img class="icon3" src="images/art.png">
</a>
</div>
Here's a demo https://jsfiddle.net/r4wwczao/
In HTML I added a container for each icon to give them a percent size (the border is just to see the solution better):
<div id="body">
<p class="text">We are a group of friends that enjoy playing League Of Legends togather, feel free to follow us on our different website medias </p>
<div class="icons">
<div class="icon_div">
<img class="icon1" src="images/youtube.png">
</div>
<div class="icon_div">
<img class="icon2" src="images/twitch.png">
</div>
<div class="icon_div">
<img class="icon3" src="images/art.png">
</div>
</div>
</div>
And CSS:
img{
width: 50px;
height: 50px;
}
.icon_div{
border:1px black solid;
display: inline-block;
text-align: center;
width:32%;
}
I have a weird issue with the text under the icon bar not being centered under the icons.
code example
<div class="row">
<div class="small-12 columns">
<div class="icon-bar five-up small">
<a class="item" a href="/index.html">
<i class="fi-home"></i>
<div>
<label>Home</label>
</div>
</a>
<a class="item" a href="/cart.html">
<i class="fi-shopping-cart"></i>
<div>
<label>Cart</label>
</div>
</a>
<a class="item" a href="/pages/about-us">
<i class="fi-info"></i>
<div>
<label>About</label>
</div>
</a>
<a class="item" a href="/pages/contact-us">
<i class="fi-mail"></i>
<div>
<label>Contact</label>
</div>
</a>
<a class="item" a href="/account/login">
<i class="fi-torso"></i>
<div>
<label>Account</label>
</div>
</a>
</div>
</div>
</div>
I've tried to center the labels with no luck. Has anyone had any issue with this before. Can't post a screenshot since it's a new account. but the contact label and account label seem to start on the left of the icon and go right instead of the start of the actual icon box.
Ok your problems is about CSS in foundation. the property "padding" here:
.icon-bar > * {
font-size: 1rem;
padding: 1.25rem;
}
To fix that, you need to add a media query for mobile. Maybe something like:
#media (max-width: 400px) {
a.item {
padding-left: 0;
padding-right: 0;
position: relative;
text-align: center;
}
}
Change the value 400px of your resolution. If its doesn't work because CSS style is overrite by another.. change padding-left and padding-right for:
padding-left: 0 !important;
padding-right: 0 !important;
Check this JSFiddle
I'm trying to make this navigation bar to work without that "jumpy" effect on Safari.
It works ok on all other browsers.
The problem is that hovering on the links make the bar jumps down.
You can check the code here
http://jsfiddle.net/kpady8hr/14/
<nav class="top-menu">
<div class="divider first"></div>
<a href="#" class="product">
<span class="hover">Link1</span>
<span class="link">Link1</span>
</a>
<div class="divider"></div>
<a href="#" class="product">
<span class="hover">Link2</span>
<span class="link">Link2</span>
</a>
<div class="divider"></div>
<a href="#" class="product">
<span class="hover">Link3</span>
<span class="link">Link3</span>
</a>
<div class="divider last"></div>
</nav>
Any suggestions?
Thanks in advance :)
You need to style the links with vertical-align and compensate in the divider.
For example:
.top-menu .divider.first {
background-position: left center; /* change this */
}
.top-menu .product {
display: inline-block;
position: relative;
height: 22px;
overflow: hidden;
cursor: pointer;
font-size: 18px;
font-weight: 500;
vertical-align: bottom; /* add this */
}