Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I have created a separate CSS file for a tool tip as below.
.help-tip{
position: absolute;
top: 18px;
right: 18px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p{
display: none;
text-align: left;
background-color: #1E2021;
padding: 20px;
width: 300px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before{
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
From this file calling the .help-tipclass from that in html file as below. I am expecting the tool tip to be shown which is not happening as expected. Earlier I had written css code in same html file under style section but then moved css code to separate file.
<div class="domtooltip_style.help-tip">
<p><b>Deal-O-Matic (DOM)</b> has implemented multiple controls and safeguards for deal creation to ensure deal quality and to ensure that automatically created deals meet retail teams’ business requirements.<br>
<b>Contribution Profit (CP) Check</b>: DOM ensures that Deals created automatically are CP positive through the duration of the deal and ends deals that turned CP negative.</p>
</div>
Appreciate if someone can correct me to call class from CSS file in HTML file.
Inside the html you separate multiple classes with a space
so use
<div class="domtooltip_style help-tip">
Related
I have try add to my website script with help tip. I want change position hover effect because now is wrong. Anyone help me how can I to do?
Here I add screen with Currently effect:
here I paste +/- expected result:
.help-tip{
position: absolute;
top: 55px;
right: 11px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p{ /* The tooltip */
display: none;
text-align: left;
background-color: #1E2021;
padding: 60px;
width: 300px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before{ /* The pointer of the tooltip */
position: absolute;
content: '';
width:0;
height: 0;
border:6px solid transparent;
border-bottom-color:#1E2021;
right:10px;
top:-12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
</style>
<div class="help-tip">
<p>MSRP - Sugerowana cena sprzedaży przez producenta</p>
</div>
Anyone provide any solution?
I can put this topic because system return error:
It looks like your post is mostly code; please add some more details.
Just change css for .help-tip p and .help-tip p:before
.help-tip{
position: absolute;
top: 55px;
right: 11px;
text-align: center;
background-color: #BCDBEA;
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 14px;
line-height: 26px;
cursor: default;
}
.help-tip:before{
content:'?';
font-weight: bold;
color:#fff;
}
.help-tip:hover p{
display:block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip p {
display: none;
text-align: left;
background-color: #1E2021;
padding: 10px;
width: 300px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
right: -4px;
top: -60px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip p:before {
position: absolute;
content: '';
width: 0;
height: 0;
transform: rotate(178deg);
border: 6px solid transparent;
border-bottom-color: #1E2021;
right: 10px;
bottom: -12px;
}
.help-tip p:after{ /* Prevents the tooltip from being hidden */
width:100%;
height:40px;
content:'';
position: absolute;
top:-40px;
left:0;
}
/* CSS animation */
#-webkit-keyframes fadeIn {
0% {
opacity:0;
transform: scale(0.6);
}
100% {
opacity:100%;
transform: scale(1);
}
}
#keyframes fadeIn {
0% { opacity:0; }
100% { opacity:100%; }
}
</style>
<div class="help-tip">
<p>MSRP - Sugerowana cena sprzedaży przez producenta</p>
</div>
You can change this by changing the absolute positioning of the tooltip.
You need to move the tooltip above the question mark, and flip the pointer of the tooltip. This code should fix it:
.help-tip p {
bottom: 30px;
}
.help-tip p:before {
right: 10px;
bottom: -12px;
transform: rotate(180deg);
}
It will move the tooltip above the question. I've added the code to alter the :before so that the pointer is below, not above, and then rotated it.
I'll get straight to the point. What I want to do is to create simple text, such as: © 2017, that will change (on hover) to developed by Jonathan Doe. I want activation field to be smaller than the deactivation field but the problem is that hitbox for the © 2017 is the size of hidden element.
I was looking for the solution on the internet for quite some time but everything that I found, was button with not flexible width. Maybe I need to use some sort of tooltip, that will cover passive state? I am not sure.
I want this element to float in the bottom left cornet of the site, that's why I set position to fixed.
The other problem is that when text developed by Jonathan Doe is active, deactivation field is bigger on top than it should be. It looks like elements with 0 opacity are messing up my hitboxes. I was trying to play with display: none;, but then animation is not playing.
I started to code literally yesterday, so please forgive me for all the noob mistakes. I am trying to understand the logic behind all of this.
I've added the piece of code, I hope I did it right.
.con {
position: fixed;
font-weight: normal;
color: #000000;
font-family: 'Roboto', sans-serif;
z-index: 99;
}
/* © 2017 */
.con.copyright:before {
position: fixed;
padding: 9px 16px 7px 16px;
bottom: 16px;
left: 16px;
font-size: 14px;
line-height: 26px;
text-align: left;
content: '© 2017';
opacity: 1;
transition: all 0.3s cubic-bezier(.64, 0, .36, 1);
}
.con.copyright:hover:before {
opacity: 0;
bottom: 32px;
}
.con.copyright:after {
position: fixed;
padding: 9px 16px 7px 16px;
bottom: 0px;
left: 16px;
font-size: 14px;
line-height: 26px;
text-align: left;
content: 'developed by Jonathan Doe';
opacity: 0;
transition: all 0.3s cubic-bezier(.64, 0, .36, 1);
}
.con.copyright:hover:after {
opacity: 1;
bottom: 16px;
}
<div class="con copyright"></div>
I do not like how you can keep developed by Jonathan Doe text active by quickly moving your mouse over it.
It took me few additional days but I think I've finally did this. Hitboxes are perfect. The only one problem now is that for some unknown reason, text is not antialiased. I was playing with some values but nothing helped.
EDIT: I've came out with better version. Less messy and with working antyaliasing.
Here is the new version - maybe some beginner like myself will find this useful. I will update it if I discover anything new:
EDIT: I've: • added transition-delay and reversed it so that effect is properly played on "mouseout"
EDIT: I've: • replaced visibility: hidden; with pointer-events: none; because with greater transform: translateY values "mouseout" was glitchy • split transition: all to transition: transform, opacity and removed transition-delay to get better control over delays
EDIT: Minor adjustments for better UX
* {
box-sizing: border-box;
}
/* copyright */
.copyright {
position: fixed;
color: #000000;
font-family: 'Roboto', sans-serif;
font-size: 14px;
left: 16px;
top: 16px;
text-align: left;
width: 78px;
height: 42px;
z-index: 10;
}
.copyright:before {
pointer-events: none;
position: absolute;
display: block;
top: 13px;
left: 16px;
opacity: 1;
content: '© 2017';
transform: translateY(0px);
transition: transform .24s 0s ease, opacity .16s .08s ease;
}
.copyright:hover:before {
transform: translateY(-24px);
transition: transform .24s 0s ease, opacity .16s 0s ease;
opacity: 0;
}
.copyright_ch {
position: absolute;
opacity: 0;
padding: 13px 0px 0px 16px;
top: 0px;
left: 0px;
pointer-events: none;
width: 205px;
transition: transform .24s 0s ease, opacity .16s 0s ease;
height: 100%;
transform: translateY(24px);
}
.copyright:hover .copyright_ch {
opacity: 1;
pointer-events: auto;
transform: translateY(0px);
transition: transform .24s 0s ease, opacity .16s .08s ease
}
<div class="copyright"><div class="copyright_ch">developed by Jonathan Doe</div></div>
note: This is not really a flexible solution. If you would like to change inscriptions, font size, hitboxes etc., you will have to change and adjust values manually. To get a good look at current hitboxes add background-color: #cccccc; to .copyright and .copyright_ch classes. You might also want to play with opacity: 0/1 so that you can see what you are working with.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
all I want is a css spinner inside which I could put a image and on resizing it it gets small but am unable to get it.
here is the example http://www.hamsterwheelengineer.xyz/
Luckily for you, I was bored so I spent some time putting it together for you. :) J/K. Next time, show us what you've worked on so far
HTML
<div class="image">
<img src="http://www.ymmaa.com/wp-content/uploads/2015/02/logo155.png"/>
<div class="spin spinner"></div>
</div>
CSS
.image {
position: absolute;
}
.image img {
position: absolute;
top: 25%;
left: 26%;
}
.spin {
position: relative;
display: inline-block;
width: 350px;
height: 350px;
border: 2px solid #34495e;
border-radius: 100%;
animation: spin 0.75s infinite linear;
}
.spin::before,
.spin::after {
left: -2px;
top: -2px;
display: none;
position: absolute;
content: '';
width: inherit;
height: inherit;
border: inherit;
border-radius: inherit;
}
#keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.spinner,
.spinner::before,
.spinner::after {
display: inline-block;
border-color: transparent;
border-top-color: red;
animation-duration: 1.2s;
}
.spinner::before {
transform: rotate(120deg);
}
.spinner::after {
transform: rotate(240deg);
}
#media (max-width:480px) {
.spin {
width: 270px;
height: 270px;
}
.image img {
position: absolute;
top: 19%;
left: 21%;
}
}
<div class="image">
<img src="http://www.ymmaa.com/wp-content/uploads/2015/02/logo155.png" />
<div class="spin spinner"></div>
</div>
This question already has answers here:
Bigger area for hovering multiple small circles
(3 answers)
Closed 7 years ago.
I have a page with little elements with border-radius set to 50%, so they show up as little dots:
CSS:
.star {
width: 5px;
height: 5px;
background-color: rgb(236, 236, 236);
position: absolute;
border-radius: 50%;
transform: scale(1);
display: block;
transition: 0.25s ease-in background-color, 0.25s ease-in opacity, 0.25s ease-out transform;
cursor: pointer;
}
Each of these has a hover action that brings up a certain pop-up. Now however, there's an issue where hovering (at least in the browsers I've tested for) is a game of find the pixel.
Is there a "trick" to add an invisible border or so to the dots to make them more selectable without hunting for pixels?
Setting border to say 2px solid transparent just makes the circles bigger in my tests, and CSS outline does not produce a :hover state or mouseenter event.
Use a pseudo-element to increase the "hit area"
body {
background: #000;
}
.star {
width: 5px;
height: 5px;
background-color: rgb(236, 236, 236);
position: absolute;
left: 50%;
top: 50%;
border-radius: 50%;
transform: scale(1);
display: block;
transition: 0.25s ease-in background-color, 0.25s ease-in opacity, 0.25s ease-out transform;
cursor: pointer;
}
.star::before {
content: '';
position: absolute;
border-radius: 50%;
width: 500%;
height: 500%;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index:-1;
border:1px solid green; /* for demo purposes */
}
.star:hover {
background: #f00;
}
<div class="star"></div>
Try this:
.star {
width: 10px;
height: 10px;
padding:10px;
background:#000;
border-radius:50%;
background-clip:content-box; /* <- key point*/
}
.star:hover { background-color:#f00; }
<div class="star"></div>
Increased padding will give you larger hit margins.
Your transparent border method is fine and works the best in all browsers ;)
Just add:
background-clip: padding-box;
To make sure the background does not show under the borders.
Add circle under each star and give it a black background ex;
<div class="starWrapper">
<div class="star"></div>
</div>
.star { top:3px;
left:3px;
width: 5px;
height: 5px;
background-color: rgb(236, 236, 236);
position: absolute;
border-radius: 50%;
transform: scale(1);
display: block;
cursor: pointer;}
.startWrapper{
position:absolute;
background:#000;
width:8px;
height:8px;
border-radius: 50%;}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm trying to get a background image to rotate when I hover over it. But at the same time I want some link text over top of the picture to NOT rotate.
I have it semi working, but when the image rotates the text get's hidden behind it. and sometimes you will hover over the link, and the image doesn't rotate. Is there a way to accomplish this?
JS Fiddle: http://bit.ly/1b9bpiJ
Dev Site: http://briggs.honeycombsites.com/
A slight modification to the excellent answer of Zeaklous.
To avoid the counter-rotation of the text, do not rotate the base div. Place the background in a pseudo element and rotate this.
div.button {
width:130px;
height:130px;
position:relative;
float: left;
margin-right: 20px;
overflow:hidden;
}
div.button:after {
content: "";
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
background: url('http://briggs.honeycombsites.com//wp-content/themes/briggs/images/btn_contact.png');
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
-o-transition-duration: 0.5s;
transition-duration: 0.5s;
z-index: -1;
}
.button:hover:after {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-o-transform:rotate(360deg);
}
div.button a {
color: #CFCAB4;
font-size: 24px;
line-height: 26px;
text-align: center;
text-shadow: 1px 1px 1px #333333;
width: 100%; height:80%;
text-transform: uppercase;
position:absolute;
top:50%; margin-top:-40%;
left:50%; margin-left:-50%;
}
div.button:hover a {
color: #fff;
}
div.button a span {
border-bottom: 1px solid #CFCAB4;
display: inline-block;
font-size: 12px;
line-height: normal;
margin-bottom: 7px;
text-shadow: none;
}
updated demo
In the above answer, I forgot the unprefied transform in the after
.button:hover:after {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-o-transform:rotate(360deg);
transform:rotate(360deg);
}
Also, for some reason, the design breaks in firefox and IE; the font of the span needs to be set a little bit higher:
edited demo
I understand why you set up your code this way, but transform has some interesting unintentional effects at times. In your case it's affecting the z-index somehow and I'm not sure exactly how to fix it
With that being said, here's how I'd do it, which is simpler to me. It involves putting the text inside the rotating element, but rotating the text in the opposite direction at the same time in order to keep it upright
/* Updated HTML */
<div class="button">
<span>Contact Us</span>1.800 444.1515
</div>
/* CSS */
div.button {
width:130px;
height:130px;
position:relative;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
-o-transition-duration: 0.5s;
transition-duration: 0.5s;
float: left;
margin-right: 20px;
overflow:hidden;
background: url('wp-content/themes/briggs/images/btn_contact.png');
}
div.button:hover {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-o-transform:rotate(360deg);
}
div.button a {
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
-o-transition-duration: 0.5s;
transition-duration: 0.5s;
color: #CFCAB4;
font-size: 24px;
line-height: 26px;
text-align: center;
text-shadow: 1px 1px 1px #333333;
width: 100%; height:80%;
text-transform: uppercase;
position:absolute;
top:50%; margin-top:-40%;
left:50%; margin-left:-50%;
}
div.button:hover a {
color: #fff;
-webkit-transform:rotate(-360deg);
-moz-transform:rotate(-360deg);
-o-transform:rotate(-360deg);
}
div.button a span {
border-bottom: 1px solid #CFCAB4;
display: inline-block;
font-size: 12px;
line-height: normal;
margin-bottom: 7px;
text-shadow: none;
}
Demo here
Let me know if you have any questions about my method