I'm using Word Press with Mikado theme and have created a widget for a button the code for the button is in html. However, when I go to additional css under appearance and enter my css the link stops working. The html works (link wise) until I use the css. Any thoughts?
.wp-block-button {
position: relative;
height: 20px;
line-height: 20px;
text-align: center;
transition: 0s;
padding: 20px 20px;
cursor: pointer;
transition: 0s;
}
.wp-block-button {
background-color: transparent!important;
border-color: transparent!important;
color: #000000!important;
}
.wp-block-button:hover:before {
transition-delay: 0s;
}
.wp-block-button:before {
width: 0%;
height: 100%;
z-index: 3;
content: '';
position: absolute;
bottom: .1em;
left: 2em;
box-sizing: border-box;
transition: 0s;
}
.wp-block-button:hover:before {
width: 80% !important;
transition: 0s;
}
.wp-block-button:before {
border-bottom: 3px solid #59629a!important;
}
<div class="wp-block-button has-custom-width wp-block-button__width-100 has-custom-font-size is-style-outline" style="font-size:18px">
<a class="wp-block-button__link has-white-color has-text-color has-background wp-element-button" href="https://rothgrouplaw.com/new-client-intake-form/" style="border-radius:0px;background-color:#111e6e">Schedule Your Free Evaluation
</a>
</div>
Try taking out the position: relative; from the .wp-block-button class. I think that is your problem.
So, I have a div that appears at the top of my screen, and when you hover over it, at the bottom of the screen, text appears.
I want to add another effect to the div that makes more text appear in a completely different place on the screen, while the other text stays in the same place.
Is that possible? Preferably using CSS/HTML instead of Java or anything?
You can use ~ (tilde) operator to target all your siblings (all should have the same parent) show on hover. Please have a look at the example snippet below:
body { margin: 0; }
.holder {
text-align: center;
height: 100vh;
}
.hover {
position: absolute;
top: 10%;
left: 50%;
transform: translateX(-50%);
color: red;
font-size: 30px;
font-weight: bold;
border: 2px solid red;
padding: 10px 15px;
cursor: default;
transition: all .2s linear;
}
.hover:hover {
background: rgba(255, 0, 0, 0.1);
}
.hover:hover ~ .show-text {
opacity: 1;
transition: all .2s linear;
}
.show-text {
position: absolute;
opacity: 0;
font-size: 20px;
border-bottom: 1px solid #aaa;
transition: all .2s linear;
}
.one {
bottom: 20%;
left: 20%;
}
.two {
bottom: 20%;
right: 20%;
}
<div class="holder">
<div class="hover">Hover Me!</div>
<div class="show-text one">I'm Text 1</div>
<div class="show-text two">I'm Text 2</div>
</div>
Hope this helps!
I want this effect for my image.
I implemented it but I have anchor at the place of figure and when I hover on image I should able to click on it and it should redirect. Will we achieve it?
I use the following code for the hover effect:
.tint {
position: relative;
float: left;
margin-right: 20px;
margin-bottom: 20px;
cursor: pointer;
box-shadow: rgba(0,0,0,.2) 3px 5px 5px;
}
.tint:before {
content: "";
display: block;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: none;
transition: all .3s linear;
}
.tint:hover:before { background: rgba(0,0,255, 0.5); }
If I remove position:absolute, the link starts working but then the hover effect is gone.
Please help me with this if anybody has any solution for this.
Thanks in advance.
you can try something by the meanings of this code:
<div>
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<div class="mask">
</div>
</div>
<style>
.mask { position: absolute;
height: 100%;
width: 100%;
transition: all 0.6s ease;
left: 0;
top: 0;
background-color: #0af;
opacity: 0;
}
.mask:hover {
background-color: #0af;
opacity: 0.3;
}
</style>
My CSS transition suddenly stops as shown in the following image
This only happens on Chrome, on Firefox everything works normally, other than that I cannot test.
The interesting thing is not only that the transition stops for no reason, but is that once I right-click on a button with this class, it works normally for the rest of the browsing session.
The following image is what the button looks like when the working transition ends:
HTML and CSS code
.main-link{
position: relative;
display: block;
overflow: hidden;
width: 200px;
height: auto;
color: #FFF;
text-align: center;
text-decoration: none;
border: 2px solid #53c1f8;
}
.main-link::after {
position: absolute;
overflow: none;
content: "";
background: #53c1f8;
left: 50%;
top: 50%;
height: 0%;
width: 100%;
z-index: -1;
transition: 0.75s ease-in-out;
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.main-link:hover::after {
height: 15em;
}
<body>
<div id='main'>
<div id='content'>
<div id='main-image'>
<div id='main-image-intro'>
<ul id='main-image-cto'>
<li>
<a href='subscribe.html' class='main-link'> GET STARTED </a>
</li>
<li>
<a href='subscribe.html' class='main-link'> GIFT IT </a>
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
Tested under Ubuntu 15.10:
Chromium 47.0.2526.73
Mozilla Firefox 43.0.4
Edit:
I completely changed my answer. Think this should work in any modern browser and be a more save option.
a.button {
color: black;
height: 50px;
width: 200px;
border: 2px solid black;
padding: 10px 30px;
text-decoration: none;
font-family: Helvetica;
position: relative;
display: inline-block;
line-height: 50px;
text-align: center;
transition: color 0.2s ease-out;
overflow: hidden;
}
a.button:after {
position: absolute;
content: '';
background-color: black;
height: 100%;
width: 1px;
left: 65%;
top: 0;
z-index: -1;
transition: transform 0.4s ease-out;
transform: skew(45deg) scale(0,1);
margin-left: -20%;
}
a.button:hover {
color: white;
}
a.button:hover:after {
width: 1px;
background-color: black;
transform: skew(45deg) scale(400, 1);
}
<a class="button" href="">Button</a>
On a webpage I am working on, I have a div which contains an image and another div. The inner div is initially set to
opacity: 0;
so that it's not visible. The inner div should appear over my image when hovered. I have achieved this, but now I want to improve upon it further by having the 'overlay' div (which appears with an opacity of 0.5) slide down gradually over the image. I could do it theoretically with JavaScript but on this occasion it must be a pure CSS solution. So far my solution just makes the overlay div appear gradually (it fades in) but does not slide down as I have never done this in CSS alone.
See the image below to understand further:
The HTML:
<div class="img"> <img class="squareImg" src="img1.jpg"/><div class="overlay"> tweet This <br> Buy This</div></div>
<div class="img"> <img class="squareImg" src="img3.jpg"/></div>
<div class="img"> </img></div>
CSS
.overlay{
position: absolute;
width: 200px;
overflow-y: hidden;
transition-property: all;
transition-duration: .5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
height: 200px;
background-color: red;
border: 1px solid white;
top: 10px;
left: 10px;
opacity: 0;
} .overlay:hover{
cursor:pointer;
opacity: 0.5;
z-index: 1;
}
.img{
position: relative;
margin-bottom: 10px;
border: 2px solid yellow;
background-color: black;
width: 200px;
height: 200px;
left: 50%;
margin-left: -110px;
padding: 10px;
}
Here it is with a slide down thanks to a height transition.
Improvements:
Instead of opacity, use background: rgba(255,0,0,0.5) so that the contents of the overlay remain fully opaque.
The transition property has been simplified to transition: all .5s
The outside border is created with box-shadow and the black border is now created with the border property instead of padding.
.overlay has a height of 0 and on hover it is given a height of 100%. It is stretched accross the image with the combination of left: 0 and right: 0
There is no set image size, the size of the <img> now controls the size of the border and overlay, allowing different image sizes.
Complete Example
.img {
position: relative;
border: 10px solid black;
box-shadow: 0 0 0 2px yellow;
display: inline-block;
vertical-align: top;
cursor: pointer;
margin: 10px;
}
.overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
transition: all .5s;
overflow: hidden;
height: 0;
background: rgba(255, 0, 0, 0);
}
.img:hover .overlay,
.overlay:hover {
height: 100%;
background: rgba(255, 0, 0, 0.5);
}
.img > img {
display: block;/* Prevent inline gap under image*/
}
<div class="img">
<img src="http://www.placehold.it/200" />
<div class="overlay">tweet This <br>Buy This</div>
</div>
<div class="img">
<img src="http://www.placehold.it/300" />
<div class="overlay">tweet This <br>Buy This</div>
</div>
You can just use simple transitions for this, rather than a keyframe animation
Example:
http://jsfiddle.net/realseanp/c4e08hy7/9/
HTML:
<div class="holder">
<div class="info">
<span>All your info</span>
<div class="overlay"></div>
</div>
</div>
CSS:
.holder{
position:relative;
height:200px;
width: 200px;
overflow: hidden;
border:1px solid #000;
z-index:3;
}
.info {
box-sizing: border-box;
height: 100%;
padding: 20px;
position: absolute;
top: -100%;
transition: top 0.5s ease 0s;
width: 100%;
z-index: 4;
}
.overlay {
background: none repeat scroll 0 0 #000;
height: 100%;
left: 0;
opacity: 0;
position: absolute;
top: 0;
width: 100%;
z-index: -1;
transition: 1s all;
}
.holder:hover .info{
top:0;
}
.holder:hover .overlay{
opacity: .85
}
Just a simple approach using the image as background:
.img{
position: relative;
background: none 50% / cover;
width: 200px;
height: 200px;
margin: 0 auto;
border: 10px solid #000;
box-shadow: 0 0 0 2px yellow;
}
.overlay{
position: absolute;
width: 100%;
height: 0%;
overflow: hidden;
transition: all .5s cubic-bezier(0, 1, 0.5, 1);
box-shadow: inset 0 0 0 1px white;
background: rgba(255,0,0,0.4); /* Don't use opacity but rgba on bg */
}
.img:hover .overlay{
height: 100%;
}
<div class="img" style="background-image:url(//placehold.it/300x300/aba)">
<div class="overlay">Tweet This <br> Buy This</div>
</div>
If you need to slide it down, you should use #keyframes:
.overlay:hover{
-webkit-animation: slide 5s; /* Chrome, Safari, Opera */
animation: slide 5s;
}
#keyframes slide {
from {height: 0px;}
to {height: 200px;}
}
/* Chrome, Safari, Opera */
#-webkit-keyframes slide {
from {height: 0px;}
to {height: 200px;}
}
You can achieve this by setting the .overlay with a negative top position and then you can target the sibling element with the + selector and change the top position to positive.
Also you can change the transition timing by setting the transition-duration: 2s; to 2 sec.
.overlay{
position: absolute;
width: 200px;
overflow-y: hidden;
transition-property: all;
transition-duration: 2s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
height: 200px;
background-color: red;
border: 1px solid white;
top: -200px;
left: 10px;
opacity: 0;
z-index:-1;
}
.squareImg:hover + .overlay, .overlay:hover {
cursor:pointer;
top:10px;
opacity: 0.5;
z-index: 1;
}
.img{
position:relative;
height:200px;
width: 200px;
overflow: hidden;
border:1px solid #000;
z-index:3;
margin-bottom: 10px;
border: 2px solid yellow;
background-color: black;
left: 50%;
margin-left: -110px;
padding: 10px;
}
DEMO http://jsfiddle.net/a_incarnati/c4e08hy7/8/