Placing relative positioned elements in floating DIV - html

I have been trying to make a profile bar for my website which contained 3 elements, link, picture, and just a text (<p>), profile bar itself was a div container.
The reason of choosing relative position was because of elements overlapping when browser was scaled, but then there was another problem, when browser was scaled, container content would start disappearing and then image would wrap to the bottom of elements.
HTML & CSS for profile bar container:
<div class="profilebar">
<a class="profilename" style="cursor: pointer;" >{{ username }} &blacktriangledown;</a>
<img class="profilepicture" src="{{ avatar }}"></img>
<p class="balance" style="text-decoration:none">${{ balance }}</p>
</div>
.profilename {
position: relative;
margin-top: 0.4%;
margin-left: 4%;
font-family: sans-serif;
width: 0.5%;
font-size: 11pt;
color: white;
text-decoration: none;
}
.profilepicture {
position: absolute;
margin-left: 1.4%;
}
.balance {
position: relative;
margin-top: 3%;
color: red;
font-family: sans-serif;
font-size: 12pt;
color: #C90205;
margin-left: 45.3%;
}
Fiddle ( Try scaling browser down in fullscreen mode and you'll see the result ).
Is there a problem that container can't make elements float right?, i want it to reach the navigator buttons (Button1-4) without elements inside overlapping each other, what's the best way to do so?

Set a fixed pixel width on the "profilebar" container, rather than a percentage.
.profilebar {
float: right;
width: 150px;
height: 7%;
margin-top: 0.5%;
margin-right: 1%;
min-width: 70px;
}
Here you can see an example with 150px width:
https://jsfiddle.net/c7qoh9xg/

float: left; causes links to wrap and are there below the menu
See https://jsfiddle.net/hv5r8kxh/4/

Check the updated fiddle - https://jsfiddle.net/afelixj/hv5r8kxh/2/
Changed the order of profilepicture and profilename
*,
*::before,
*::after {
box-sizing: border-box;
}
*::selection {
background-color: #F06262;
}
*::-moz-selection {
background-color: #F06262;
}
html,
body {
margin: 0;
height: 100%;
background-color: #2B2B2B;
}
.main {
position: relative;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 10%;
z-index: 1;
min-height: 120px;
max-height: 120px;
background-color: rgba(26, 26, 26, 0.9);
min-width: 800px;
}
.logo {
display: block;
float: left;
top: 3%;
left: 0;
right: 3%;
/*background-image: url('images/logo.png');
width: 150px;
height: 155px;*/
font-size: 32pt;
font-family: sans-serif;
color: white;
margin-top: 3.5%;
margin-left: 1.3%;
}
.menu {
display: inline-block;
position: relative;
top: 0;
left: 0;
right: 0;
background-color: rgba(26, 26, 26, 0.9);
width: 100%;
border-style: solid;
border-color: rgba(26, 26, 26, 0.9);
border-radius: 0;
z-index: 1;
/* max-height: 8%; */
/* max-width: 102.5%; */
min-height: 55px;
min-width: 800px;
overflow: hidden;
}
.button1 {
display: block;
font-size: 10pt;
float: left;
right: 15%;
left: 30%;
top: 0%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
padding: 25px 2px 55px 2px;
vertical-align: center;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button1:hover {
color: #C90205;
}
.button2 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 10%;
white-space: nowrap;
color: white;
width: 7%;
margin-top: 0%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
vertical-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button2:hover {
color: #C90205;
}
.button3 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button3:hover {
color: #C90205;
}
.button4 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button4:hover {
color: #C90205;
}
.button5 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 3%;
white-space: nowrap;
color: white;
margin-top: 0%;
width: 7%;
font-family: sans-serif;
height: 3%;
text-align: center;
padding: 25px 0px 55px 0px;
text-align: center;
line-height: 6px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button5:hover {
color: #C90205;
}
.button6 {
font-size: 10pt;
float: left;
right: 10%;
left: 23%;
top: 8%;
white-space: nowrap;
color: white;
margin-top: 0%;
font-family: sans-serif;
height: 10%;
width: 7%;
text-align: center;
height: 10%;
text-align: center;
padding: 28px 0px 55px 0px;
text-align: center;
line-height: 2px;
border-right: 1px solid rgba(0, 0, 0, 0.25);
border-left: 1px solid rgba(0, 0, 0, 0.25);
box-shadow: 1px 0 rgba(255, 255, 255, 0.03);
border-radius: 5px;
min-width: 100px;
transition: 0.1s ease-in;
}
.button6:hover {
color: #C90205;
}
.profilebar {
float: right;
width: 11%;
height: 7%;
margin-top: 0.5%;
margin-right: 1%;
min-width: 180px;
}
.profilename {
position: relative;
margin-top: 0.4%;
margin-left: 4%;
font-family: sans-serif;
/* width: 0.5%; */
font-size: 11pt;
color: white;
text-decoration: none;
float: right;
}
.profilepicture {
/* position: absolute; */
margin-left: 15px;
float: right;
}
.balance {
position: relative;
margin-top: 25px;
color: red;
font-family: sans-serif;
font-size: 12pt;
color: #C90205;
text-align: right;
/* margin-left: 45.3%; */
}
.mainpage {
position: relative;
height: calc(93% - 185px);
width: 100%;
min-height: 430px;
min-width: 800px;
}
<div class="main">
<a class="logo" href="/" style="text-decoration:none">Sample Text</a>
</div>
<div class="menu">
<a class="button1" href="/" style="text-decoration:none">Button 1</a>
<a class="button2" href="/" style="text-decoration:none">Button 2</a>
<a class="button3" href="/" style="text-decoration:none">Button 3</a>
<a class="button4" href="/" style="text-decoration:none">Button 4</a>
<a class="button5" href="/" style="text-decoration:none">Button 5</a>
<a class="button6" href="/" style="text-decoration:none">Button 6</a>
<div class="profilebar">
<img class="profilepicture" src="http://i.imgur.com/9xyQ4DW.png" />
<a class="profilename" style="cursor: pointer;" >username &blacktriangledown;</a>
<p class="balance" style="text-decoration:none">$0</p>
</div>
</div>
<div class="mainpage"></div>

Related

Why I can't see this image when I set position to relative? [duplicate]

This question already has answers here:
Percentage Height HTML 5/CSS
(7 answers)
Closed 2 years ago.
I've been playing around with z-index to create kind of a crystal effect as you can see, thing is that, If I want the background of the header to be visible I need to set his position to absolute but I don't know why. That background image is relative to the .center_form--header class and since I used z-index it should get all the back space to display doesn't it?
Anyone knows what's happening or can tell me how is this supposed to work?
form {
position: relative;
margin: 0%;
padding: 0%;
position: relative;
width: 100%;
height: auto;
display: inline-block;
background: #f4f7f8;
border-radius: 0 0 20px 20px;
}
.center_form {
position: relative;
width: 50%;
display: inline-block;
height: auto;
text-align: center;
border-radius: 20px 20px 20px 20px;
-moz-box-shadow: 1px 1px 15px 1px black;
-webkit-box-shadow: 1px 1px 15px 1px black;
box-shadow: 1px 1px 15px 1px black;
}
.center_form--header {
position: relative;
border-radius: 20px 20px 0 0;
height: auto;
z-index: 5;
}
#formtitlebg {
position: absolute;
width: 100%;
height: 100%;
background-image: url(https://i.postimg.cc/bw0JjXgn/8-bit-game-wallpaper-42148.jpg);
background-repeat: no-repeat;
background-position: center;
border-radius: 20px 20px 0 0;
filter: blur(2px);
-webkit-filter: blur(2px);
z-index: -5;
}
#formtitle {
position: relative;
display: inline-block;
width: 100%;
margin: 0;
padding-top: 2%;
padding-bottom: 2%;
border-radius: 20px 20px 0 0;
text-transform: uppercase;
font-family: 'Press Start 2P', cursive;
font-size: 15px;
text-align: center;
color: white;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4);
}
.center_form--elements input[type="text"] {
position: relative;
width: 90%;
height: 10%;
margin-top: 2%;
margin-left: 3%;
display: block;
border: none;
outline: none;
border-bottom: 1px solid #ddd;
background: #f4f7f8;
font-size: 18px;
margin-right: auto;
}
.center_form--elements input[type="submit"] {
position: relative;
margin-top: 3%;
margin-bottom: 3%;
-moz-box-shadow: 1px 1px 15px 1px black;
-webkit-box-shadow: 1px 1px 15px 1px black;
box-shadow: 1px 1px 15px 1px black;
background-color: #1A1D1E;
border: 1px solid #1A1D1E;
display: inline-block;
cursor: pointer;
color: #FFFFFF;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 14px;
padding: 1% 5%;
text-decoration: none;
text-transform: uppercase;
}
<div class="center_form">
<div class="center_form--header">
<div id="formtitlebg"></div>
<h2 id="formtitle">Press start!</h2>
</div>
<form>
<div class="center_form--elements">
<input placeholder="Name" type="text">
<input placeholder="Email" type="text">
<input type="submit" value="START">
</div>
</form>
</div>
You need to move background to the header instead of cropping it. Besides for header background you can use :before pseudo class. In my example you can see that I removed position absolute from your css, and code became clean:
Try like this:
form {
position: relative;
margin: 0%;
padding: 0%;
position: relative;
width: 100%;
height: auto;
display: inline-block;
background: #f4f7f8;
border-radius: 0 0 20px 20px;
}
.center_form {
position: relative;
width: 50%;
display: inline-block;
height: auto;
text-align: center;
border-radius: 20px 20px 20px 20px;
-moz-box-shadow: 1px 1px 15px 1px black;
-webkit-box-shadow: 1px 1px 15px 1px black;
box-shadow: 1px 1px 15px 1px black;
}
.center_form--header {
position: relative;
border-radius: 20px 20px 0 0;
height: auto;
text-align: center;
color: white;
padding-bottom: 2%;
padding-top: 2%;
border-radius: 20px 20px 0 0;
}
.center_form--header:before{
content:'';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url(https://i.postimg.cc/bw0JjXgn/8-bit-game-wallpaper-42148.jpg);
background-color: rgba(0, 0, 0, 0.4);
background-repeat: no-repeat;
background-position: center;
border-radius: 20px 20px 0 0;
filter: blur(2px);
-webkit-filter: blur(2px);
}
#formtitle {
position: relative;
display: inline-block;
width: 100%;
margin: 0;
font-size: 15px;
text-transform: uppercase;
font-family: 'Press Start 2P', cursive;
}
.center_form--elements input[type="text"] {
position: relative;
width: 90%;
height: 10%;
margin-top: 2%;
margin-left: 3%;
display: block;
border: none;
outline: none;
border-bottom: 1px solid #ddd;
background: #f4f7f8;
font-size: 18px;
margin-right: auto;
}
.center_form--elements input[type="submit"] {
position: relative;
margin-top: 3%;
margin-bottom: 3%;
-moz-box-shadow: 1px 1px 15px 1px black;
-webkit-box-shadow: 1px 1px 15px 1px black;
box-shadow: 1px 1px 15px 1px black;
background-color: #1A1D1E;
border: 1px solid #1A1D1E;
display: inline-block;
cursor: pointer;
color: #FFFFFF;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 14px;
padding: 1% 5%;
text-decoration: none;
text-transform: uppercase;
}
<div class="center_form">
<div class="center_form--header">
<h2 id="formtitle">Press start!</h2>
</div>
<form>
<div class="center_form--elements">
<input placeholder="Name" type="text">
<input placeholder="Email" type="text">
<input type="submit" value="START">
</div>
</form>
</div>

