Child selection - html

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

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/

Materialize nav bar issue

So I have this navbar made with materialize
My code is:
<nav class="light-blue lighten-1 " role="navigation">
<div class="nav-wrapper container "><a id="logo-container" href="#" class="brand-logo">Treasure Hunt</a>
<ul id="navbarUl" class="right hide-on-med-and-down">
<li class="active">Misiuni</li>
<li>NewsFeed</li>
<li>Clasament</li>
<li> </li>
<li id="navbarLi">
<div class="row">
<div class="col s6"><a id="navbarImg" href="#"><img src="img/asd.jpg" class="circle responsive-img small"/></a></div>
<div class="col s6">Adyzds</div>
</div>
</li>
<li >
<div class="row">
<div class="col s4">Level:
<span>Value</span>
</div>
<div class="col s4">XP:
<span>Value</span>
</div>
</div>
</li>
</ul>
</div>
</nav>
My mouse is over the profile pic. I would like the hover effect to cover the name too. Also, I would like the Level value to be near Level.
Can anyone help me?
CSS:
.icon-block {
padding: 0 15px;
}
.icon-block .material-icons {
font-size: inherit;
}
#navbarImg{
padding-top: 10px;
max-width: 70px;
max-height: 64px;
}
#navbarLi{
max-height: 64px;
}
Your columns are too narrow for Level: + value. Instead of creating a row with 2 columns inside, try using seperate <li> for each:
<li >
Level: <span>7</span>
</li>
<li>
XP:<span>105</span>
</li>
As for your name, just nest it in a <a> element and materialize will know what to do with it.
Check out this fiddle: https://jsfiddle.net/pwxa6e80/3/ ... hope it helps :)

How can I surround an image with two <div>s on one line?

I have two <div>s surrounding an image in same row, but when I add the image the right <div> drops below.
I've tried float, display:inline-block and even styling the HTMLtags, but it didn't help.
Please help me out.
Here's my code:
<title>Hair by Michelle</title>
<body>
<div class="all">
<div class="navbar">
<img class="pic1" src="https://scontent-lga1-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/598668_4520542180477_68371292_n.jpg?oh=024b6348716dcf01475a40d0576671e7&oe=5640E0C7" alt="Photo of Michelle>
<h1>Hair By Michelle</h1>
<ul>
<li class="home">home
</li>
<li class="about">about
</li>
<li class="availability">appointments
</li>
<li class="contact">contact
</li>
</ul>
</div>
</div>
<div class="container">
<div class="hours">
<h1>Hours</h1>
<p>Tuesday: 12pm-7pm</p>
</br>
<p>Wednesday: 12pm-7pm</p>
</br>
<p>Thursday: 10am-7pm</p>
</br>
<p>Every other Saturday: 10am-7pm</p>
</div>
<div class="services">
<h1>Services</h1>
<h4>Women's Haircut $32</h4>
</br>
<h4>Men's Haircut $22</h4>
</br>
<h4>Full head color $50</h4>
</br>
<h4>Full highlights $70</h4>
</br>
<h4>Color toning $15</h4>
</br>
<h4>Facial waxing $12</h4>
</div>
</div>
Ignore the result area, just paste it in an editor.
if you want elements to line up in the same line should add:
float:left;
position:relative;
for the HTML I would recommend each image in a div:
.imgrow {
width:100px;
height:100px;
position:relative;
float:left;
}
<div class="imgrow"><img class="imgrow" src="https://scontent-lga1-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/598668_4520542180477_68371292_n.jpg?oh=024b6348716dcf01475a40d0576671e7&oe=5640E0C7"></div>
<div class="imgrow"><img class="imgrow" src="https://scontent-lga1-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/598668_4520542180477_68371292_n.jpg?oh=024b6348716dcf01475a40d0576671e7&oe=5640E0C7"></div>
I see just one image in your code...
If you need the text to be displayed next to the image, try this-
<div class="navbar">
<div style="float:left;">
<img class="pic1" src="https://scontent-lga1-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/598668_4520542180477_68371292_n.jpg?oh=024b6348716dcf01475a40d0576671e7&oe=5640E0C7" alt="Photo of Michelle">
</div>
<div style="float:right;">
<h1>Hair By Michelle</h1>
<ul>
<li class="home">home
</li>
<li class="about">about
</li>
<li class="availability">appointments
</li>
<li class="contact">contact
</li>
</ul>
</div>
</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">

z-index not working on list elements?

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