CSS only working on zoomed in page - css

I've an odd problem. my CSS only works on the zoomed page. When the page is at 100% size and I right click on the input the CSS doesn't work, I've to zoom in to 35% or lower for the contextual menu to appear. If I zoom out to 50% it disappears again.
The part of my code that causes the problem is in this JsFiddle http://jsfiddle.net/6ny94/1323/
Here is my complete CSS:
body {
font-family: Arial, Helvetica, sans-serif;
padding-bottom: 20px;
padding-left: 20px;
width: 1200px;
}
.adCounter {
background: #313131;
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
color: #fff;
float: right;
font-size: 14px;
padding: 6px 9px;
position: relative;
right: 1px;
top: -33px;
min-width: 34px;
}
.adCounter2 {
background: #313131;
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
color: #fff;
float: right;
font-size: 14px;
padding: 13px 9px;
position: relative;
right: 1px;
top: -33px;
min-width: 34px;
min-height: 53px;
}
#myBtn {
display: none; /* Hidden by default */
position: fixed; /* Fixed/sticky position */
bottom: 20px; /* Place the button at the bottom of the page */
right: 30px; /* Place the button 30px from the right */
z-index: 99; /* Make sure it does not overlap */
border: none; /* Remove borders */
outline: none; /* Remove outline */
background-color: #000000; /* Set a background color */
color: white; /* Text color */
cursor: pointer; /* Add a mouse pointer on hover */
padding: 8px; /* Some padding */
border-radius: 8px; /* Rounded corners */
font-size: 18px; /* Increase font size */
}
.myBtn1 {
background-color: #3cba54;
color: white;
padding: 5px;
border-radius: 4px;
font-size: 14px;
border-width: inherit;
cursor:pointer;
}
.myBtn2 {
background-color: #879383;
color: white;
padding: 5px;
border-radius: 4px;
font-size: 14px;
border-width: inherit;
cursor:pointer;
}
.myBtn3 {
background-color: #f4c20d;
color: white;
padding: 5px;
border-radius: 4px;
font-size: 14px;
border-width: inherit;
cursor:pointer;
}
.myBtn4 {
background-color: #db3236;
color: white;
padding: 5px;
border-radius: 4px;
font-size: 14px;
border-width: inherit;
cursor:pointer;
}
#description {
width: 350px;
float:left;
min-height: 32px;
}
[id^="description2"] {
width: 350px;
float:left;
min-height: 32px;
}
#previewBox{
float: right;
margin-right: 259px;
margin-top: -311px;
width: 518px;
font-size: 12px;
box-shadow: 1px 1px 2px 2px #ccc;
padding-bottom: 12px;
border-radius: 3px;
}
[id^="previewBox1"]{
float: right;
}
.previewBox1{
width: 466px;
font-size: 12px;
box-shadow: 1px 1px 2px 2px #ccc;
padding-bottom: 12px;
border-radius: 3px;
margin-bottom: 12px;
}
#descriptiontext{
width: 120px;
}
.deleteAd{
background-color: red;
color: white;
padding: 5px;
border-radius: 5px;
border: 0;
margin-left: 18px;
margin-right: 14px;
padding-bottom: -13px;
margin-top: -26px;
}
.duplicateAd{
background-color: #aaa;
color: white;
padding: 5px;
border-radius: 5px;
border: 0;
margin-right: 16px;
padding-bottom: -13px;
margin-top: -26px;
}
/* The snackbar - position it at the bottom and in the middle of the screen */
#DuplicateSuccessMessage {
visibility: hidden; /* Hidden by default. Visible on click */
opacity: 0.7;
filter: alpha(opacity=50); /* For IE8 and earlier */
min-width: 250px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #000; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 16px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 50%; /* Center the snackbar */
bottom: 50%; /* 30px from the bottom */
}
/* Show the snackbar when clicking on a button (class added with JavaScript) */
#DuplicateSuccessMessage.show {
visibility: visible; /* Show the snackbar */
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
However, delay the fade out process for 2.5 seconds */
-webkit-animation: fadein 0.5s, fadeout 0.5s 1.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
/* The snackbar - position it at the bottom and in the middle of the screen */
#errorMessage {
visibility: hidden; /* Hidden by default. Visible on click */
opacity: 1;
filter: alpha(opacity=50); /* For IE8 and earlier */
min-width: 250px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #f2dede; /* Black background color */
color: #a94442; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 16px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 50%; /* Center the snackbar */
bottom: 50%; /* 30px from the bottom */
}
/* Show the snackbar when clicking on a button (class added with JavaScript) */
#errorMessage.show {
visibility: visible; /* Show the snackbar */
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
However, delay the fade out process for 2.5 seconds */
-webkit-animation: fadein 0.5s, fadeout 0.5s 1.5s;
animation: fadein 0.5s, fadeout 0.5s 5s;
}
/* Animations to fade the snackbar in and out */
#-webkit-keyframes fadein {
from {bottom: 50%; opacity: 0;}
to {bottom: 50%; opacity: 0.7;}
}
#keyframes fadein {
from {bottom: 50%; opacity: 0;}
to {bottom: 50%; opacity: 0.7;}
}
#-webkit-keyframes fadeout {
from {bottom: 50%; opacity: 0.7;}
to {bottom: 50%; opacity: 0;}
}
#keyframes fadeout {
from {bottom: 50%; opacity: 0.7;}
to {bottom: 50%; opacity: 0;}
}
.ajax-loader {
visibility: hidden;
background-color: rgba(0,0,0,0.2);
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
}
.ajax-loader img {
position: relative;
top:50%;
left:50%;
}
.toggle{
background-color: #4285f4;
color: white;
padding: 5px;
border-radius: 5px;
border: 0;
margin-left: 18px;
}
#items{
list-style:none;
margin:0px;
margin-top:4px;
padding-left:10px;
padding-right:10px;
padding-bottom:3px;
font-size:17px;
color: #333333;
}
hr { width: 85%;
background-color:#E4E4E4;
border-color:#E4E4E4;
color:#E4E4E4;
}
#cntnr{
display:none;
position:fixed;
border:1px solid #B2B2B2;
width:180px;
background:#F9F9F9;
box-shadow: 3px 3px 2px #E9E9E9;
border-radius:4px;
}
#items li{
padding: 3px;
padding-left:10px;
}
#items :hover{
color: white;
background:#284570;
border-radius:2px;
}
Thank you,

