z-index not working on list elements? - html

http://jsfiddle.net/ineomod/8NeyY/embedded/result/
HTML:
<section id="diamonds">
<ul>
<li>
<div class="container">
<div class="diamondImg" style="background:url(http://i979.photobucket.com/albums/ae280/ineomod/geak_zps76747320.jpg)"></div>
<span class="diamondText">
<div class="zoomIcon"></div>
"Geak" Interactive Magazine
</span>
</div>
</li>
<li>
<div class="container">
<div class="diamondImg" style="background:url(http://i979.photobucket.com/albums/ae280/ineomod/pink_zps8d76dfad.jpg)"></div>
<span class="diamondText">
<div class="zoomIcon"></div>
"Pink" Magazine
</span>
</div>
</li>
<li>
<div class="container">
<div class="diamondImg" style="background:url(http://i979.photobucket.com/albums/ae280/ineomod/f3_zps57ac8198.jpg)"></div>
<span class="diamondText">
<div class="zoomIcon"></div>
F3 "Celebrate In Style" Ad Campaign
</span>
</div>
</li>
<li>
<div class="container">
<div class="diamondImg" style="background:url(http://i979.photobucket.com/albums/ae280/ineomod/sgx_zps3a7e98c2.jpg)"></div>
<span class="diamondText">
<div class="zoomIcon"></div>
SGX Infographic
</span>
</div>
</li>
<li>
<div class="container">
<div class="diamondImg" style="background:url(http://i979.photobucket.com/albums/ae280/ineomod/namecard_zps6a64c3f5.jpg)"></div>
<span class="diamondText">
<div class="zoomIcon"></div>
m:idea Namecards
</span>
</div>
</li>
</ul>
CSS:
In the fiddle
I have this diamond gallery laid out as a list. There's a caption for each item. Hoever, I can't seem to use z-index to ensure that the caption stays above all the other li elements? It seems to be covered only by li elements that come after it.

Try giving
#diamonds li:hover {
position: relative;
z-index: 1;
}
This will bring the only that <li> at top which is :hover
Demo

Demo
It seems that you need to update z-index on every li element from higher to lower as follows
<li style="z-index: 4;">....</li>
<li style="z-index: 3;">....</li>
<li style="z-index: 2;">....</li>
<li style="z-index: 1;">....</li>
<li style="z-index: 0;">....</li>
here style inline tag is used only for demo purpose which is calculated by using jQuery

Related

How to center the text for the toggle switch

I have a pricing plan page that I am trying to add a toggle switch to. I can't seem to figure out the proper way to vertically align the text of it: here is my fiddle
I've tried to set the margin and the padding but the Monthly and Annual are always at the top.
<div class="background">
<div class="container">
<div class="toggle-btn" style="background-color:transparent;text-align:center;position:relative;z-index:99;vertical-align:top;">
<span style="margin:0.8em;color:rgb(44, 46, 47);font-size:18px;bottom:0px;">Monthly</span>
<label class="switch" style="margin-bottom:15px;">
<input type="checkbox" id="checbox" onclick="check()" />
<span class="slider round"></span>
</label>
<span style="margin:0.8em;color:rgb(44, 46, 47);font-size:18px;bottom:0px;">Annual </span>
</div>
<div class="panel pricing-table">
<div class="pricing-plan">
<img src="https://s22.postimg.cc/8mv5gn7w1/paper-plane.png" alt="" class="pricing-img">
<h2 class="pricing-header">Personal</h2>
<ul class="pricing-features">
<li class="pricing-features-item">Custom domains</li>
<li class="pricing-features-item">Sleeps after 30 mins of inactivity</li>
</ul>
<span class="pricing-price">Free</span>
Sign up
</div>
<div class="pricing-plan">
<img src="https://s28.postimg.cc/ju5bnc3x9/plane.png" alt="" class="pricing-img">
<h2 class="pricing-header">Small team</h2>
<ul class="pricing-features">
<li class="pricing-features-item">Never sleeps</li>
<li class="pricing-features-item">Multiple workers for more powerful apps</li>
</ul>
<span class="pricing-price">$150</span>
Free trial
</div>
<div class="pricing-plan">
<img src="https://s21.postimg.cc/tpm0cge4n/space-ship.png" alt="" class="pricing-img">
<h2 class="pricing-header">Enterprise</h2>
<ul class="pricing-features">
<li class="pricing-features-item">Dedicated</li>
<li class="pricing-features-item">Simple horizontal scalability</li>
</ul>
<span class="pricing-price">$400</span>
Free trial
</div>
</div>
</div>
</div>
Remove the margin-bottom from that switch element and add display:flex;justify-content:center;align-items:center; to .toggle-btn
Here's the edited fiddle: https://jsfiddle.net/bjd3wps1/
you just had to add position: relative to the spans containing the text and than update the bottom value to bottom: -5px
here's the updated fiddle: https://jsfiddle.net/a2nwet54/

Icons will not align with the text element

I'm creating an account page (header) for the first time, and I notice that some of the icons will not align perfectly with the text. I know how simple and easy this is for advanced developers, but I'm just starting off and really need some advice.
I have tried using padding and margin as a style element but didn't work.
<header>
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-8">
<div class="row">
<div class="col-sm-3">
<img src="paylocity_logo.png" alt="logo" style="width:100%"S/></a>
</div>
<div class="col-sm-9 hidden-sm hidden-xs" id="project-details">
<a class="home-link" href="" title="Edit"> <i class="material-icons"> home </i> </a>
<div class="project">
User Profile
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-md-4 text-right" id="account">
<i class="material-icons">account_circle</i> <span>Tom Markart </span>
<div id="account-options">
<ul>
<li>
<span> <i class="material-icons">account_circle</i></span>View Profile
</li>
<li>
<span class="fa fa-cog"></span>Settings
</li>
<li>
<span class="fa fa-bug"></span>Report a Bug
</li>
<li>
<span class="fa fa-power-off"></span>Log Out
</li>
</ul>
</div>
</div>
</div>
</header>
I want to make them straight.
In your case, you can add the following rule:
.material-icons {
vertical-align: middle;
}
https://codepen.io/anon/pen/EBBbpd
Using flex:
Wrap text in <span> and a wrapper class to <a>.
...
<li>
<a class='wrapper' href="javascript:void(0);">
<span class="fa fa-cog"></span>
<span>Settings</span>
</a>
</li>
...
.wrapper {
display: flex;
align-items: center
}

