I can't seem to find out why my nav links without dropdowns are affecting the ones that have them. They don't share a same class so that's not the issue.
I made sure in the CSS file to target the drop down links correctly. I feel like I'm missing something rather obvious here. For your viewing pleasure: JSFiddle
.dropdown li .menu {
display: none;
}
.dropdown:hover li .menu {
display: block;
float: none;
}
<script src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<div class="dropdown">
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li>Collections
<ul class="menu">
<li>Autos</li>
<li>Models</li>
<li>Nature</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
Change this
.dropdown:hover li .menu {
display: block;
float: none;
}
to this
.dropdown li:hover .menu {
display: block;
float: none;
}
Snippet
.dropdown li .menu {
display: none;
}
.dropdown li:hover .menu {
display: block;
float: none;
}
<script src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<div class="dropdown">
<ul class="menu dropdown menu-hover-lines" data-dropdown-menu>
<li>Home</li>
<li>Collections
<ul class="menu">
<li>Autos</li>
<li>Models</li>
<li>Nature</li>
<li>Extreme Sports</li>
</ul>
</li>
<li>About me</li>
<li>Get in touch
<ul class="menu">
<li><i class="fas fa-envelope fa-2x" data-toggle="tooltip" title="Email me!"></i></li>
<li><i class="fab fa-twitter fa-2x" data-toggle="tooltip" title="Tweet me!"></i></li>
<li><i class="fab fa-instagram fa-2x" data-toggle="tooltip" title="Message me!"></i></li>
</ul>
</li>
</ul>
</div>
Related
I am trying to use fontawesome as icon in some text (ul -> li ->i)
Image here
I want to align them perfectly from left to right
I tried...
HTML
<ul>
<li><i class="far fa-envelope"></i>Inbox</li>
<li><i class="fas fa-check"></i>Sent</li>
<li><i class="fas fa-exclamation"></i>Important</li>
<li><i class="far fa-file-alt"></i>Draft</li>
<li><i class="fas fa-globe"></i>All Mail</li>
<li><i class="fas fa-exclamation-triangle"></i> Spam</li>
<li><i class="far fa-trash-alt"></i>Trash</li>
</ul>
CSS
.sidebar ul{
list-style: none;
}
.sidebar ul li i{
margin-right: 5px;
float: left;
}
Give the icon a set width
ul {
list-style: none;
}
ul li i {
margin: 5px;
width: 1.5em;
text-align:center
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" rel="stylesheet"/>
<ul>
<li><i class="far fa-envelope"></i>Inbox</li>
<li><i class="fas fa-check"></i>Sent</li>
<li><i class="fas fa-exclamation"></i>Important</li>
<li><i class="far fa-file-alt"></i>Draft</li>
<li><i class="fas fa-globe"></i>All Mail</li>
<li><i class="fas fa-exclamation-triangle"></i>Spam</li>
<li><i class="far fa-trash-alt"></i>Trash</li>
</ul>
a table configuration
ul {
list-style: none;
}
ul li {
display:table-row;
}
ul li [class*="fa"] {
padding: 5px;
display:table-cell;
text-align:center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" rel="stylesheet" />
<ul>
<li><i class="far fa-envelope"></i>Inbox</li>
<li><i class="fas fa-check"></i>Sent</li>
<li><i class="fas fa-exclamation"></i>Important</li>
<li><i class="far fa-file-alt"></i>Draft</li>
<li><i class="fas fa-globe"></i>All Mail</li>
<li><i class="fas fa-exclamation-triangle"></i>Spam</li>
<li><i class="far fa-trash-alt"></i>Trash</li>
</ul>
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>
How can I align an image below text, without the image going to the right of the text?
I'm using flexbox to display the icons/links in columns. But below that, I want the image to be centered below the paragraph of text.
I have tried using clear but no change.
a:link {
color: black;
background-color: transparent;
text-decoration: none;
font-size: 75%;
}
a:visited {
color: black;
background-color: transparent;
text-decoration: none;
font-size: 75%;
}
a:hover {
color: #9700bd;
background-color: transparent;
text-decoration: underline;
font-size: 75%;
}
a:active {
color: #9700bd;
background-color: transparent;
text-decoration: none;
font-size: 75%;
}
footer ul {
list-style: none;
text-align: center;
}
footer div div {
margin: 0 auto;
display: inline-block;
}
footer > div {
/*margin-left: 25%;*/
display: flex;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>
<footer>
<div>
<div>
<ul>
<li><i class="fa fa-facebook-official" aria-hidden="true"></i> Facebook</li>
<li><i class="fa fa-twitter" aria-hidden="true"></i> Twitter</li>
<li><i class="fa fa-instagram" aria-hidden="true"></i> Instagram</li>
<li><i class="fa fa-vine" aria-hidden="true"></i> Vine</li>
</ul>
</div>
<div>
<ul>
<li><i class="fa fa-youtube-play" aria-hidden="true"></i> YouTube</li>
<li><i class="fa fa-twitch" aria-hidden="true"></i> Twitch</li>
<li><i class="fa fa-soundcloud" aria-hidden="true"></i> SoundCloud</li>
<li><i class="fa fa-reddit-alien" aria-hidden="true"></i> Reddit</li>
</ul>
</div>
<div>
<ul>
<li><i class="fa fa-github" aria-hidden="true"></i> GitHub</li>
<li><i class="fa fa-stack-overflow" aria-hidden="true"></i> Stack Overflow</li>
<li><i class="fa fa-jsfiddle" aria-hidden="true"></i> JSFiddle</li>
</ul>
</div>
</div>
<hr>
<div class="footer">
<p class="footer" style="clear: right;">Oh, hello there. My name is Java. No, not the programming language! Well, this is awkward. Not much else to be said... uhm... enjoy your stay, I guess!</p>
<a href="http://itzjavacraft.tk">
<img src="/images/logo.png" alt="ItzJavaCraft" class="footer" />
</a>
</div>
</footer>
Here's a JSFiddle
The quickest solution I can think of is to apply Flexbox only to the <div> that contains your icons/links. That way, the <div> below will remain "un-flexed" and will stack as you expect:
footer {
text-align: center;
}
#footer_links {
display: flex;
}
#footer_links div {
margin: 0 auto;
display: inline-block;
}
#footer_links ul {
list-style: none;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>
<footer>
<div id="footer_links">
<div>
<ul>
<li><i class="fa fa-facebook-official" aria-hidden="true"></i> Facebook</li>
<li><i class="fa fa-twitter" aria-hidden="true"></i> Twitter</li>
<li><i class="fa fa-instagram" aria-hidden="true"></i> Instagram</li>
<li><i class="fa fa-vine" aria-hidden="true"></i> Vine</li>
</ul>
</div>
<div>
<ul>
<li><i class="fa fa-youtube-play" aria-hidden="true"></i> YouTube</li>
<li><i class="fa fa-twitch" aria-hidden="true"></i> Twitch</li>
<li><i class="fa fa-soundcloud" aria-hidden="true"></i> SoundCloud</li>
<li><i class="fa fa-reddit-alien" aria-hidden="true"></i> Reddit</li>
</ul>
</div>
<div>
<ul>
<li><i class="fa fa-github" aria-hidden="true"></i> GitHub</li>
<li><i class="fa fa-stack-overflow" aria-hidden="true"></i> Stack Overflow</li>
<li><i class="fa fa-jsfiddle" aria-hidden="true"></i> JSFiddle</li>
</ul>
</div>
</div>
<hr>
<div>
<p>Oh, hello there. My name is Java. No, not the programming language! Well, this is awkward. Not much else to be said... uhm... enjoy your stay, I guess!</p>
<a href="http://itzjavacraft.tk">
<img src="/images/logo.png" alt="ItzJavaCraft" />
</a>
</div>
</footer>
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;
}
I'm using Twitter Bootstrap to built a layout. I'm having trouble with the positioning the dropdown in the navbar. If the .nav has pull-right, the dropdown that opens will always open to the left.
I want to be able to manually control whether it should open to the left or right. Is this possible?
<div class="navbar" id="navbar-top">
<div class="navbar-inner">
<div class="container">
<a class="logo pull-left" href="/index_dev.php/"></a>
<ul class="nav pull-right">
<li class="active"> Shots</li>
<li class="divider-vertical"></li>
<li class="dropdown">
Explore <i class="icon-caret-down"></i>
<ul class="dropdown-menu span6">
<li class="column-menu span2">
<ul>
<li><i class="icon-caret-right"></i> Dry Fly</li>
<li><i class="icon-caret-right"></i> Popper</li>
<li><i class="icon-caret-right"></i> Terrestrial</li>
<li><i class="icon-caret-right"></i> Streamer</li>
</ul>
</li>
<li class="column-menu span2">
<ul>
<li><i class="icon-caret-right"></i> Wet Fly</li>
<li><i class="icon-caret-right"></i> Nymph</li>
<li><i class="icon-caret-right"></i> Emerger</li>
<li><i class="icon-caret-right"></i> Streamer</li>
</ul>
</li>
<li class="column-menu span2">
<ul>
<li><i class="icon-caret-right"></i> Wet Fly</li>
<li><i class="icon-caret-right"></i> Nymph</li>
<li><i class="icon-caret-right"></i> Emerger</li>
</ul>
</li>
</ul>
</li>
<li class="divider-vertical"></li>
<li>Sign up</li>
<li class="divider-vertical"></li>
<li>Sign in</li>
</ul>
</div>
</div>
</div>
You just need to override Bootstrap's .dropdown-menu.pull-right styles:
.navbar .pull-right > li > .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right.dropdown-right {
right: auto;
left: -19px;
}
.navbar .pull-right > li > .dropdown-menu::before, .navbar .nav > li > .dropdown-menu.pull-right.dropdown-right::before {
right: auto;
left: 9px;
}
.navbar .pull-right > li > .dropdown-menu::after, .navbar .nav > li > .dropdown-menu.pull-right.dropdown-right::after {
right: auto;
left: 10px;
}
Use the class dropdown-right in any right-pulled menu you'd like to override.
jsFiddle