Your can solve the issue by setting $("#cntnr").css({"left": e.pageX-3, "top": e.pageY-3}); so then mouse cursor will appear within the contextmenu and...
function setInputSelection(input, startPos, endPos) {
input.focus();
if (typeof input.selectionStart != "undefined") {
input.selectionStart = startPos;
input.selectionEnd = endPos;
} else if (document.selection && document.selection.createRange) {
// IE branch
input.select();
var range = document.selection.createRange();
range.collapse(true);
range.moveEnd("character", endPos);
range.moveStart("character", startPos);
range.select();
}
}
$("[id*='headline']").bind("contextmenu", function(e) {
e.preventDefault();
$("#cntnr").css({"left": e.pageX-3, "top": e.pageY-3});
$("#cntnr").fadeIn(200, startFocusOut);
});
function startFocusOut() {
$(document).on("click", function() {
$("#cntnr").hide();
$(document).off("click");
});
}
$("#items > li").click(function() {
$("#headline1").val($(this).text().replace("fallback", " "));
var input = document.getElementById("headline1");
setInputSelection(input, 9, 10);
});
#items {
list-style: none;
margin: 0px;
margin-top: 4px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 3px;
font-size: 17px;
color: #333333;
}
hr {
width: 85%;
background-color: #E4E4E4;
border-color: #E4E4E4;
color: #E4E4E4;
}
#cntnr {
display: none;
position: fixed;
border: 1px solid #B2B2B2;
width: 180px;
background: #F9F9F9;
box-shadow: 3px 3px 2px #E9E9E9;
border-radius: 4px;
}
li {
padding: 3px;
padding-left: 10px;
}
#items :hover {
color: white;
background: #284570;
border-radius: 2px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Demo<input id="headline11">
<div id='cntnr'>
<ul id='items'>
<li>{Keyword:fallback}</li>
<li>{KeyWord:fallback}</li>
</ul>
</div>

