I've used some html/scss to build a dropdown/select menu (I need to have full control of how the dropdown menu looks like).
The problem is that:
IE 11 opens the dropdown only when I click the down arrow instead the
whole text
in Safari 10.1.1 the dropdown doesn't hide after
clicking the menu "button" entry
Any help would be quite welcome (answering why it behaves like that would be awesome)
.onclick-menu {
position: relative;
display: inline-block;
padding: 0px;
margin: 0px 0px 1em 0px;
outline-width: 0px;
}
.onclick-menu:focus {
pointer-events: none;
}
.onclick-menu::before {
padding: 5px 10px 5px 10px;
background-color: black;
}
.onclick-menu__date-box {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 42px;
padding: 5px 10px 0px 10px;
border: 1px solid #d2d6d9;
position: relative;
min-width: 160px;
background-color: white;
border-radius: 5px;
}
.onclick-menu__date-box::after {
content: "";
transform: none;
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiB3aWR0aD0iNDgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE0LjgzIDE2LjQybDkuMTcgOS4xNyA5LjE3LTkuMTcgMi44MyAyLjgzLTEyIDEyLTEyLTEyeiIvPjxwYXRoIGQ9Ik0wLS43NWg0OHY0OGgtNDh6IiBmaWxsPSJub25lIi8+PC9zdmc+");
background-size: cover;
display: inline-block;
position: relative;
right: -90%;
bottom: 33%;
z-index: 100;
min-width: 15px;
width: 15px;
max-width: 15px;
min-height: 11px;
height: 11px;
max-height: 11px;
}
.onclick-menu__label {
font-size: 14px;
line-height: 14px;
margin-bottom: 3px;
}
.onclick-menu-header {
color: #073590;
font-weight: bold;
}
.onclick-menu:focus .onclick-menu-content {
opacity: 1;
visibility: visible;
border: 1px solid #e5e7e8;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.12) 8px 8px 6px 0px;
width: -webkit-fill-available;
}
.onclick-menu-content {
pointer-events: auto;
position: absolute;
top: 38px;
left: -1px;
z-index: 1;
opacity: 0;
visibility: hidden;
transition-duration: 0.5s;
transition-property: visibility;
background-color: black;
width: auto;
border: 5px solid 1px black;
margin-top: 19px;
margin-left: 0px;
padding: 5px 15px 5px 5px;
}
.onclick-menu-content::after {
top: -9px;
border: 10px solid white;
}
.onclick-menu-content::before {
top: -10px;
border-bottom-width: 10px solid #e5e7e8;
}
.onclick-menu__date-selector {
border-style: none;
width: 100%;
z-index: 1000;
min-height: 16px;
-webkit-appearance: none;
background-color: white;
color: #073590;
font-size: 16px;
font-weight: bold;
outline-style: none;
}
.onclick-menu-content li {
list-style-type: none;
white-space: nowrap;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
outline-width: 0px;
cursor: pointer;
padding: 5px 0px 5px 8px;
}
.onclick-menu-content li:hover {
background-color: #e8f4fd;
border-radius: 2px;
border-color: white;
}
button,
input,
select,
textarea {
font-family: inherit;
font-size: 100%;
margin: 0px;
}
button,
input {
line-height: normal;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"] {
-webkit-appearance: button;
cursor: pointer;
}
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
.onclick-menu-content button {
letter-spacing: 0.03em;
font-weight: bold;
display: block;
width: 100%;
background-color: transparent;
border-style: none;
color: inherit;
cursor: pointer;
outline-width: 0px;
text-align: left;
}
<div tabindex="0" class="onclick-menu__date-box onclick-menu">
<label for="date-select" class="onclick-menu__label">
Take your pick
</label>
<span class="onclick-menu-header">
foo1
</span>
<ul id="date-select" class="onclick-menu-content onclick-menu__date-selector">
<li value="foo1">
<button value="foo1">
foo1
</button>
</li>
<li value="foo2">
<button value="foo2">
foo2
</button>
</li>
<li value="foo3">
<button value="foo3">
foo3
</button>
</li>
</ul>
</div>
Related
I have a select with reset style and trying to create additional button and dropdown arrow icon inside using ::after selector and content. And now I'm trying to style the select in case of disabled applied on it. For the button case, I change the style by using select:disabled + button.resetDropdownButton::after. However, I still can't find the way to re-style the arrow icon when select is disabled. Anyone know how to do it?
select, option {
-webkit-appearance: none;
}
button.resetDropdownButton::after {
content: "\2716";
}
.filterWrapper {
/* flex: 1;*/
margin: 0 1rem 1rem;
position: relative;
}
.filterWrapper label {
display: block;
margin-bottom: .25rem;
}
.filterItem {
position: relative;
}
.filterItem::after {
/*add arrow down from fa-icon*/
content: '\f107';
font: normal normal normal 12px/1 FontAwesome;
color: black;
right: 8px;
top: -2px;
height: 26px;
padding: 15px 0px 0px 8px;
position: absolute;
pointer-events: none;
}
.filterItem select {
width: 100%;
/*padding: 0.5rem 1rem;*/
padding-right: 2rem;
padding-left: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
font-size: 1rem;
border-radius: 6px;
border: 2px solid #CBD2E0;
transition: .2s all;
cursor: pointer;
}
.filterItem select::-webkit-input-placeholder {
color: var(--grey);
}
.filterItem select:focus {
outline: none;
background-color: rgba(214, 238, 247, 0.5);
border: 1px solid var(--blue);
box-shadow: 0 0 3px var(--blue);
}
.filterItem select > option {
border-radius: 10px;
}
.filterWrapper .resetDropdownButton {
position: absolute;
top: auto;
right: 1.15rem;
bottom: .5rem;
background-color: transparent;
font-family: 'Roboto', sans-serif;
font-size: 1rem;
/* font-weight: bold;*/
border: 0 solid transparent;
cursor: pointer;
}
.filterWrapper .resetDropdownButton:hover {
text-decoration: underline;
}
select:disabled + button.resetDropdownButton::after {
color: gray;
opacity: 0.7;
}
select:disabled + button.resetDropdownButton:hover {
text-decoration: none;
}
select:disabled + filterItem::after {
/*add arrow down from fa-icon*/
color: yellow;
opacity: 0.7;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" rel="stylesheet" />
<div class="filterWrapper">
<div class="filterItem">
<select disabled>
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<button class="resetDropdownButton"></button>
</div>
</div>
I expect the arrow icon that I create using ::after on the div wrapper can be restyle like the button one when select disabled.
Keeping the same HTML structure
This can be achieved with .filterItem:has(select:disabled)::after. But selector :has() is not well supported so far. You can read more.
select,
option {
-webkit-appearance: none;
}
button.resetDropdownButton::after {
content: "\2716";
}
.filterWrapper {
/* flex: 1;*/
margin: 0 1rem 1rem;
position: relative;
}
.filterWrapper label {
display: block;
margin-bottom: .25rem;
}
.filterItem {
position: relative;
}
.filterItem::after {
/*add arrow down from fa-icon*/
content: '\f107';
font: normal normal normal 12px/1 FontAwesome;
color: black;
right: 8px;
top: -2px;
height: 26px;
padding: 15px 0px 0px 8px;
position: absolute;
pointer-events: none;
}
.filterItem select {
width: 100%;
/*padding: 0.5rem 1rem;*/
padding-right: 2rem;
padding-left: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
font-size: 1rem;
border-radius: 6px;
border: 2px solid #CBD2E0;
transition: .2s all;
cursor: pointer;
}
.filterItem select::-webkit-input-placeholder {
color: var(--grey);
}
.filterItem select:focus {
outline: none;
background-color: rgba(214, 238, 247, 0.5);
border: 1px solid var(--blue);
box-shadow: 0 0 3px var(--blue);
}
.filterItem select>option {
border-radius: 10px;
}
.filterWrapper .resetDropdownButton {
position: absolute;
top: auto;
right: 1.15rem;
bottom: .5rem;
background-color: transparent;
font-family: 'Roboto', sans-serif;
font-size: 1rem;
/* font-weight: bold;*/
border: 0 solid transparent;
cursor: pointer;
}
.filterWrapper .resetDropdownButton:hover {
text-decoration: underline;
}
select:disabled+button.resetDropdownButton::after {
color: gray;
opacity: 0.7;
}
select:disabled+button.resetDropdownButton:hover {
text-decoration: none;
}
.filterItem:has(select:disabled)::after {
/*add arrow down from fa-icon*/
color: gray;
opacity: 0.7;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" rel="stylesheet" />
<div class="filterWrapper">
<div class="filterItem">
<select disabled>
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<button class="resetDropdownButton"></button>
</div>
</div>
Change HTML structure
You can change the HTML structure and include the arrow inside your .filterItem and after the select, while also applying some CSS to make it look good.
This is better and more supported so far.
Something like this:
select,
option {
-webkit-appearance: none;
}
button.resetDropdownButton::after {
content: "\2716";
}
.filterWrapper {
/* flex: 1;*/
margin: 0 1rem 1rem;
position: relative;
}
.filterWrapper label {
display: block;
margin-bottom: .25rem;
}
.filterItem {
position: relative;
}
.filterItem select {
width: 100%;
/*padding: 0.5rem 1rem;*/
padding-right: 2rem;
padding-left: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
font-size: 1rem;
border-radius: 6px;
border: 2px solid #CBD2E0;
transition: .2s all;
cursor: pointer;
}
.filterItem select::-webkit-input-placeholder {
color: var(--grey);
}
.filterItem select:focus {
outline: none;
background-color: rgba(214, 238, 247, 0.5);
border: 1px solid var(--blue);
box-shadow: 0 0 3px var(--blue);
}
.filterItem select>option {
border-radius: 10px;
}
.filterWrapper .resetDropdownButton {
position: absolute;
top: auto;
right: 1.15rem;
bottom: .5rem;
background-color: transparent;
font-family: 'Roboto', sans-serif;
font-size: 1rem;
/* font-weight: bold;*/
border: 0 solid transparent;
cursor: pointer;
}
.filterWrapper .resetDropdownButton:hover {
text-decoration: underline;
}
select:disabled+button.resetDropdownButton::after {
color: gray;
opacity: 0.7;
}
select:disabled+button.resetDropdownButton:hover {
text-decoration: none;
}
.arrow::after {
/*add arrow down from fa-icon*/
content: '\f107';
font: normal normal normal 12px/1 FontAwesome;
color: black;
right: 8px;
top: -2px;
height: 26px;
padding: 15px 0px 0px 8px;
position: absolute;
pointer-events: none;
}
select:disabled + button.resetDropdownButton + span.arrow::after {
color: gray;
opacity: 0.7;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" rel="stylesheet" />
<div class="filterWrapper">
<div class="filterItem">
<select disabled>
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<button class="resetDropdownButton"></button>
<span class="arrow"></span>
</div>
</div>
I have this login form, which works and looks just fine in Chrome, IE11 and Edge but when try it out on Firefox, it looks completely different;
My labels are not the same width, so I have to re-adjust them. Also, my submit button doesn't seem to take on styles.
How can I make this work with Firefox as well?
My HTML:
<div class="loginheader">تسجيل الدخول</div>
<div class="loginform">
<form action="login.php" method="post" name="myform" id="myform">
<p>
<label for="loginform">اسم المستخدم</label>
<input type="text" name="username" id="login" value="mohammed.nasyia#gmail.com" placeholder="اسم المستخدم" />
</p>
<p>
<label for="loginform">كلمة المرور</label>
<input type="password" name="password" id="password" value="mohammed.nasyia#gmail.com" placeholder="كلمة المرور" />
</p>
<p >
<input type="submit" name="submit" value="تسجيل الدخول" class="button admin-login-button"/>
</p>
</form>
</div>
<div class="loginfooter">
تسجيل الدخول كممتحن
</div>
</div>
CSS:
.login-container {
margin-top: 100px;
margin-bottom: 50px;
margin-left: auto;
margin-right: auto;
width: 600px;
}
.loginform {
direction:RTL;
padding: 55px;
background-color: #fff;
border: 1px solid #eee;
border-bottom: 0px;
border-top: 0px;
}
.loginheader {
text-align: center;
background-color: #f5f5f5;
padding: 15px 0px;
border-radius: 10px 10px 0 0;
font-size: 30px;
}
.loginfooter {
padding: 15px 40px;
background-color: #f5f5f5;
border-radius: 0px 0px 10px 10px;
font-size: 18px;
text-align: center;
}
.loginheader, .loginfooter {
background-color: #f5f5f5;
border: 1px solid #ededed;
}
a {
text-decoration: none;
color: #000;
}
input[type=text], input[type=password] {
padding: 0 10px;
width: 320px;
height: 38px;
font-size: 16px;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
}
label {
float: rihgt;
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.edit-examinee label{
float: rihgt;
width: 130px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.loginform label {
float: rihgt;
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.button {
display: inline-block;
zoom: 1;
padding: 12px 30px;
margin: 0;
cursor: pointer;
border: 1px solid #bbb;
overflow: visible;
font: bold 16px arial, helvetica, sans-serif;
text-decoration: none;
white-space: nowrap;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.admin-login-button {
margin-right: 350px;
color: #333;
background-color: #fff;
border-color: #ccc;
}
.admin-login-button:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.admin-login-button:active {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
position: relative;
top: 2px;
text-shadow: none;
box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;
}
You can also check the JSFiddle of the form.
I removed the floats (with a typo), set the margin to left on the .admin-login-button. I also added a media query for smaller screens.
https://jsfiddle.net/6p4v9hs6/7/
New CSS here:
.login-container {
margin-top: 100px;
margin-bottom: 50px;
margin-left: auto;
margin-right: auto;
width: 600px;
}
.loginform {
direction:RTL;
padding: 55px;
background-color: #fff;
border: 1px solid #eee;
border-bottom: 0px;
border-top: 0px;
}
.loginheader {
text-align: center;
background-color: #f5f5f5;
padding: 15px 0px;
border-radius: 10px 10px 0 0;
font-size: 30px;
}
.loginfooter {
padding: 15px 40px;
background-color: #f5f5f5;
border-radius: 0px 0px 10px 10px;
font-size: 18px;
text-align: center;
}
.loginheader, .loginfooter {
background-color: #f5f5f5;
border: 1px solid #ededed;
}
a {
text-decoration: none;
color: #000;
}
input[type=text], input[type=password] {
padding: 0 10px;
width: 320px;
height: 38px;
font-size: 16px;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
}
label {
/* float: rihgt; */
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.edit-examinee label{
/* float: rihgt; */
width: 130px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.loginform label {
/* float: rihgt; */
width: 100px;
line-height: 40px;
padding-left: 10px;
font-size: 18px;
text-align: left;
display: inline-block;
margin: 10px 0px;
}
.button {
display: inline-block;
zoom: 1;
padding: 12px 30px;
margin: 0;
cursor: pointer;
border: 1px solid #bbb;
overflow: visible;
font: bold 16px arial, helvetica, sans-serif;
text-decoration: none;
white-space: nowrap;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.admin-login-button {
margin-left: 350px;
color: #333;
background-color: #fff;
border-color: #ccc;
}
.admin-login-button:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.admin-login-button:active {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
position: relative;
top: 2px;
text-shadow: none;
box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;
}
#media screen and (max-width: 540px) {
input[type=text], input[type=password] {
width: 90%;
}
}
Seems to work in both Safari and Firefox.
My drop down menu in mobile view hides behind my banner. I can't seem to fix it. I have added the z-index, and I've gone as high as 999 and still no difference.
this is the test page
Here is HTML:
<li class="dropdown">
<a class="dropdown-toggle provinces-btn" data-toggle="dropdown">Select Province<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Alberta</li>
<li>British Columbia</li>
<li>Manitoba</li>
<li>New Brunswick</li>
<li>Newfoundland and Labrador</li>
<li>Nova Scotia</li>
<li>Nunavut</li>
<li>Ontario</li>
<li>Prince Edward Island</li>
<li>Quebec</li>
<li>Saskatchewan</li>
</ul>
</li>
Here is CSS:
.dropdown-menu {
left: 40% !important;
margin-left: -30px;
z-index: 50;
}
#media screen and (max-width: 768px) {
.provinces-btn {
width: 100%;
margin-top: 1px;
border-radius: 12px;
background-color: #3498db;
border-color: rgba(0,0,0,0.3);
text-shadow: 0 1px 0 rgba(0,0,0,0.5);
color: #FFF !important;
display: inline-block;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 12px;
padding: 10px 30px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
border: 1px solid rgba(0,0,0,0.3);
border-bottom-width: 3px;
text-decoration: none;
z-index: 60;
}
.provinces-btn:hover, .provinces-btnActive {
color: #FFEE00 !important;
background: #1975D1;
font-weight: 900;
}
.provinces-btn ul{
margin: 0 auto;
}
}
#media screen and (max-width: 604px) {
.provinces-btn {
width: 100%;
margin-top: 1px;
margin-left: 15px;
border-radius: 12px;
background-color: #3498db;
border-color: rgba(0,0,0,0.3);
text-shadow: 0 1px 0 rgba(0,0,0,0.5);
color: #FFF !important;
display: inline-block;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 12px;
padding: 10px 30px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
border: 1px solid rgba(0,0,0,0.3);
border-bottom-width: 3px;
text-decoration: none;
z-index: 60;
}
.provinces-btn:hover, .provinces-btnActive {
color: #FFEE00 !important;
background: #1975D1;
font-weight: 900;
}
.provinces-btn ul{
margin: 0 auto;
}
}
Other CSS with z-index that I'm not sure if it is affecting it:
nav {
padding: 0;
position:relative;
z-index:10;
height: 0;
}
.showMenu {
display: block;
background: url() no-repeat center;
background-size: 48px 48px;
height: 80px;
right: 0;
top: 0;
text-indent: -999999px;
font-size: 0;
position: absolute;
z-index:11;
border-left: 1px solid #DDDDDD;
}
the problem isnt z-index problem the real problem is your header, just change
header {
width: 100%;
height: auto;
background: #FFFFFF;
overflow: auto;
overflow-y: hidden;
overflow-x: hidden;
margin-bottom: 2%;
}
To
header {
width: 100%;
height: auto;
background: #FFFFFF;
margin-bottom: 2%;
}
Z-Index only works on positioned elements, try adding this to your .dropdown-menu:
position: relative;
Don't make the overflow hidden. If it is set to hidden, it will not allow your new divs (inside the parent element where overflow:hidden) to pop up or overlap other divs.
I don't know how to put this question but here's what I wanna do. I have made a login form. I want the bottom of my login form to look something like this
So far I have this:
My css:
/***** Login *******/
fieldset {
border: none;
margin: 0;
}
input {
border: none;
font-family: inherit;
font-size: inherit;
margin: 0;
-webkit-appearance: none;
}
input:focus {
outline: none;
}
input[type="submit"] { cursor: pointer; }
/* ---------- LOGIN-FORM ---------- */
#login-form {
margin: 10px;
width: 300px;
border: 1px solid #ea6e10;
vertical-align: middle;
}
#login-form h3 {
background-color:#ea6e10;
color: #fff;
font-size: 14px;
margin-top: 0;
padding: 20px;
text-align: right;
}
#login-form fieldset {
background: #fff;
border: 1px #ea6e10;
padding: 20px;
position: relative;
}
#login-form input {
font-size: 14px;
}
#login-form input[type="username"],
#login-form input[type="password"] {
background: #dcdcdc;
padding: 12px 10px;
width: 238px;
margin-top: 5px;
}
#login-form input[type="username"] {
}
#login-form input[type="password"] {
border-radius: 0px 0px 3px 3px;
}
#login-form input[type="submit"] {
background: #ea6e10;
text-align: center;
color: #fff;
float: left;
font-weight: bold;
margin-top: 5px;
padding: 12px 20px;
width: 100%;
}
#login-form input[type="submit"]:hover {
background: #ea6e10;
}
/***** Login *******/
fieldset {
border: none;
margin: 0;
}
input {
border: none;
font-family: inherit;
font-size: inherit;
margin: 0;
-webkit-appearance: none;
}
input:focus {
outline: none;
}
input[type="submit"] { cursor: pointer; }
/* ---------- LOGIN-FORM ---------- */
#login-form {
margin: 10px;
width: 300px;
border: 1px solid #ea6e10;
vertical-align: middle;
}
#login-form h3 {
background-color:#ea6e10;
color: #fff;
font-size: 14px;
margin-top: 0;
padding: 20px;
text-align: right;
}
#login-form fieldset {
background: #fff;
border: 1px #ea6e10;
padding: 20px;
position: relative;
}
#login-form input {
font-size: 14px;
}
#login-form input[type="username"],
#login-form input[type="password"] {
background: #dcdcdc;
padding: 12px 10px;
width: 238px;
margin-top: 5px;
}
#login-form input[type="username"] {
}
#login-form input[type="password"] {
border-radius: 0px 0px 3px 3px;
}
#login-form input[type="submit"] {
background: #ea6e10;
text-align: center;
color: #fff;
float: left;
font-weight: bold;
margin-top: 5px;
padding: 12px 20px;
width: 100%;
}
#login-form input[type="submit"]:hover {
background: #ea6e10;
}
<div id="login-form" style="float:left;">
<h3>Login</h3>
<fieldset>
<input type="username" required value="username" onBlur="if(this.value=='')this.value='username'" onFocus="if(this.value=='username')this.value='' "> <!-- JS because of IE support; better: placeholder="username" -->
<input type="password" required value="Password" onBlur="if(this.value=='')this.value='Password'" onFocus="if(this.value=='Password')this.value='' "> <!-- JS because of IE support; better: placeholder="Password" -->
<p>Forgot Password?</p>
<input type="submit" value="Login">
</form>
</fieldset>
</div>
Change your CSS like this:
/***** Login *******/
fieldset {
border: none;
margin: 0;
}
input {
border: none;
font-family: inherit;
font-size: inherit;
margin: 0;
-webkit-appearance: none;
}
input:focus {
outline: none;
}
input[type="submit"] {
cursor: pointer;
}
/* ---------- LOGIN-FORM ---------- */
#login-form {
margin: 10px;
width: 300px;
vertical-align: middle;
position: relative;
background: #f9f9f9;
border: 1px solid #ea6e10;
}
#login-form:after, #login-form:before {
top: 100%;
left: 50%;
border: solid transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
#login-form:after {
border-color: rgba(249, 249, 249, 0);
border-top-color: #f9f9f9;
border-width: 15px;
margin-left: -15px;
}
#login-form:before {
border-color: rgba(255, 102, 0, 0);
border-top-color: #ea6e10;
border-width: 16px;
margin-left: -16px;
}
#login-form h3 {
background-color:#ea6e10;
color: #fff;
font-size: 14px;
margin-top: 0;
padding: 20px;
text-align: right;
}
#login-form fieldset {
background: #fff;
border: 1px #ea6e10;
padding: 20px;
position: relative;
}
#login-form input {
font-size: 14px;
}
#login-form input[type="username"], #login-form input[type="password"] {
background: #dcdcdc;
padding: 12px 10px;
width: 238px;
margin-top: 5px;
}
#login-form input[type="username"] {
}
#login-form input[type="password"] {
border-radius: 0px 0px 3px 3px;
}
#login-form input[type="submit"] {
background: #ea6e10;
text-align: center;
color: #fff;
float: left;
font-weight: bold;
margin-top: 5px;
padding: 12px 20px;
width: 100%;
}
#login-form input[type="submit"]:hover {
background: #ea6e10;
}
See forked CodePen
You can use this is a bubble generator:
.bubble {
position: relative;
width: 250px;
padding: 0px;
background: #FFFFFF;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: #ea6e10 solid 2px;
}
.bubble:after {
content:'';
position: absolute;
border-style: solid;
border-width: 15px 15px 0;
border-color: #FFFFFF transparent;
display: block;
width: 0;
z-index: 1;
bottom: -15px;
left: 136px;
}
.bubble:before {
content:'';
position: absolute;
border-style: solid;
border-width: 16px 16px 0;
border-color: #ea6e10 transparent;
display: block;
width: 0;
z-index: 0;
bottom: -17px;
left: 135px;
}
And apply this class in your container element. In your case:
<div id="login-form" class="bubble" style="float:left;">
fiddle
Here's your change in an updated CodePen.
And here's what we did:
CSS
#login-form {
margin: 10px;
width: 300px;
border: 1px solid #ea6e10;
vertical-align: middle;
position: relative;
}
#login-form:after {
position: absolute;
content: ' ';
transform: rotate(45deg) translate(-50%, -5px);
height:30px;
width:30px;
top: 100%;
left: 50%;
background-color: white;
border-color: #ea6e10;
border-width: 1px;
border-style: solid;
border-top: none;
border-left: none;
pointer-events: none;
}
We allow the pseudo-element after to be appropriately positioned by setting the #login-form to position:relative. The important part of this is the #login-form:after part, though. We're creating a pseudo-element that exists outside the normal document object model to provide the stylistic element. We take this, define it as a 30px x 30px box, give it a white background and an orange border, and put it smack dab in the bottom middle of your parent element #login-form. Then, we use transforms to rotate it 45 degrees and scoot it up 5 pixels to meet the bottom border of your parent element.
This will not work in IE 9 and below
We need to do some clever things with borders for IE 9 and under. Here's the change for that scenario:
CSS
#login-form {
position: relative;
}
#login-form:before, #login-form:after {
position: absolute;
top: 100%;
left: 50%;
content: ' ';
}
#login-form:before {
border-top: solid 15px white;
border-left: solid 15px transparent;
border-right: solid 15px transparent;
margin-left: -15px;
}
#login-form:after {
border-top: solid 17px #ea6e10;
border-left: solid 17px transparent;
border-right: solid 17px transparent;
margin-left: -17px;
}
i'm displaying menu hover on image .These all image generated dynamically.
while mouse hover on first image menu will display but problem on menu items background items displaying. how to hide behide elemets while displying hover ?
a {
text-decoration: none;
}
.menu {
font-family: Arial;
color: #515151;
height: 40px;
position: relative;
text-align: left;
width: 15px;
margin: 0 auto;
}
.menu li a {
color: #515151;
display: block;
cursor: pointer;
font-size: 14px;
padding: 6px 15px;
}
.menu li a:hover {
background: #f44141;
color: #fff;
}
.sub {
background: #fff;
position: absolute;
z-index: 2;
width: 200px;
border-radius: 3px;
box-shadow: 0 2px 4px #ddd;
border: 1px solid #ddd;
display: none;
padding: 40px 0 3px;
}
a.hover-link {
width: 190px;
background: #fff;
font-size: 14px;
color: #515151;
position: absolute;
z-index: 110;
display: block;
height: 8px;
cursor: pointer;
border-radius: 5px 5px 0 0;
font-weight: 700;
border: 1px solid #ddd;
padding: 10px 0 1px 10px;
}
.sub-options {
list-style: none;
font-size: 11px;
margin: 0;
padding: 0;
}
Working example : This is just z-index's issue CSS:
.sub{
background: #fff;
position: absolute;
z-index: 1000;
width: 200px;
margin: 0px 0 3px;
border-radius: 3px;
box-shadow: 0 2px 4px #ddd;
border: 1px solid #ddd;
display: none; top:38px; left:0;
}