Place button next to inline-block div

I am trying to place a button next to an inline-block div with a fixed width. But it goes right under the div. I have tried reducing the width of the container this doesn't work. I'd like to accomplish this without the button of class add being in a separate container. The button should be beside the .input-wrap div
Here's the code:
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
color: rgb(149, 152, 154);
}
.input-block {
margin-bottom: 40px;
}
.input-block>* {
margin-bottom: 20px;
}
.description {
display: block;
font-size: 20px;
}
.radio-container {
display: inline;
margin-right: 30px;
}
.radio-container>input {
margin-right: 10px;
}
[type="radio"]:checked,
[type="radio"]:not(:checked) {
position: absolute;
left: -99999px;
}
[type="radio"]:checked+label,
[type="radio"]:not(:checked)+label {
position: relative;
padding-left: 28px;
cursor: pointer;
line-height: 20px;
display: inline-block;
color: rgb(149, 152, 154);
}
[type="radio"]:checked+label::before,
[type="radio"]:not(:checked)+label::before {
content: "";
position: absolute;
left: 0px;
top: 0px;
width: 18px;
height: 18px;
border: 1px solid rgb(149, 152, 154);
border-radius: 100%;
background: transparent;
}
[type="radio"]:checked+label::after,
[type="radio"]:not(:checked)+label::after {
content: "";
width: 10.6px;
height: 10px;
position: absolute;
top: 5px;
left: 4.5px;
border-radius: 100%;
transition: all 0.2s ease;
background: rgb(149, 152, 154);
}
[type="radio"]:not(:checked)+label::after {
opacity: 0;
transform: scale(0);
}
[type="radio"]:checked+label::after {
opacity: 1;
transform: scale(1);
}
.round-process {
width: 100%;
height: 40px;
border-radius: 15px;
border: 1px solid rgb(149, 152, 154);
text-align: left;
color: darkgray;
font-size: 20px;
outline: none;
padding-left: 15px;
text-transform: capitalize;
background: none;
}
input[type="number"] {}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
.input-wrap {
position: relative;
width: 200px;
/* text-align: center;*/
display: inline-block;
}
div.vertical-line {
width: 1px;
height: 40px;
position: absolute;
top: 0px;
left: 150px;
background-color: rgb(149, 152, 154);
}
.text-container {
/* width: 200px;*/
}
.mb {
font-weight: 800;
color: rgb(149, 152, 154);
position: relative;
top: 11.5px;
left: 10px;
}
.add {
border-radius: 50%;
border: none;
width: 20px;
height: 20px;
text-align: center;
color: black;
box-shadow: rgba(0, 0, 0, 0.117647) 0px 5px 30px, rgba(0, 0, 0, 0.2) 0px 1px 10px;
background-color: white;
}
.add:active {
box-shadow: rgba(0, 0, 0, 0.117647) 0px 5px 30px, rgba(0, 0, 0, 0.239216) 0px 0px 0px;
}
.add:focus {
outline: 0px;
}
<html>
<body>
<div class="main">
<div class="input-block">
<div class="description">Total Memory</div>
<div class="text-container">
<div class="input-wrap">
<input class="round-process" maxlength="5" type="number">
<div class="vertical-line" />
<span class="mb">MB</span>
</div>
<button class="add">×</button>
</div>
</div>
</div>
</body>
</html>
You have missing closing tags in your html. When you close those tags the button will align on the right-bottom corner of your div. It worked for me when I closed the divs like this,
<body>
<div class="main">
<div class="input-block">
<div class="description">Total Memory</div>
<div class="text-container">
<div class="input-wrap">
<input class="round-process" maxlength="5" type="number">
<div class="vertical-line" ></div>
<span class="mb">MB</span>
</div>
<button class="add">×</button>
</div>
</div>
</div>
</body>
Hope this helps.
Okay i was able to solve this by removing .text-container . Then i moved the input-wrap width property to .round-process
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
color: rgb(149, 152, 154);
}
.input-block {
margin-bottom: 40px;
}
.input-block > * {
margin-bottom: 20px;
}
.description {
display: block;
font-size: 20px;
}
.radio-container {
display: inline;
margin-right: 30px;
}
.radio-container > input {
margin-right: 10px;
}
[type="radio"]:checked,
[type="radio"]:not(:checked) {
position: absolute;
left: -99999px;
}
[type="radio"]:checked + label,
[type="radio"]:not(:checked) + label {
position: relative;
padding-left: 28px;
cursor: pointer;
line-height: 20px;
display: inline-block;
color: rgb(149, 152, 154);
}
[type="radio"]:checked + label::before,
[type="radio"]:not(:checked) + label::before {
content: "";
position: absolute;
left: 0px;
top: 0px;
width: 18px;
height: 18px;
border: 1px solid rgb(149, 152, 154);
border-radius: 100%;
background: transparent;
}
[type="radio"]:checked + label::after,
[type="radio"]:not(:checked) + label::after {
content: "";
width: 10.6px;
height: 10px;
position: absolute;
top: 5px;
left: 4.5px;
border-radius: 100%;
transition: all 0.2s ease;
background: rgb(149, 152, 154);
}
[type="radio"]:not(:checked) + label::after {
opacity: 0;
transform: scale(0);
}
[type="radio"]:checked + label::after {
opacity: 1;
transform: scale(1);
}
.round-process {
width: 200px;
height: 40px;
border-radius: 15px;
border: 1px solid rgb(149, 152, 154);
text-align: left;
color: darkgray;
font-size: 20px;
outline: none;
padding-left: 15px;
text-transform: capitalize;
background: none;
}
input[type="number"] {}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
.input-wrap {
position: relative;
/* width: 200px;*/
/* text-align: center;*/
display: inline-block;
}
.vertical-line {
width: 1px;
height: 40px;
position: absolute;
top: 0px;
left: 150px;
background-color: rgb(149, 152, 154);
}
.mb {
font-weight: 800;
color: rgb(149, 152, 154);
position: relative;
top: 11.5px;
left: 10px;
}
.add {
border-radius: 50%;
border: none;
width: 30px;
height: 30px;
text-align: center;
color: #57C48E;
box-shadow: rgba(0, 0, 0, 0.117647) 0px 5px 30px, rgba(0, 0, 0, 0.2) 0px 1px 10px;
background-color: white;
vertical-align: top;
margin-top: 5px;
margin-left: 20px;
}
<div class="main">
<div class="input-block">
<div class="description">Total Memory</div>
<div class="input-wrap">
<input class="round-process" maxlength="5" type="number">
<div class="vertical-line" />
<span class="mb">MB</span>
</div>
<button class="add">✚</button>
<button class="add disabled">✚</button>
</div>
</div>