Related

How can I make a transition from left to right?

I wanted my button to change the background color on hover with a transition from left to right. This is what I tried:
.btn {
background-color: transparent;
transition-property: background-color, left, right;
transition-duration: 1s;
color: #007eb6;
border: 1px solid #007eb6;
&:hover {
background-color: #007eb6;
color: #fafafa;
border: 1px solid #007eb6;
}
Here is a codepen you can use (Its not mine)
The trick is to set background-position to 0% and on hover change it to 100%
<button>Bangladesh</button>
CSS Code
button {
background-color: red;
color: #fff;
border: none;
outline: none;
padding: 20px 60px;
font-size: 20px;
text-transform: uppercase;
position: relative;
z-index: 1;
cursor: pointer;
}
button::before {
content: "";
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 0;
background-color: green;
transition: .5s;
z-index: -1;
}
button:hover::before {
width: 100%;
}

How to put the left and right cursors off of the image in this image gallery

I want to have the next and back button cursor arrows be off of the image but currently they are on top of the image:
Here is the code for the body:
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Verdana, sans-serif;
margin: 0;
}
* {
box-sizing: border-box;
}
.row > .column {
padding: 0 2px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
float: left;
width: 25%;
}
/* The Modal (background) */
.modal {
display: none;
position: fixed;
z-index: 1;
padding-top: 50px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: white;
}
/* Modal Content */
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
width: 55%;
max-width: 2000px;
}
/* The Close Button */
.close {
color: white;
position: absolute;
top: 10px;
right: 25px;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #999;
text-decoration: none;
cursor: pointer;
}
.mySlides {
display: none;
}
.cursor {
cursor: pointer
}
/* Next & previous buttons */
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: -20px;
margin-top: -50px;
color: black;
font-weight: bold;
font-size: 100px;
transition: 0.8s ease;
border-radius: 0 3px 3px 0;
user-select: none;
-webkit-user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a black background color with a little bit see-through */
.prev:hover,
.next:hover {
background-color: white;
}
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
img {
margin-bottom: -10px;
}
.caption-container {
text-align: center;
background-color: white;
padding: 2px 16px;
color: black;
}
.demo {
opacity: 0.6;
}
.active,
.demo:hover {
opacity: 1;
}
img.hover-shadow {
transition: 0.3s
}
.hover-shadow:hover {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)
}
</style>
<body>
Pleas help
Thank you
You'll have to access the .prev and .next classes and play around with the leftand right attributes to move them to the left and right respectively.
You'll end up with something like:
.prev {
left: -50px;
}
.next {
right: 50px;
}

How to center arrow on post carousel

