Focusing with tab key not working in FireFox - html

I have a problem with focusing link with tab key in FireFox. Focusing works normal in chrome but in FireFox it loops inside one element.
I have created a example with the described behavior(open it in FireFox)
https://jsfiddle.net/e4gcmk6z/2/
.notVisible {
opacity: 0;
position: fixed;
}
.selection-box-v2 .selection-item {
background: #ffffff;
border: solid;
border-width: 1px;
border-color: #9c9c9c;
border-radius: 3px;
padding: 10px;
display: block;
}
label.label-outline {
font-size: 14px !important;
-webkit-transform: translate(0px, 12px);
transform: translate(0px, 12px);
position: absolute;
padding-right: 5px;
padding-left: 5px;
margin-top: 0px;
left: 18px;
line-height: normal !important;
cursor: text;
color: #5f5f5f;
z-index: 1;
}
.selection-box-v2 .co-calendar {
color: #3071a9;
font-size: 20px;
margin-right: 20px;
margin-top: 10px;
position: absolute;
right: 0;
pointer-events: none;
z-index: 1;
}
<div>
Tab key is not focusing link 2 in FireFox
</div>
<div class="links-v2">
<a tabindex="0" href="javascript:void(0);">
link 1
</a>
</div>
<br>
<div class="col-xs-12 selection-box-v2 pad">
<label tabindex="0" role="radio">
<input type="radio" class="shipModeId notVisible" name="shipModeId_1" value="p79652">
<span class="selection-item preferred-arrival-date-v2 inner-addon right-addon calendar-box">
<input class="ship-date" type="hidden" value="">
<span class="padClause" style="display: none">
<p class="checkout-ship-padClause"> </p>
</span>
<span class="ship-type-and-cost" style="margin-top: 10px;">some other elements
<span class="shipping-cost span-inline calendar-arrival"></span>
</span>
</span>
</label>
</div>
<br>
<div class="links-v2">
<a tabindex="0" href="javascript:void(0);">
link 2
</a>
</div>
Any one has and idea what could be wrong?

You can remove the tab index of the two a tags since they are not needed, also there are some input tags that are not visible on the screen, these need to be set to tabIndex as -1 so that these elements are skipped!
.notVisible {
opacity: 0;
position: fixed;
}
.selection-box-v2 .selection-item {
background: #ffffff;
border: solid;
border-width: 1px;
border-color: #9c9c9c;
border-radius: 3px;
padding: 10px;
display: block;
}
label.label-outline {
font-size: 14px !important;
-webkit-transform: translate(0px, 12px);
transform: translate(0px, 12px);
position: absolute;
padding-right: 5px;
padding-left: 5px;
margin-top: 0px;
left: 18px;
line-height: normal !important;
cursor: text;
color: #5f5f5f;
z-index: 1;
}
.selection-box-v2 .co-calendar {
color: #3071a9;
font-size: 20px;
margin-right: 20px;
margin-top: 10px;
position: absolute;
right: 0;
pointer-events: none;
z-index: 1;
}
<div>
Tab is not focusing link 2 in FireFox
</div>
<div class="links-v2">
<a href="javascript:void(0);">
link 1
</a>
</div>
<br>
<div class="col-xs-12 selection-box-v2 pad">
<label tabindex="0" role="radio">
<input type="radio" tabindex="-1" class="shipModeId notVisible" name="shipModeId_1" value="p79652">
<span class="selection-item preferred-arrival-date-v2 inner-addon right-addon calendar-box">
<input class="ship-date" tabindex="-1" type="hidden" value=""/>
<span class="padClause" style="display: none">
<p class="checkout-ship-padClause"> </p>
</span>
<span class="ship-type-and-cost" style="margin-top: 10px;">some other elements
<span class="shipping-cost span-inline calendar-arrival"></span>
</span>
</span>
</label>
</div>
<br>
<div class="links-v2">
<a href="javascript:void(0);">
link 2
</a>
</div>
checked in Firefox 67.0.4 (64-bit)

Related

input and span elements with tooltip within div in same line