Add circle around a div

I have this div that looks like a big square but I would like to add a little circle on the top of the div (keeping the style) with an icon inside (I mean something like Font Awesome) so people will know what category of content it is.
How can I do that using css ?
Thank you
.le_quiz {
position: relative;
width: 350px;
background-color: white;
height: 400px;
margin-top: 45px;
border-bottom: 1px solid lightgrey;
box-shadow: 0px 2px #40c8d6;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.01), 0 2px 5px 0 rgba(0, 0, 0, 0.19);
}
.le_quiz .post-title {
position: absolute;
top: 60%;
left: 2%;
font-size: 22px;
color: #404040;
}
.le_quiz .postbody {
margin-top: 40px;
font-size: 22px;
}
.le_quiz .postbody a:visited {
margin-top: 40px;
font-size: 22px;
color:#404040;
}
.le_quiz .cta {
position: absolute;
top: 90%;
left: 15px;
font-weight: bold;
font-size: 14px;
color:#38C8D6;
}
.le_quiz .cta:visited {
color:#38C8D6;
}
<div class="le_quiz">
</div>
This is what I'd like : Circle
You could use 2 pseudo elements. One to put the circle up top, and the other to cover the bottom half of the circle.
.le_quiz {
position: relative;
width: 350px;
background-color: white;
height: 400px;
margin-top: 60px;
border-bottom: 1px solid lightgrey;
box-shadow: 0px 2px #40c8d6;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.01), 0 2px 5px 0 rgba(0, 0, 0, 0.19);
}
.le_quiz .post-title {
position: absolute;
top: 60%;
left: 2%;
font-size: 22px;
color: #404040;
}
.le_quiz .postbody {
margin-top: 40px;
font-size: 22px;
}
.le_quiz .postbody a:visited {
margin-top: 40px;
font-size: 22px;
color:#404040;
}
.le_quiz .cta {
position: absolute;
top: 90%;
left: 15px;
font-weight: bold;
font-size: 14px;
color:#38C8D6;
}
.le_quiz .cta:visited {
color:#38C8D6;
}
.le_quiz:before, .le_quiz:after {
content: '';
position: absolute;
background: #fff;
top: 0;
}
.le_quiz:before {
left: 0;
right: 0;
height: 60px;
z-index: 2;
}
.le_quiz:after {
left: 50%;
transform: translate(-50%,-50%);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.01), 0 2px 5px 0 rgba(0, 0, 0, 0.19);
z-index: 1;
width: 100px;
height: 100px;
border-radius: 50%;
}
<div class="le_quiz">
</div>
You can add another div and set boder-radius to 50% to make it a circle.
.le_quiz, .circle {
position: relative;
width: 350px;
background-color: white;
height: 400px;
margin-top: 45px;
border-bottom: 1px solid lightgrey;
box-shadow: 0px 2px #40c8d6;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.01), 0 2px 5px 0 rgba(0, 0, 0, 0.19);
}
.le_quiz .post-title {
position: absolute;
top: 60%;
left: 2%;
font-size: 22px;
color: #404040;
}
.le_quiz .postbody {
margin-top: 40px;
font-size: 22px;
}
.le_quiz .postbody a:visited {
margin-top: 40px;
font-size: 22px;
color:#404040;
}
.le_quiz .cta {
position: absolute;
top: 90%;
left: 15px;
font-weight: bold;
font-size: 14px;
color:#38C8D6;
}
.le_quiz .cta:visited {
color:#38C8D6;
}
.circle {
width:100px;
height:100px;
border-radius:50%;
top: 100px;
left: 120px;
}
<div class="circle"></div>
<div class="le_quiz">
</div>