My post carousel has two arrows on the side. I have a background in the shape of a circle for these arrows. I can't figure out how to center the arrows inside the circles. Does anyone know how I could do this. Here is the link to a screenshot of what it currently looks like -
Here is my css
/*
* Owl Carousel Owl Demo Theme
* v1.3.3
*/
.owl-theme .owl-controls{
margin-top: 50px;
text-align: center;
}
/* Styling Next and Prev buttons */
.owl-theme .owl-controls .owl-buttons div{
color: #FFF;
display: inline-block;
zoom: 1;
*display: inline;/*IE7 life-saver */
margin: 5px;
padding: 3px 10px;
font-size: 12px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
background: #869791;
filter: Alpha(Opacity=50);/*IE7 fix*/
opacity: 0.5;
}
/* Clickable class fix problem with hover on touch devices */
/* Use it for non-touch hover action */
.owl-theme .owl-controls.clickable .owl-buttons div:hover{
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
text-decoration: none;
}
/* Styling Pagination*/
.owl-theme .owl-controls .owl-page{
display: inline-block;
zoom: 1;
*display: inline;/*IE7 life-saver */
}
.owl-theme .owl-controls .owl-page span{
display: block;
width: 12px;
height: 12px;
margin: 5px 7px;
filter: Alpha(Opacity=50);/*IE7 fix*/
opacity: 0.5;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
background: #869791;
}
.owl-theme .owl-controls .owl-page.active span,
.owl-theme .owl-controls.clickable .owl-page:hover span{
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
}
/* If PaginationNumbers is true */
.owl-theme .owl-controls .owl-page span.owl-numbers{
height: auto;
width: auto;
color: #FFF;
padding: 2px 10px;
font-size: 12px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
}
/* preloading images */
.owl-item.loading{
min-height: 150px;
background: url(AjaxLoader.gif) no-repeat center center
}
/* Navigation */
.owl-prev, .owl-next {
position:absolute;
top:45%;
padding: 5px;
margin:0;
z-index:100;
font-size:3rem;
cursor:pointer;
color:#000000;
}
.owl-prev {
left:20px;
opacity: 1 !important;
}
.owl-next {
right:20px;
opacity: 1 !important;
display: block;
}
.owl-theme .owl-controls .owl-buttons div{
color: #555;
display: inline-block;
zoom: 1;
*display: inline;/*IE7 life-saver */
font-size: 3rem;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #ffffff;
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
margin-top:-32px;
width:40px;
height:40px;
}
.owl-theme .owl-controls .owl-buttons div:hover {
color:#000000;
opacity: 1 !important;
}
Without your markup, it's a bit of an educated guess, but after looking at the owl carousel demo, I believe I can help.
The elements are addressed in this CSS (from your question):
.owl-theme .owl-controls .owl-buttons div {
color: #555;
display: inline-block;
/* remove this! */
zoom: 1;
/* and this! */
*display: inline;/*IE7 life-saver */
font-size: 3rem;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #ffffff;
/* and remove this! */
filter: Alpha(Opacity=100);/*IE7 fix*/
opacity: 1;
margin-top:-32px;
width:40px;
height:40px;
}
Assuming that your arrows are text and not images, then all you need to do is add line-height to your css:
line-height: 40px; /* adjust as needed */
NOTE, if you're supporting IE7, I would recommend you stop. IE7 has been dead for some time, and is not worth the effort.
Modified CSS to vertically center the arrows:
.owl-theme .owl-controls .owl-buttons div {
color: #555;
display: inline-block;
font-size: 3rem;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #ffffff;
opacity: 1;
margin-top:-32px;
width:40px;
height:40px;
line-height: 40px; /* adjust as needed */
/* may or may not need this */
text-align: center;
}
Also note that your CSS could be simplified - your owl-prev and owl-next CSS is the same / conflicting with the .owl-theme .owl-controls .owl-buttons div css.

CSS Tooltip - Conversion from SCSS not working