The span element in div has a tooltip. When I remove the tooltip from the span, see second div (word), the input field moves a bit higher than rest of input fields.
How can I fix this issue? Thank you in advanced.
<div>
<div class="word">
<input id="word-4" name="word-4" type="text" data-index="3" value="the">
<span class="x-tag" value="4"></span>
<span class="tooltip" value="4"><span class="tooltiptext">Words</span>><</span>
</div>
<div class="word">
<input id="word-5" name="word-5" type="text" data-index="4" value="supermarket">
<span class="x-tag" value="5"></span>
<span class="" value=""></span>
</div>
<div class="word">
<input id="word-6" name="word-6" type="text" data-index="5" value="nerby">
<span class="x-tag" value="6"></span>
<span class="tooltip" value="6"><span class="tooltiptext">Words</span>><</span>
</div>
</div>
Here is the full example:
https://jsfiddle.net/myFiddler/5encgkh0/1/
Remove float:left from input, there is no need to use and give padding to parent element
/***************/
/* Tool-Tip */
/***************/
/*https://www.w3schools.com/css/css_tooltip.asp*/
.parent{
padding:25px;
}
.tooltip {
position: relative;
display: inline-block;
/* border-bottom: 1px dotted black; If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
position: absolute;
z-index: 1;
visibility: hidden;
width: 120px;
margin-left: -60px;
bottom: 100%;
left: 50%;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Fade in tooltip - takes 1 second to go from 0% to 100% opac: */
opacity: 0;
transition: opacity 2s;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
.tooltip .tooltiptext:after {
content: " ";
position: absolute;
top: 100%; /* At the bottom of the tooltip */
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
/********************/
/*** Word Input ***/
/********************/
.word {
width: 141px;
display: inline-block;
box-sizing: border-box;
position: relative;
margin-bottom: 12px;
}
.word .no-linking {
cursor: auto;
}
.icon-link.checked {
color: rgb(255,120,90);
}
.word > input {
width: 100px !important;
line-height: 24px;
font-size: 14px !important;
}
span.word {
border-radius: 4px;
margin-bottom: 5px;
}
.icon-link {
display: inline-block;
padding-top: 6px;
padding-left: 3px;
cursor: pointer;
}
.x-tag:after {
font-size: 13px;
content: "x";
padding: 1px 2px;
position: absolute;
display: inline-block;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
z-index: 100;
right: 36px;
line-height: 24px;
}
<div class="parent">
<div class="word">
<input id="word-1" name="word-1" type="text" data-index="0" value="I">
<span class="x-tag" value="1"></span>
<span class="tooltip" value="1"><span class="tooltiptext">Words</span>><</span>
</div>
<div class="word">
<input id="word-2" name="word-2" type="text" data-index="1" value="go">
<span class="x-tag" value="2"></span>
<span class="tooltip" value="2"><span class="tooltiptext">Words</span>><</span>
</div>
<div class="word">
<input id="word-3" name="word-3" type="text" data-index="2" value="to">
<span class="x-tag" value="3"></span>
<span class="tooltip" value="3"><span class="tooltiptext">Words</span>><</span>
</div>
<div class="word">
<input id="word-4" name="word-4" type="text" data-index="3" value="the">
<span class="x-tag" value="4"></span>
<span class="tooltip" value="4"><span class="tooltiptext">Words</span>><</span>
</div>
<div class="word">
<input id="word-5" name="word-5" type="text" data-index="4" value="supermarket">
<span class="x-tag" value="5"></span>
<span class="" value=""></span>
</div>
<div class="word">
<input id="word-6" name="word-6" type="text" data-index="5" value="nerby">
<span class="x-tag" value="6"></span>
<span class="tooltip" value="6"><span class="tooltiptext">Words</span>><</span>
</div>
</div>

Unable show tick mark on image while clicking an image?

I am trying to show a tick mark on top of the image when a user clicks on it. I have an input radio button element and label both wrapped in anchor element and inside the label i have and an image element and i use css to apply tick mark. Whenever i click on the image nothing happens. Please i would appreciate if anyone can help. Here is the snippets
.icon {
margin: 5px 0;
}
.icon input {
display: none;
}
.icon img {
vertical-align: middle;
width: 50%;
border: 2px solid greenyellow;
}
.icon input:checked {
background: rgba(0,0,0,0.5);
}
.icon input:checked::after{
content: '✔';
position: absolute;
top: 50%;
left: 50%;
width: 30px;
height: 30px;
transform: translate(-50%, -50%);
color: black;
font-size: 20px;
text-align: center;
border: 1px solid black;
border-radius: 50%;
}
<div class="row">
<a href="#" class="col-sm-4 icon">
<input type="radio" name="selimg" id="selimg1">
<label for="selimg1">
<img src="./images/baby-bottle.png">
</label>
</a>
<a href="#" class="col-sm-4 icon">
<input type="radio" name="selimg" id="selimg2">
<label for="selimg2">
<img src="./images/badge.png">
</label>
</a>
<a href="#" class="col-sm-4 icon">
<img src="./images/cardiologist.png">
</a>
</div>
::before and ::after only work on container elements, so you can not use that on your inputs.
Instead of .icon input:checked::after try using .icon input:checked + label::before.
(The rest of your CSS needs adjustments to make it show how you want, but this will at least make it show up and you can move it where it needs to be)
.icon {
margin: 5px 0;
}
.icon input {
display: none;
}
.icon img {
vertical-align: middle;
width: 50%;
border: 2px solid greenyellow;
}
.icon input:checked {
background: rgba(0, 0, 0, 0.5);
}
.icon input:checked + label::before {
content: '✔';
position: absolute;
top: 50%;
left: 50%;
width: 30px;
height: 30px;
transform: translate(-50%, -50%);
color: black;
font-size: 20px;
text-align: center;
border: 1px solid black;
border-radius: 50%;
}
<div class="row">
<a href="#" class="col-sm-4 icon">
<input type="radio" name="selimg" id="selimg1">
<label for="selimg1">
<img src="./images/baby-bottle.png">
</label>
</a>
<a href="#" class="col-sm-4 icon">
<input type="radio" name="selimg" id="selimg2">
<label for="selimg2">
<img src="./images/badge.png">
</label>
</a>
<a href="#" class="col-sm-4 icon">
<img src="./images/cardiologist.png">
</a>
</div>

html link buttons centered on page

Currently I am trying to create some links that look like buttons. It's working fairly well, except I want to be able to align them horizontally. This what I have so far:
.border {
display: table;
width: 220px;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float:left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Edit:
If it has display:inline-block; it will mess up with formatting with heights and not center the text.
I'm trying to create something as shown here, but then be able to center this on the page as well.
Thanks!
Support in all browsers including IE.
.btn-grp {
position: absolute;
top: 0%;
left: 50%;
transform: translate(-50%, 0%);
width: 80vw;
}
.border {
display: table;
width: 25%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float: left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
If you need the 4 div at vertically centered then use:
.btn-grp {
position: absolute;
top: 50%;
left:50%;
transform: translate(-50%, -50%);
}
Because you are using width in px thats why then don't come in a single row...So try to use % width i.e. 25%...
.border {
display: table;
width: 25%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
border-spacing: 10px;
float: left;
}
.border:hover {
border-spacing: 2px;
}
a.btn {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #ffffff;
font: 17.5px sans-serif;
text-decoration: none;
background-color: #1E5034;
line-height: 20px;
margin-bottom: 0;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited,
a.btn:link {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Well I recommend you to use Flexbox here...It will give you the full control to align the item vertically and horizontally...Also you will need to use :after for the background, as flexbox does not allow border-spacing
.btn-grp {
display: flex;
justify-content: center;
}
.border {
width: 20%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 10px;
}
a.btn {
text-align: center;
color: #ffffff;
font: 16px sans-serif;
text-decoration: none;
line-height: 20px;
margin-bottom: 0;
flex: 1;
}
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited {
color: #ffffff;
background-color: #1E5034;
text-decoration: none;
cursor: pointer;
}
.border:before {
content: "";
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #1f5034;
position: absolute;
z-index: -1;
transition: all .3s ease;
transform: scale(0.85);
}
.border:hover:before {
transform: scale(0.95);
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>
Well for IE 8 support use display:inline-block and transform to place the content in center...
.btn-grp {
text-align: center;
font-size: 0;
}
.border {
width: 20%;
height: 120px;
border: 2px solid #1E5034;
transition: all 250ms ease-out;
box-sizing: border-box;
display: inline-block;
vertical-align: top;
position: relative;
padding: 10px;
}
a.btn {
text-align: center;
color: #ffffff;
font: 16px sans-serif;
text-decoration: none;
line-height: 20px;
margin-bottom: 0;
position: relative;
top: 50%;
transform: translateY(-50%);
display: block;
}
.border:before {
content: "";
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #1f5034;
position: absolute;
z-index: -1;
transition: all .3s ease;
transform: scale(0.85);
}
.border:hover:before {
transform: scale(0.95);
}
<div class="btn-grp">
<div class="border">
<a class="btn" href="#">Some really long text link #1</a>
</div>
<div class="border">
<a class="btn" href="#">Some other really long text link #2</a>
</div>
<div class="border">
<a class="btn" href="#">Some more really really long text link #3</a>
</div>
<div class="border">
<a class="btn" href="#">The last really long text link #4</a>
</div>
</div>

CSS absolute positioning and resizing windows

First off let me say, I don't do a whole lot of front end design so please excuse all my inline code etc...
I've built these check boxes to be able to include the image when clicked. I understand it's not inside the parent class but i'm a bit confused at this point on how to move forward. Since it doesn't have a parent class it just looks for the whole web page as it's parent class i presume.
Fairly simple, i think; when i minimize my screen my label positioning removes itself from the boxes and floats off. I'll attach screen shots for more clarity.
I've tried to put a few of them in divs with some success but i'm not 100% sure the right way of doing this and that's why i'm here. I've tried some relative positioning as well.
<div class="interests">
<div class="subHeader">Interests:</div>
<label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold';
font-size: 18px !important;
text-transform: uppercase;
color: #FFF;
padding-top: 20px;
display: inline-block; z-index: 5; position:absolute; left: 465px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SKATE</div></label>
<label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold';
font-size: 18px !important;
text-transform: uppercase;
color: #FFF;
padding-top: 20px;
display: inline-block; z-index: 5; position:absolute; left: 685px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SURF</div></label>
<label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold';
font-size: 18px !important;
text-transform: uppercase;
color: #FFF;
padding-top: 20px;
display: inline-block; z-index: 5; position:absolute; left: 906px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SNOW</div></label>
<label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold';
font-size: 18px !important;
text-transform: uppercase;
color: #FFF;
padding-top: 20px;
display: inline-block; z-index: 5; position:absolute; left: 465px; top: 1300px;"><div style="position:relative;left:10px; bottom: 8px;"> WOMEN</div></label>
<label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold';
font-size: 18px !important;
text-transform: uppercase;
color: #FFF;
padding-top: 20px;
display: inline-block; z-index: 5; position:absolute; left: 685px; top: 1300px;"><div style="position:relative;left:10px; bottom: 8px;"> MUSIC/ART </div></label>
<label style="position: relative; top: 90px;">
<input type="checkbox" name="CheckBox.A address.Sk" style="z-index: 1;position: relative; top:4px;">Skate<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width: 205px;">
</label>
<input type="hidden" name="CheckBox.A address.Sk" value="off">
<label style="position: relative; left:140px; top: 90px;">
<input type="checkbox" name="CheckBox.A address.Su" style="z-index: 1;position: relative; top:4px;">Surf<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width: 205px;">
</label>
<input type="hidden" name="CheckBox.A address.Su" value="off">
<label style="position: relative; left:290px; top: 90px;">
<input type="checkbox" name="CheckBox.A address.Sn" style="z-index: 1;position: relative; top:4px;">Snow<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;">
</label>
<input type="hidden" name="CheckBox.A address.Sn" value="off">
<br><br><br><br><br><br><br><br><br><br><br><br>
<label style="position:relative; top: 60px;">
<input type="checkbox" name="CheckBox.A address.Wo" style="z-index: 1;position: relative; top:4px;">Women<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;">
</label>
<input type="hidden" name="CheckBox.A address.Wo" value="off">
<label style="position:relative; left: 130px; top: 60px;">
<input type="checkbox" name="CheckBox.A address.Mu" style="z-index: 1;position: relative; top:4px;">Music<img src="https://stuff/Images/music_thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;">
</label><input type="hidden" name="CheckBox.A address.Mu " value="off">
<label><input type="checkbox" name="CheckBox.A address.Subscribe"></label>
<div style="position:relative; left: 50px; bottom: 33px;">Subscribe</div>
<input type="hidden" name="CheckBox.A address.Subscribe" value="off">
<input type="submit" id="submit" value="Sign Up" style="width: 280px;
height: 45px;
display: block !important;
outline-style: none !important;
outline-width: 0px !important;
color: #fff !important;
font-weight: normal !important;
font-family: 'itc_avant_garde_gothic_ltbold';
text-transform: uppercase;
text-decoration: none;
text-align: center;
border: 1px solid #434242;
background-color: #434242;
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#434242), to(#2f2e2e));
background-image: -webkit-linear-gradient(top, #434242, #2f2e2e);
background-image: -moz-linear-gradient(top, #434242, #2f2e2e);
background-image: -ms-linear-gradient(top, #434242, #2f2e2e);
background-image: -o-linear-gradient(top, #434242, #2f2e2e);
-moz-box-shadow: 0 0 1px #bbb;
-webkit-box-shadow: 0 0 1px #bbb;
box-shadow: 0 0 1px #bbb;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
vertical-align: middle;
padding: 10px 0;
line-height: 1em;
cursor: pointer;
line-height: 18px;
font-size: 18px;
margin: 40px 0;">
</div>
Any help would be greatly appreciated. Thank you. Screen shots below.
Labels are floating off when i minimize :
Works fine when full screen :
I commented with a few bad practices and falsehoods on another answer, so I really had to make a quick example myself, this is one way to do it with flexbox (there are a lot of solutions to this problem, this is a good one if you don't have to support obsolete browsers):
Example: https://jsfiddle.net/um6fm744/1/
CSS:
* { box-sizing: border-box; margin: 0; padding: 0; }
.interests {
display: flex;
flex-wrap: wrap;
}
.sub-header {
margin: 0 0 24px;
width: 100%;
}
.interest {
align-items: flex-end;
background-color: green;
display: flex;
margin: 0 12px 24px 0;
min-height: 160px;
width: 160px;
}
.interest-info {
background-color: black;
display: flex;
justity-content: space-between;
width: 100%;
}
.interest-checkbox {
height: 30px;
width: 30px;
}
.interest-label {
color: white;
font-family: sans-serif;
flex: 1;
height: 30px;
line-height: 30px;
margin-left: 12px;
}
HTML
<div class="interests">
<h1 class="sub-header">Interests:</h1>
<div class="interest">
<div class="interest-info">
<input class="interest-checkbox" type="checkbox" />
<label class="interest-label">SKATE</label>
</div>
</div>
<div class="interest">
<div class="interest-info">
<input class="interest-checkbox" type="checkbox" />
<label class="interest-label">SNOW</label>
</div>
</div>
<div class="interest">
<div class="interest-info">
<input class="interest-checkbox" type="checkbox" />
<label class="interest-label">WOMEN</label>
</div>
</div>
<div class="interest">
<div class="interest-info">
<input class="interest-checkbox" type="checkbox" />
<label class="interest-label">SURF</label>
</div>
</div>
<div class="interest">
<div class="interest-info">
<input class="interest-checkbox" type="checkbox" />
<label class="interest-label">MUSIC/ART</label>
</div>
</div>
</div>
Please don't use inline styling.
I would tackle it more like this: http://codepen.io/anon/pen/VeEXEv
HTML:
<ul class="items">
<li class="item1">
<button class="add-button">+</button>
<span class="description">box 1</span>
</li>
<li class="item2">
<button class="add-button">+</button>
<span class="description">box 2</span>
</li>
<li class="item3">
<button class="add-button">+</button>
<span class="description">box 3</span>
</li>
<li class="item2">
<button class="add-button">+</button>
<span class="description">box 2</span>
</li>
<li class="item3">
<button class="add-button">+</button>
<span class="description">box 3</span>
</li>
<li class="item1">
<button class="add-button">+</button>
<span class="description">box 1</span>
</li>
</ul>
CSS:
.items > li {
list-style: none;
float: left;
height: 20px;
width: 100px;
margin: 10px;
border: 1px #000 solid;
position: relative;
padding-top: 80px;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.items .description {
background: rgba(0,0,0,0.8);
height: 20px;
width: 80px;
color: #fff;
display: block;
float: right;
text-align: center;
}
.items .add-button {
width: 20px;
height: 20px;
border: none;
background-color: #666;
color: #fff;
}
.item1 {
background-image: url(https://pbs.twimg.com/profile_images/586137164188004352/wTK4hjbl.jpg);
}
.item2 {
background-image: url(https://pbs.twimg.com/profile_images/3276050019/f1d244a9f3254f30176922985c761d28.png);
}
.item3 {
background-image: url(https://people.rit.edu/~bmd6715/230/exercises/images/cat.png);
}

Modal showing in IE

i have this code for display one modal with form for register when click the "log in" button (for phpBB3). Everything is awesome, but in IE the modal appear on page loading withoud my click.. how to resolve this?
/***************
Login Box Dialog
***************/
.loginDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.loginDialog:target {
opacity:1;
pointer-events: auto;
}
.loginDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.closeDialog {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.closeDialog:hover { background: #00d9ff; }
.popupWrapper{background:url('ir_red/trans60.png') repeat;background:rgba(0,0,0,0.6);padding:8px;-webkit-box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;-moz-box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}
}.popupInner{width:500px;overflow:auto;-webkit-box-shadow:0px 0px 3px rgba(0,0,0,0.4);-moz-box-shadow:0px 0px 3px rgba(0,0,0,0.4);box-shadow:0px 0px 3px rgba(0,0,0,0.4);overflow-x:hidden}.popupInner.black_mode{background:#000;color:#eee;border:3px
solid #626262}.popupInner.warning_mode{border:3px
solid #7D1B1B}.popupInner
h3{border-bottom:1px solid #2a2a2a;text-shadow:rgba(0,0,0,0.8) 0px -1px 0px;background:#282828 url('ir_red/highlight_reallyfaint.png') repeat-x 0 0;padding:8px
10px 9px;font-size:16px;font-weight:300}.popupInner h3
a{color:#fff}.popupInner.black_mode
h3{background-color:#595959;color:#ddd}.popupInner.warning_mode
h3{background-color:#7D1B1B;padding-top:6px;padding-bottom:6px;color:#fff}
<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
<form method="post" class="" action="{S_LOGIN_ACTION}">
<div id="login" class="loginDialog">
<div class="popupWrapper" style="z-index: 10001; top: 76.75px; left: 375px; position: fixed;">
<div id="sign_in_popup_inner" class="popupInner" style="width: 600px; max-height: 645px;">
<div id="inline_login_form">
<h3>Sign In</h3>
<br />
<div class="ipsForm ipsForm_horizontal">
<fieldset>
<ul>
<li class="ipsField">
<div class="ipsField_content">
Need an account? Register now!
</div>
</li>
<li class="ipsField ipsField_primary">
<span class="ipsField_title">Username</span>
<div class="ipsField_content">
<input id="username" class="input_text" name="username" type="text" size="30" tabindex="1" style="font-size: 18px;">
</div>
</li>
<li class="ipsField ipsField_primary">
<span class="ipsField_title">Password</span>
<div class="ipsField_content">
<input id="password" class="input_text" name="password" type="password" size="30" tabindex="2" style="font-size: 18px;"><br />
I've forgotten my password
Resend activation e-mail
</div>
</li>
<!-- IF S_AUTOLOGIN_ENABLED -->
<li class="ipsField ipsField_checkbox">
<input type="checkbox" checked="checked" class="radio" name="autologin" tabindex="3" />
<div class="ipsField_content">
<span class="inline_remember">
<strong>Remember me</strong><br>
<span class="desc lighter">This is not recommended for shared computers</span>
</span>
</div>
</li>
<!-- ENDIF -->
<li class="ipsField ipsField_checkbox">
<input type="checkbox" class="radio" name="viewonline" tabindex="4" />
<div class="ipsField_content">
<span class="inline_invisible">
<strong>Hide my online status this session</strong><br />
<span class="desc lighter">Don't add me to the active users list</span>
</span>
</div>
</li>
</ul>
</fieldset>
</div>
<div class="ipsForm_submit ipsForm_center" style="text-align: center;">
<input type="submit" name="login" class="ipsButton" value="{L_S_SIGN_IN}" style="outline: 0; border: 1px solid #252525;" />
</div>
</div>
</div>
<div id="sign_in_popup_close" class="popupClose clickable"><img src="{T_THEME_PATH}/ir_red/close_popup.png" alt="x"></div></div>
<div id="document_modal" class="modal" style="width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 10000; opacity: 0.4; filter: alpha(opacity=40);"></div>
</div>
{S_LOGIN_REDIRECT}
{S_FORM_TOKEN}
</form>
<!-- ENDIF -->
So.. this show correctly but in ie when page is loading (index), the modal appear directly without my click on login.
In IE opacity:0 shows inner child elements,so add the visibility property in your loginDialog class and also in loginDialog:target like this:
.loginDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
visibility:hidden; // add this line
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.loginDialog:target {
opacity:1;
visibility:visible; // add this line
pointer-events: auto;
}
Addition
You should have following meta tag declared :
<meta http-equiv="X-UA-Compatible" content="IE=edge">
/***************
Login Box Dialog
***************/
.loginDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.8);
z-index: 99999;
opacity:0;
display:none; // add this line
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.loginDialog:target {
opacity:1;
pointer-events: auto;
display:block; // add this line
}
.loginDialog > div {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);
}
.closeDialog {
background: #606061;
color: #FFFFFF;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
.closeDialog:hover { background: #00d9ff; }
.popupWrapper{background:rgba(0,0,0,0.6);padding:8px;-webkit-box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;-moz-box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;box-shadow:rgba(0,0,0,0.5) 0px 10px 20px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}
}.popupInner{width:500px;overflow:auto;-webkit-box-shadow:0px 0px 3px rgba(0,0,0,0.4);-moz-box-shadow:0px 0px 3px rgba(0,0,0,0.4);box-shadow:0px 0px 3px rgba(0,0,0,0.4);overflow-x:hidden}.popupInner.black_mode{background:#000;color:#eee;border:3px
solid #626262}.popupInner.warning_mode{border:3px
solid #7D1B1B}.popupInner
h3{border-bottom:1px solid #2a2a2a;text-shadow:rgba(0,0,0,0.8) 0px -1px 0px;padding:8px
10px 9px;font-size:16px;font-weight:300}.popupInner h3
a{color:#fff}.popupInner.black_mode
h3{background-color:#595959;color:#ddd}.popupInner.warning_mode
h3{background-color:#7D1B1B;padding-top:6px;padding-bottom:6px;color:#fff}
<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
<form method="post" class="" action="{S_LOGIN_ACTION}">
<div id="login" class="loginDialog">
<div class="popupWrapper" style="z-index: 10001; top: 76.75px; left: 375px; position: fixed;">
<div id="sign_in_popup_inner" class="popupInner" style="width: 600px; max-height: 645px;">
<div id="inline_login_form">
<h3>Sign In</h3>
<br />
<div class="ipsForm ipsForm_horizontal">
<fieldset>
<ul>
<li class="ipsField">
<div class="ipsField_content">
Need an account? Register now!
</div>
</li>
<li class="ipsField ipsField_primary">
<span class="ipsField_title">Username</span>
<div class="ipsField_content">
<input id="username" class="input_text" name="username" type="text" size="30" tabindex="1" style="font-size: 18px;">
</div>
</li>
<li class="ipsField ipsField_primary">
<span class="ipsField_title">Password</span>
<div class="ipsField_content">
<input id="password" class="input_text" name="password" type="password" size="30" tabindex="2" style="font-size: 18px;"><br />
I've forgotten my password
Resend activation e-mail
</div>
</li>
<!-- IF S_AUTOLOGIN_ENABLED -->
<li class="ipsField ipsField_checkbox">
<input type="checkbox" checked="checked" class="radio" name="autologin" tabindex="3" />
<div class="ipsField_content">
<span class="inline_remember">
<strong>Remember me</strong><br>
<span class="desc lighter">This is not recommended for shared computers</span>
</span>
</div>
</li>
<!-- ENDIF -->
<li class="ipsField ipsField_checkbox">
<input type="checkbox" class="radio" name="viewonline" tabindex="4" />
<div class="ipsField_content">
<span class="inline_invisible">
<strong>Hide my online status this session</strong><br />
<span class="desc lighter">Don't add me to the active users list</span>
</span>
</div>
</li>
</ul>
</fieldset>
</div>
<div class="ipsForm_submit ipsForm_center" style="text-align: center;">
<input type="submit" name="login" class="ipsButton" value="{L_S_SIGN_IN}" style="outline: 0; border: 1px solid #252525;" />
</div>
</div>
</div>
<div id="sign_in_popup_close" class="popupClose clickable"><img alt="x"></div></div>
<div id="document_modal" class="modal" style="width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 10000; opacity: 0.4; filter: alpha(opacity=40);"></div>
</div>
</form>
<!-- ENDIF -->
<a href='#login'>show modal</a>