Div is coverd by another and z-index does not work

I'm using Easy-UI layout, the blue part is the "north" layout to show nav, and down that is the layout part of "center".
But the pulldown div is coverd by "center" layout panel when mouse move-on.
I set z-index into pulldown div, but it doesn't work. How can I fix is?
.hd-main .has-pulldown {
cursor: pointer;
position: relative;
*z-index: 10000
}
.hd-main .pulldown {
position: absolute;
cursor: default;
display: none;
top: 30px;
left: 0
}
.hd-main .pulldown .arrow {
*margin-bottom: -1px;
_margin-bottom: 0;
height: 0;
width: 0;
font-size: 0;
line-height: 0;
border-width: 7px;
border-style: solid;
border-color: transparent transparent #F6F6F9 transparent;
_filter: chroma(color=tomato);
_border-color: tomato tomato #F6F6F9 tomato;
position: relative;
display: block;
left: 20px;
z-index: 2
}
.hd-main .pulldown .content {
background: #F6F6F9;
color: #333;
text-align: left;
border-radius: 3px;
border: rgb(175, 175, 175) 1px solid;
border-width: 0 1px 1px 1px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
position: relative;
z-index: 1
}
.hd-main .pulldown-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
filter: alpha(opacity=0)
}
.hd-main .navs .def-nav,
.hd-main .navs .pulldown-nav,
.hd-main .navs .separate {
display: block;
float: left;
height: 48px;
font: 18px/30px"Microsoft YaHei", "Microsoft JhengHei";
color: #d8d8d8;
text-align: center;
width: 90px;
line-height: 48px
}
.hd-main .navs .pulldown-nav {
position: relative
}
.hd-main .navs .pulldown-nav em {
position: absolute;
display: block;
left: 69px;
top: 18px;
height: 12px;
width: 12px;
font-size: 0;
background-position: -89px -45px
}
.hd-main .navs .pulldown-nav:hover .f-icon,
.hd-main .navs .pulldown-nav:active .f-icon {
position: absolute;
display: block;
right: 11px;
top: 18px;
height: 12px;
width: 12px;
font-size: 0;
background-position: -89px -55px
}
<ul>
<li class="info-i user-name has-pulldown">
<em class="f-icon pull-arrow"></em>
<span class="name top-username">David</span>
<div class="pulldown user-info">
<em class="arrow"></em>
<div class="content">
<span class="li">aa</span>
<span class="li">bb</span>
<span class="li">cc</span>
<span class="li">dd</span>
<span class="separate-li no-height"></span>
<span class="li">Log Out</span>
</div>
</div>
</li>
</ul>