I am trying to get a CSS tooltip to work correctly which I found on the thoughtbot blog. The only changes that I have made to the code is to change from Scss to CSS, and simplify the html a touch. However, when in CSS, it doesnt work.
The original article can be found here, where there is also a working codepen that I copied as the basis for my CSS version https://robots.thoughtbot.com/you-don-t-need-javascript-for-that
.container {
margin-top: 100px;
margin-left: 100px;
border: 2px solid red;
}
/* //The good stuff */
.tooltip-toggle {
cursor: pointer;
position: relative;
}
/* //Tooltip text container */
.tooltip-toggle::before {
position: absolute;
top: -80px;
left: -80px;
background-color: #2B222A;
border-radius: 5px;
color: #fff;
content: attr(data-tooltip);
padding: 1rem;
text-transform: none;
transition: all 0.5s ease;
width: 160px;
}
/*
//Tooltip arrow */
.tooltip-toggle::after {
position: absolute;
top: -12px;
left: 9px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #2B222A;
content: " ";
font-size: 0;
line-height: 0;
margin-left: -5px;
width: 0;
}
.tooltip-toggle::before {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
.tooltip-toggle::after {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
/* //Triggering the transition */
.tooltip-toogle:hover::before {
opacity: 1;
transition: all 0.75s ease;
}
.tooltip-toggle:hover::after {
opacity: 1;
transition: all 0.75s ease;
}
Below is my html.
<html>
<body>
<div class="container tooltip-toggle" data-tooltip="Sample text for your tooltip!>
<div class="label">Hello
</div>
</div>
</body>
</html>
So, I laughed very hard when I figured your problem out:
/* //Triggering the transition */
.tooltip-toogle:hover::before {
opacity: 1;
transition: all 0.75s ease;
}
.tooltip-toogle:hover
Obviously should be toggle, lol.
Edit: cleaned css and fixed it
.container {
margin-top: 100px;
margin-left: 100px;
border: 2px solid red;
}
/* The good stuff */
.tooltip-toggle {
cursor: pointer;
position: relative;
}
/* Tooltip text container */
.tooltip-toggle::before {
position: absolute;
top: -80px;
left: -80px;
background-color: #2B222A;
border-radius: 5px;
color: #fff;
content: attr(data-tooltip);
padding: 1rem;
text-transform: none;
transition: all 0.5s ease;
width: 160px;
}
/* Tooltip arrow */
.tooltip-toggle::after {
position: absolute;
top: -12px;
left: 9px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #2B222A;
content: " ";
font-size: 0;
line-height: 0;
margin-left: -5px;
width: 0;
}
.tooltip-toggle::before, .tooltip-toggle::after {
color: #efefef;
font-family: monospace;
font-size: 16px;
opacity: 0;
pointer-events: none;
text-align: center;
}
/* Triggering the transition */
.tooltip-toogle:hover::before, .tooltip-toggle:hover::after {
opacity: 1;
transition: all 0.75s ease;
}

Target CSS transition at pseudo-element "Arrow"?

I have a DIV with an "arrow" at the bottom, not unlike a speech bubble from a comic book, which appears on the hover state:
The arrow is created with the :after and :before pseudo elements.
I have a transition for the hover for the border color and the box shadow.
My problem is that the "arrow" just "appears". No fade like the other items, but I can't figure out how to target the "arrow". "All" does not look right either.
Ideally, I'd love to have a delay on the arrow and a simple fade or wipe.
Here's the CSS:
.item-selector-button {
position: relative;
text-align: center;
cursor: pointer;
border: 1px solid #cecece;
padding: 15px;
border-radius: 0;
color: #000;
width: 160px;
height: 120px;
transition: all ease-in-out 0.1s, box-shadow ease-in-out 0.1s;
}
.item-selector-button .title {
color: #3e53a4;
font-size: 12px;
margin: 0;
padding-top: -3px;
font-family: "PrecisionSans_W_Md", "Helvetica Neue", Arial, sans-serif;
}
.item-selector-button .divider {
height: 1px;
width: 20px;
background-color: #cecece;
margin: 4px auto 10px;
}
.item-selector-button .image {
background: #fff url("../images/box.png") center center no-repeat;
width: 64px;
height: 57px;
margin: 4px auto;
}
.item-selector-button:hover, .item-selector-button.hover {
padding: 14px;
}
.item-selector-button:hover:after, .item-selector-button.hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #fff transparent;
transition-delay: 0.3s;
}
.item-selector-button:hover:before, .item-selector-button.hover:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active, .item-selector-button.active {
border-width: 2px;
border-color: #3e53a4;
background-color: #3e53a4;
}
.item-selector-button:active:before, .item-selector-button.active:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active .title, .item-selector-button.active .title {
color: #fff;
}
.item-selector-button:active .divider, .item-selector-button.active .divider {
background-color: #fff;
}
.item-selector-button:active .image, .item-selector-button.active .image {
background-color: #3e53a4;
}
.item-selector-button:active:hover, .item-selector-button.active:hover {
padding: 15px;
box-shadow: none;
}
.item-selector-button:active:hover:after, .item-selector-button.active:hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button.disabled {
pointer-events: none;
cursor: not-allowed;
}
.item-selector-button.disabled .title {
color: #c3c3c3;
}
.item-selector-button.disabled .image {
background-image: url("../images/box-disabled.png");
}
.item-selector-button.disabled:hover {
padding: 15px;
border: 1px solid #cecece;
box-shadow: none;
}
You only have pseudoelements on the hovered element, so there is nothing to transition from/to. You need to add the pseudo elements on the non-hover state element.
Example transitioning visibility:
.item-selector-button:before {
.arrow-inside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:after {
.arrow-outside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:hover:before {
visibility:visible;
}
.item-selector-button:hover:after {
visibility:visible;
}

Resources