Child selection

I'm having some issues to solve this problem with css selector. I need to select:
<li>
Asked to you
</li>
using nth-child selectors, but I don't have the ability to add classes. Do you have any idea how I can make this work? After I choose this element with nth-child I need to add:before pseudo selector to it.
I have this code
<div class="userAccountNavigation">
<div class="row">
<div class="large-3 small-3 column userProfileImage">
<img src="#" alt="" class="profile-image">
</div>
<div class="large-9 small-9 column">
<ul class="side-nav">
<li>
Profile
</li>
<li id="editProfile">
Edit Profile
</li>
</ul>
</div>
</div>
<div class="row">
<div class="large-12 small-6 columns">
<ul class="side-nav">
<li>
Activity Feed
</li>
<li>
Asked to you
</li>
<li class="active">
Following
</li>
</ul>
</div>
</div>
<div class="row">
<div class="large-12 small-6 columns">
<ul class="side-nav">
<li class="">
Questions
<span class="total">1</span>
</li>
<li class="">
Answers
<span class="total">0</span>
</li>
</ul>
</div>
</div>
</div>
Here is the solution to my problem. Thanks for checking anyway.
.userAccountNavigation div:nth-of-type(2) ul li:nth-child(2):before {
content: 'x';
}
In your example this should work.
.userAccountNavigation .row:nth-child(2) li:nth-child(2)::before{
content: "->";
}
https://codepen.io/Pamz/pen/wEqLgw

div when hovered gets dragged along with when page is scrolled

I am stuck at an issue and need some one to help me.
Have created a sample fiddle to explain the functionality.
When I hover over li tag the respective div is hovered. I wanted all divs of corresponding li tag to be shown at same position so have used position as fixed.
However, the issue is when the cursor is placed on hovered div and page is scrolled the hovered divs get dragged along with when scrolled which should not happen. Can someone please help me resolve this issue?
Here is the screenshot of the issue
.lidiv {
display: none;
}
.ulclass li:hover .lidiv {
display: block
}
.ulclass {
list-style: none
}
.lidiv {
position: fixed;
left: 20%;
top: 0px;
}
<div class="divoneclass">
<ul class="ulclass">
<li class="liclass">
<a class="aclass" href="javascript:void(0)">
<span class="spanclassupp">
<span class="spantitle">DOG</span>
</span>
</a>
<div class="lidiv">
<div class="lidivone">
<div class="lidivtwo">
<div class="lidivthree">
<div class="lidivfour">
<div class="diccontent">
<p>
LI ONE VALUE
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<li class="liclass">
<a class="aclass" href="javascript:void(0)">
<span class="spanclassupp">
<span class="spantitle">CAT</span>
</span>
</a>
<div class="lidiv">
<div class="lidivone">
<div class="lidivtwo">
<div class="lidivthree">
<div class="lidivfour">
<div class="diccontent">
<p>
LI TWO VALUE
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<li class="liclass">
<a class="aclass" href="javascript:void(0)">
<span class="spanclassupp">
<span class="spantitle">OTHER</span>
</span>
</a>
<div class="lidiv">
<div class="lidivone">
<div class="lidivtwo">
<div class="lidivthree">
<div class="lidivfour">
<div class="diccontent">
<p>
LI THREE VALUE
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>

In code footer goes all over the place

I have some troubles with my footer on a website. Footer is not displaying at the bottom of the page but it starts right below the header and covers elements that are under it. For better understanding I made fiddle for it and screenshot
But its like this:
<div class="mens">
<div class="main">
<div class="wrap">
<div class="section group">
<div class="cont span_2_of_3">
<h2 class="head">PRIPOROČAMO</h2>
<div class="top-box">
and then there are some products and then there are the end divs for this:
</div>
</div>
</div>
</div>
</div>
</div>
And then follows the footer:
<footer class="footer-2 bg-midnight-blue">
<div class="container">
<nav class="pull-left">
<ul>
<li class="active">
Home
</li>
<li>
Company
</li>
<li>
Portfolio
</li>
<li>
Blog
</li>
<li>
Contact
</li>
</ul>
</nav>
<div class="social-btns pull-right">
<div class="fui-vimeo"></div><div class="fui-vimeo"></div>
<div class="fui-facebook"></div><div class="fui-facebook"></div>
<div class="fui-twitter"></div><div class="fui-twitter"></div>
</div>
<div class="additional-links">
Be sure to take a look to our Terms of Use and Privacy Policy
</div>
</div>
</footer>
And I know its a lot of code but I would really appreciate if someone could look at it. Thanks.
use this to reset ur css
.clearfix:before,.clearfix:after{content: '.';display: block;overflow: hidden;visibility: hidden;font-size: 0;line-height: 0;width: 0;height: 0;clear: both;}
.clearfix {overflow: auto;zoom: 1;}
and add clearfix class in parent div where in child u have used float like in
<div class="page-wrapper clearfix">
<div class="main clearfix">
<footer class="footer-2 bg-midnight-blue clearfix">