CSS :hover not working after applying both :before and :after on the same element

:hover not working after applying :before and :after.
I'm checking on Chrome.
Here's my code :
<style>
* {
margin: 0px;
padding: 0px;
box-shadow: none;
}
body {
background: black;
}
#demoBoard {
position: relative;
margin: 7px auto;
width: 630px;
height: 650px;
background-color: grey;
background-image: radial-gradient(152px at 324px 50%, black, grey 99%);
opacity: 0.9;
border-radius: 10%;
}
#demoBoard h2 {
position: absolute;
color: rgb(243, 100, 20);
text-align: center;
text-shadow: 2px 2px 2px black;
top: 3px;
left: 290px;
-webkit-user-select: none;
}
#Gboard {
position: absolute;
width: 580px;
height: 580px;
background: rgba(0, 0, 0, 0.8);
position: absolute;
border: 5px solid crimson;
box-shadow: 3px 3px 4px black;
top: 34px;
left: 18px;
}
#demoBoard:before {
position: absolute;
content: "";
width: 628px;
height: 648px;
border-left: 1px solid rgb(41, 41, 51);
border-right: 1px solid rgb(41, 41, 51);
border-radius: 10%;
box-shadow: inset 10px 10px 30px black;
left: -1px;
}
#demoBoard:after {
position: absolute;
left: -1px;
top: -2px;
content: "";
width: 631px;
height: 651px;
border-bottom: 1px solid rgb(41, 41, 51);
border-top: 1px solid rgb(41, 41, 51);
border-radius: 10%;
box-shadow: inset -10px -10px 30px black;
}
#Gboard:hover {
cursor: pointer;
}
#Gboard:active {
box-shadow: 1px 1px 2px black;
cursor: pointer;
}
#options {
position: absolute;
top: 200px;
left: 180px;
color: crimson;
font: 20px bold;
background: rgba(123, 123, 123, 0.4);
border-radius: 10%;
width: 250px;
height: 300px;
}
#options:before {
content: "";
position: absolute;
box-shadow: inset 14px 14px 35px black;
border-radius: 10%;
width: 250px;
height: 300px;
}
#options:after {
content: "";
top: 2px;
position: absolute;
box-shadow: inset 0px -14px 35px black;
border-radius: 10%;
width: 250px;
height: 300px;
}
#options p {
position: absolute;
top: 12px;
left: 210px;
color: crimson;
font-size: 30px;
text-shadow: 0px 1px 1px black;
}
#options p:hover {
cursor: pointer;
}
#options ul {
list-style: none;
padding-top: 50px;
padding-left: 50px;
display: block;
}
#options ul li {
padding-bottom: 2px;
text-align: center;
border-bottom: 1px solid black;
width: 150px;
height: 30px;
text-align-last: right;
line-height: 2;
text-shadow: 0px 1px 1px black;
}
#options ul li:before {
position: absolute;
content: "";
left: 50px;
padding-bottom: 2px;
text-align: center;
border-bottom: 1px solid rgba(134, 94, 14, 0.5);
width: 150px;
height: 31px;
}
#options ul li:hover {
cursor: pointer;
padding-bottom: 5px;
font-size: 22px;
}
#options ul li:hover:before {
position: absolute;
content: "";
left: 50px;
padding-bottom: 2px;
text-align: center;
border-bottom: 1px solid green;
width: 150px;
height: 31px;
}
</style>
<div id="demoBoard">
<h2>Demo</h2>
<div id="Gboard"></div>
<div id="options" class="menu">
<p id="close">x</p>
<ul>
<li>Demo</li>
<li>Demo</li>
<li>Demo</li>
<li>Demo</li>
<li>Demo</li>
<li>Test</li>
</ul>
</div>
</div>
:hover is not working on all the elements that is applying hover.
I don't know what's going on with this code. It's working on some other test I've done.
That's because the content created by :after and :before on #demoBoard and #content is placed on top on your links, so you can't hover over them.
Add this to change the z-index of your links, essentially putting them on top of the other pseudo content.
#options ul li {
position: relative;
z-index: 2;
}
Note: if you do this, also change the left value of #options ul li:before and #options ul li:hover:before to "0", since it will now position itself relative to the list-item.
I gave the <ul> the following styles:
position: relative;
z-index: 1;
And it is working fine. A lot of the elements are positioned absolutely but the order of them is not defined.