Change text on hover, CSS and html - html

I want to change the text when hovering over a speechbubble (already created) and set the text back when the mouse goes back. I have a "Welcome!" text set on the speechbubble and I want it to change to "Scroll down". The other issue is that I have set a css transformation on the speechbubble+welcome so that makes it harder..
Here's my code:
#welcome{
position:absolute;
top:50%;
left:50%;
width:auto;
height:auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left:110px;
width: 230px;
height: 80px;
line-height:80px;
text-align:center;
font-size:15px;
letter-spacing:2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family:{select:Title Font};
background: {color:Welcome background};
color:{color:Welcome text};
position: relative;
font-weight:bold;
}
#speechbubble:before {
content:"";
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble">Welcome!</div>
I've tried some tricks like adding a div for the second text and setting a css hover but it didn't work.. Can anyone help me? Thanks

You can use pseudo class :after and change its content on hover.
Like this:
#welcome {
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left: 110px;
width: 230px;
height: 80px;
line-height: 80px;
text-align: center;
font-size: 15px;
letter-spacing: 2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family: {
select: Title Font
}
;
background: {
color: Welcome background
}
;
color: {
color: Welcome text
}
;
position: relative;
font-weight:bold;
}
#speechbubble:after {
content: "Welcome!";
}
#speechbubble:before {
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {
color: Welcome background
}
;
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble:after {
content: "Scroll Down";
}
#welcome:hover #speechbubble {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left: 120px;
}
#welcome #speechbubble {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble"></div>

Using :after & :before try this, add this to your css:
#welcome:hover #speechbubble:after {
content: "Scroll Down";
}
#welcome:hover #speechbubble:before {
content: "";
}
#speechbubble:before {
content: "Welcome!";
}
then remove this right,top and position from your css:
#speechbubble:before {
content:"";
/*position: absolute;*/
/*right: 100%;*/
/*top: 26px;*/
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
also remove the word Welcome:
<div id="welcome">
<div id="speechbubble"></div>
now this is the magic of CSS :)

Here is an example code using pseduo elements with data- attributes to
achieve the things:
#welcome {
position: absolute;
top: 50%;
left: 50%;
width: auto;
height: auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
body {
background: black;
}
/* .button */
#speechbubble {
display: inline-block;
position: relative;
margin: 1em;
padding: 0.67em;
border: 2px solid #FFF;
overflow: hidden;
text-decoration: none;
font-size: 2em;
outline: none;
color: #FFF;
background: transparent;
font-family: 'raleway', sans-serif;
}
#speechbubble span {
-webkit-transition: 0.6s;
-moz-transition: 0.6s;
-o-transition: 0.6s;
transition: 0.6s;
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
transition-delay: 0.2s;
}
#speechbubble:before {
content: '';
position: absolute;
top: 0.67em;
left: 0;
width: 100%;
text-align: center;
opacity: 0;
-webkit-transition: .4s, opacity .6s;
-moz-transition: .4s, opacity .6s;
-o-transition: .4s, opacity .6s;
transition: .4s, opacity .6s;
}
/* :before */
#speechbubble:before {
content: attr(data-hover);
-webkit-transform: translate(-150%, 0);
-moz-transform: translate(-150%, 0);
-ms-transform: translate(-150%, 0);
-o-transform: translate(-150%, 0);
transform: translate(-150%, 0);
}
/* Span on :hover and :active */
#speechbubble:hover span {
opacity: 0;
-webkit-transform: scale(0.3);
-moz-transform: scale(0.3);
-ms-transform: scale(0.3);
-o-transform: scale(0.3);
transform: scale(0.3);
}
/*
We show :before pseudo-element on :hover
*/
#speechbubble:hover:before {
opacity: 1;
-webkit-transform: translate(0, 0);
-moz-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
-webkit-transition-delay: .4s;
-moz-transition-delay: .4s;
-o-transition-delay: .4s;
transition-delay: .4s;
}
<div id="welcome">
<div id="speechbubble" data-hover="Scroll Down"><span>Welcome!</span></div>
</div>

Here's very basic way to do it. Just put the text in some tags, and show/hide them on hover.
Also you can use the attr and :after features from css3.
#welcome{
position:absolute;
top:50%;
left:50%;
width:auto;
height:auto;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
#speechbubble {
margin-left:110px;
width: 230px;
height: 80px;
line-height:80px;
text-align:center;
font-size:15px;
letter-spacing:2px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
font-family:{select:Title Font};
background: {color:Welcome background};
color:{color:Welcome text};
position: relative;
font-weight:bold;
}
#speechbubble:before {
content:"";
position: absolute;
right: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 18px solid {color:Welcome background};
border-bottom: 13px solid transparent;
}
#welcome:hover #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
margin-left:120px;
}
#welcome #speechbubble .hover_on {
display: none;
}
#welcome #speechbubble .hover_off {
display: inline-block;
}
#welcome:hover #speechbubble .hover_on {
display: inline-block;
}
#welcome:hover #speechbubble .hover_off {
display: none;
}
#welcome #speechbubble{
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
<div id="welcome">
<div id="speechbubble"><p class="hover_off">Welcome!</p><p class="hover_on">Scroll down!</p></div>

Related

Positioned element is off when on Safari`

I have a button with arrows that is supposed to appear and move down when moused over. On Chrome and Firefox it works fine but when I open it up on Safari the arrows are too low- they aren't positioned correctly. I have heard about people specifying "top" and :left" but that doesn't seem to work for me. I don't know why this is but it seems to be due to the position: relative.
Code:
<a class="details" href="#scroll"> <span class="details__border--bottom">More Details</span>
</a>
<div class="top-portion__arrows">
<span class="top-portion__arrows--hide"></span>
<span class="top-portion__arrows--hide"></span>
<span class="top-portion__arrows--hide"></span>
</div>
a.details {
border: 2.5px solid white;
padding: 8px 62px;
padding-top: 11px;
font-family: 'Roboto', sans-serif;
font-size: 1.75rem;
background-color: rgba(214, 128, 0, 0.45);
color: white;
cursor: pointer;
position: relative;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translateX(-50%);
left: 50%;
top: 5%;
z-index: 1;
display: inline-block;
}
a.details:hover,
a.details:focus {
background-color: rgba(231, 147, 21, 0.25);
-webkit-transition: .5s ease-in;
-o-transition: .5s ease-in;
transition: .5s ease-in;
}
a.details:hover,
a.details:focus {
border: 3.5px solid white;
-webkit-transition: .15s;
-o-transition: .15s;
transition: .15s;
}
a.details:active {
background-color: rgba(247, 195, 100, 0.75);
-webkit-transition: .15s;
-o-transition: .15s;
transition: .15s;
}
.details__border--bottom {
display: inline-block;
padding: 2px 0px 4px;
margin: 0px 8px 0px;
position: relative;
}
.details__border--bottom:before {
content: '';
position: absolute;
width: 100%;
height: 0px;
border-bottom: 2.5px solid white;
bottom: 2px;
-webkit-transform: scaleX(0);
-ms-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: -webkit-transform 0.25s ease-in-out;
-webkit-transition: -webkit-transform 0.45s ease-in-out;
transition: -webkit-transform 0.45s ease-in-out;
-o-transition: transform 0.45s ease-in-out;
transition: transform 0.45s ease-in-out;
transition: transform 0.45s ease-in-out, -webkit-transform 0.45s ease-in-out;
}
a:hover .details__border--bottom:before,
a:focus .details__border--bottom:before {
-webkit-transform: scaleX(1);
-ms-transform: scaleX(1);
transform: scaleX(1);
}
.top-portion__arrows {
position: relative;
width: 0%;
top: 10%;
left: 51.5%;
}
.top-portion__arrows .top-portion__arrows--hide {
opacity: 0;
display: block;
width: 120px;
height: 120px;
border-bottom: 3px solid white;
border-right: 3px solid white;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
margin: -85px;
}
a.details:hover + .top-portion__arrows .top-portion__arrows--hide,
a.details:focus + .top-portion__arrows .top-portion__arrows--hide {
opacity: 1;
-webkit-animation: animate .65s ease;
animation: animate .65s ease;
}
.top-portion__arrows .top-portion__arrows--hide:hover .details__border--full,
.top-portion__arrows .top-portion__arrows--hide:focus .details__border--full {
border: 2.5px solid white;
-webkit-transition: .2s ease-in;
-o-transition: .2s ease-in;
transition: .2s ease-in;
}
#-webkit-keyframes animate {
0%{
opacity: 0;
-webkit-transform: rotate(45deg) translate(-10px,-10px);
transform: rotate(45deg) translate(-10px,-10px);
}
50%{
opacity: .5;
}
100%{
opacity: 1;
-webkit-transform: rotate(45deg) translate(0px,0px);
transform: rotate(45deg) translate(0px,0px);
}
}
#keyframes animate {
0%{
opacity: 0;
-webkit-transform: rotate(45deg) translate(-10px,-10px);
transform: rotate(45deg) translate(-10px,-10px);
}
50%{
opacity: .5;
}
100%{
opacity: 1;
-webkit-transform: rotate(45deg) translate(0px,0px);
transform: rotate(45deg) translate(0px,0px);
}
}
You can detect whether a user is browsing on safari with some javascript and then if they are browsing on safari, style the buttons a certain way by changing the margin-left and margin-top. Here is the code to detect whether the user is on safari:
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('safari') != -1) {
if (ua.indexOf('chrome') > -1) {
alert("chrome") // Chrome
} else {
alert("safari") // Safari
}
}
Edit: Your full code:
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('safari') != -1) {
if (ua.indexOf('chrome') > -1) {
} else {
document.getElementById("btn1").style.marginTop = "80%"; }
}

Button hover animation background color not filled fully

When you hover over the button on left & right side same space is visible. How can we fix that?
Here is image when you hover on button this is how it looks.
Here is jsfiddle link
https://jsfiddle.net/vct5acc0/1/
Css code is here :-
body {
background-color: #4F4BFA;
}
.btn1 {
border: 2px solid #fff;
}
.btn-cmn {
width: 175px;
height: 52px;
background-color: transparent;
border-radius: 26px;
font-size: 18px;
font-weight: 700;
line-height: 28px;
cursor: pointer;
}
Here is my solution, inspired by Kuba's first proposition:
(the one which added an inset shadow on the hover, not the updated one!)
See my comments in the CSS code, only 2 modifications.
body {
background-color: #4F4BFA;
}
.btn1 {
border: none; /* Modified */
box-shadow: inset 0px 0px 0px 2px #fff; /* Added */
}
.btn-cmn {
width: 175px;
height: 52px;
background-color: transparent;
border-radius: 26px;
font-size: 18px;
font-weight: 700;
line-height: 28px;
cursor: pointer;
}
.button-hover-effect {
position: relative;
overflow: hidden;
border-color: #000;
color: #000;
transition: color .4s cubic-bezier(.4, 0, .2, 1);
-webkit-transition: color .4s cubic-bezier(.4, 0, .2, 1);
-moz-transition: color .4s cubic-bezier(.4, 0, .2, 1);
-o-transition: color .4s cubic-bezier(.4, 0, .2, 1);
-ms-transition: color .4s cubic-bezier(.4, 0, .2, 1);
}
.btn-hfix1 {
height: 53px;
}
.button-hover-effect.white {
border-color: #fff;
color: #fff;
}
.button-hover-effect.white:hover {
color: #000;
}
.button-hover-effect::before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: "";
background-color: #000;
z-index: 1;
border-radius: 26px;
transition: transform .4s cubic-bezier(.4, 0, .2, 1);
-webkit-transition: -webkit-transform .4s cubic-bezier(.4, 0, .2, 1);
-moz-transition: -moz-transform .4s cubic-bezier(.4, 0, .2, 1);
-o-transition: -o-transform .4s cubic-bezier(.4, 0, .2, 1);
-ms-transition: -ms-transform .4s cubic-bezier(.4, 0, .2, 1);
transform: scale(0, 1);
-webkit-transform: scale(0, 1);
-moz-transform: scale(0, 1);
-o-transform: scale(0, 1);
-ms-transform: scale(0, 1);
transform-origin: right center;
-webkit-transform-origin: right center;
-moz-transform-origin: right center;
-o-transform-origin: right center;
-ms-transform-origin: right center;
}
.button-hover-effect:hover::before {
transform: scale(1, 1);
-webkit-transform: scale(1, 1);
-moz-transform: scale(1, 1);
-o-transform: scale(1, 1);
-ms-transform: scale(1, 1);
transform-origin: left center;
-webkit-transform-origin: left center;
-moz-transform-origin: left center;
-o-transform-origin: left center;
-ms-transform-origin: left center;
}
.button-hover-effect.white::before {
background-color: #fff;
}
.button-hover-effect .str {
position: relative;
z-index: 2;
}
<button class="btn-cmn btn1 button-hover-effect white btn-hfix1">
<span class="str">Know more</span>
</button>
I've only set the border to none, and then added an inset box-shadow.
I hope it helps.
Quick and "dirty". Remove the original border on hover and add an inset shadow (as a border) to see still a border while the transformation.
Updated:
.btn1 {
border:none; /*changed*/
box-shadow: inset 0px 0px 0px 2px #fff; /*added*/
}
body {
background-color: #4F4BFA;
}
.btn1 {
border: none;
box-shadow: inset 0px 0px 0px 2px #fff;
}
.btn-cmn {
width: 175px;
height: 52px;
background-color: transparent;
border-radius: 26px;
font-size: 18px;
font-weight: 700;
line-height: 28px;
cursor: pointer;
}
.button-hover-effect {
position: relative;
overflow: hidden;
border-color: #000;
color: #000;
transition: color .4s cubic-bezier(.4,0,.2,1);
-webkit-transition: color .4s cubic-bezier(.4,0,.2,1);
-moz-transition: color .4s cubic-bezier(.4,0,.2,1);
-o-transition: color .4s cubic-bezier(.4,0,.2,1);
-ms-transition: color .4s cubic-bezier(.4,0,.2,1);
}
.btn-hfix1 {
height: 53px;
}
.button-hover-effect.white {
border-color: #fff;
color: #fff;
}
.button-hover-effect.white:hover {
color: #000;
border:0px solid #fff;
box-shadow: inset 0px 0px 0px 2px #fff;
}
.button-hover-effect::before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: "";
background-color: #000;
z-index: 1;
border-radius: 26px;
transition: transform .4s cubic-bezier(.4,0,.2,1);
-webkit-transition: -webkit-transform .4s cubic-bezier(.4,0,.2,1);
-moz-transition: -moz-transform .4s cubic-bezier(.4,0,.2,1);
-o-transition: -o-transform .4s cubic-bezier(.4,0,.2,1);
-ms-transition: -ms-transform .4s cubic-bezier(.4,0,.2,1);
transform: scale(0,1);
-webkit-transform: scale(0,1);
-moz-transform: scale(0,1);
-o-transform: scale(0,1);
-ms-transform: scale(0,1);
transform-origin: right center;
-webkit-transform-origin: right center;
-moz-transform-origin: right center;
-o-transform-origin: right center;
-ms-transform-origin: right center;
}
.button-hover-effect:hover::before {
transform: scale(1,1);
-webkit-transform: scale(1,1);
-moz-transform: scale(1,1);
-o-transform: scale(1,1);
-ms-transform: scale(1,1);
transform-origin: left center;
-webkit-transform-origin: left center;
-moz-transform-origin: left center;
-o-transform-origin: left center;
-ms-transform-origin: left center;
border:5px solid #fff;
}
.button-hover-effect.white::before {
background-color: #fff;
}
.button-hover-effect .str {
position: relative;
z-index: 2;
}
<button class="btn-cmn btn1 button-hover-effect white btn-hfix1">
<span class="str">Know more</span>
</button>
body {
background-color: #4F4BFA;
}
.btn1 {
border: 2px solid #fff;
}
.button-hover-effect.white:hover {
border-color: #fff;
color: #fff;
}
.btn-cmn {
width: 175px;
height: 52px;
background-color: transparent;
border-radius: 26px;
font-size: 18px;
font-weight: 700;
line-height: 28px;
cursor: pointer;
}
.btn-cmn:hover {
width: 175px;
height: 52px;
background-color: #fff;
border-radius: 26px;
font-size: 18px;
font-weight: 700;
line-height: 28px;
cursor: pointer;
}
.button-hover-effect {
position: relative;
overflow: hidden;
border-color: #000;
color: #000;
transition: color .4s cubic-bezier(.4,0,.2,1);
-webkit-transition: color .4s cubic-bezier(.4,0,.2,1);
-moz-transition: color .4s cubic-bezier(.4,0,.2,1);
-o-transition: color .4s cubic-bezier(.4,0,.2,1);
-ms-transition: color .4s cubic-bezier(.4,0,.2,1);
}
.btn-hfix1 {
height: 53px;
}
.button-hover-effect.white {
border-color: #fff;
color: #fff;
}
.button-hover-effect.white:hover {
color: #000;
}
.button-hover-effect::before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: "";
background-color: #000;
z-index: 1;
border-radius: 26px;
transition: transform .4s cubic-bezier(.4,0,.2,1);
-webkit-transition: -webkit-transform .4s cubic-bezier(.4,0,.2,1);
-moz-transition: -moz-transform .4s cubic-bezier(.4,0,.2,1);
-o-transition: -o-transform .4s cubic-bezier(.4,0,.2,1);
-ms-transition: -ms-transform .4s cubic-bezier(.4,0,.2,1);
transform: scale(0,1);
-webkit-transform: scale(0,1);
-moz-transform: scale(0,1);
-o-transform: scale(0,1);
-ms-transform: scale(0,1);
transform-origin: right center;
-webkit-transform-origin: right center;
-moz-transform-origin: right center;
-o-transform-origin: right center;
-ms-transform-origin: right center;
}
.button-hover-effect:hover::before {
transform: scale(1,1);
-webkit-transform: scale(1,1);
-moz-transform: scale(1,1);
-o-transform: scale(1,1);
-ms-transform: scale(1,1);
transform-origin: left center;
-webkit-transform-origin: left center;
-moz-transform-origin: left center;
-o-transform-origin: left center;
-ms-transform-origin: left center;
}
.button-hover-effect.white::before {
background-color: #fff;
}
.button-hover-effect .str {
position: relative;
z-index: 2;
}
<button class="btn-cmn btn1 button-hover-effect white btn-hfix1">
<span class="str">Know more</span>
</button>
Have updated the fiddle. Please check
.button-hover-effect.white:hover {
color: #000;
border: none;
}
https://jsfiddle.net/vct5acc0/8/

text decoration: none. Not working

Hi so i am trying to make a nav menu that links to other pages when clicked. But when i tell it to link somewhere i get this ugly underline and blue text. I dont want that. I have tried "text-decoration: none;" and i have searched a bit about the topic. But it didnt help :/ Thank you for any suggestions!
Here is my html:
<div id="box">
<div id="items">
<div class="item">Item 1</div>
<div class="item">Item 2</div>
<div class="item">Item 3</div>
<div class="item">Contact</div>
<div class="item">Donate </div>
</div>
</div>
<div id="btn">
<div id="top"></div>
<div id="middle"></div>
<div id="bottom"></div>
</div>
And this is the CSS
#box {
position: fixed;
z-index: 4;
overflow: auto;
top: 0px;
left: -275px;
width: 275px;
opacity: 0;
padding: 20px 0px;
height: 100%;
background-color: #f6f6f6;
color: #343838;
-webkit-transition: all 350ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
transition: all 350ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
}
#box.active {
left: 0px;
opacity: 1;
}
#items {
position: relative;
top: 35%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
text-decoration: none;
}
#items .item {
position: relative;
cursor: pointer;
font-size: 23px;
padding: 15px 30px;
-webkit-transition: all 250ms;
transition: all 250ms;
}
#items .item:hover {
padding: 15px 45px;
background-color: rgba(52, 56, 56, 0.2);
}
#btn {
position: fixed;
z-index: 5;
top: 15px;
left: 15px;
cursor: pointer;
-webkit-transition: left 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
transition: left 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91);
}
#btn div {
width: 35px;
height: 2px;
margin-bottom: 8px;
background-color: #F5F5F5;
-webkit-transition: -webkit-transform 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91), opacity 500ms, box-shadow 250ms, background-color 500ms;
transition: transform 500ms cubic-bezier(0.6, 0.05, 0.28, 0.91), opacity 500ms, box-shadow 250ms, background-color 500ms;
}
#btn:hover > div { box-shadow: 0 0 1px #F5F5F5; }
#btn.active { left: 230px; }
#btn.active div { background-color: #343838; }
#btn.active:hover > div { box-shadow: 0 0 1px #343838; }
#btn.active #top {
-webkit-transform: translateY(10px) rotate(-135deg);
-ms-transform: translateY(10px) rotate(-135deg);
transform: translateY(10px) rotate(-135deg);
}
#btn.active #middle {
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
}
#btn.active #bottom {
-webkit-transform: translateY(-10px) rotate(-45deg);
-ms-transform: translateY(-10px) rotate(-45deg);
transform: translateY(-10px) rotate(-45deg);
}
You've already put your finger on it. The (default) underline is applied to the link, not #items. Those are the elements you will need to re-style:
#items .item a{
text-decoration: none;
color: inherit;
}
add to a tag text-decoration
.items a{
text-decoration: none;
color:#000;
}

Hover effect when hover image

I want to make a hover effect, when hover the image like this:
On the Internet found many similar examples but they all either with jquery or js. I would like to know whether it is possible to do purely with css...
UPDATE: here's a code found, but it is too big :(
.view-content {
height: 330px;
}
h2.view-title {
font-size: 3rem;
font-weight: bold;
color: #7d7a7a;
text-align: center;
text-shadow: 0 0px 0px;
}
.view {
width: 300px;
height: 200px;
margin: 10px;
float: left;
border: 5px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 0px 0px 5px #aaa;
cursor: default;
}
.view .view-mask, .view {
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.view img {
display: block;
position: relative;
}
.view a.view-info {
display: inline-block;
text-decoration: none;
padding:0;
text-align: center;
color: white;
font-size: 1.9rem;
font-weight: 600;
vertical-align: middle;
}
.view-effect .view-mask {
opacity: 0;
overflow:visible;
border:100px solid rgba(0,0,0,0.7);
box-sizing:border-box;
transition: all 0.3s ease-in-out;
}
.view-effect a.view-info {
position:relative;
top:-20px;
opacity: 0;
transition: opacity 0.3s 0s ease-in-out;
}
.view-effect:hover .view-mask {
opacity: 1;
border:100px solid rgba(0,0,0,0.7);
}
.view-effect:hover a.view-info {
opacity:1;
transition-delay: 0.3s;
}
<div class="view view-effect">
<img src="http://storage7.static.itmages.ru/i/16/0708/h_1467979220_8325708_d41d8cd98f.png" height="200" width="300" alt=""> <p></p>
<div class="view-mask">
Show project
</div>
</div>
Checkout below code as what you want or just click on below link :-
https://jsfiddle.net/ananddeepsingh/99bop25r/
HTML
<div class="box"> <img src="http://placehold.it/400x300">
<div class="overbox">
<div class="title overtext"> CSS Script </div>
<div class="tagline overtext"> Animated Text Overlay On Hover </div>
</div>
</div>
CSS
.box {
cursor: pointer;
height: 300px;
position: relative;
overflow: hidden;
width: 400px;
}
.box img {
position: absolute;
left: 0;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box .overbox {
background-color: #304562;
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 360px;
height: 240px;
padding: 130px 20px;
}
.box:hover .overbox {
opacity: 1;
}
.box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box .title {
font-size: 2.5em;
text-transform: uppercase;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.box:hover .title,
.box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.box .tagline {
font-size: 0.8em;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.box:hover .tagline,
.box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
Yes you can do that using pure CSS. for that purpose you may use :after pseudo class as,
.img-wrapper {
position:relative;
display:inline-block;
overflow:hidden;
cursor:pointer
}
.img-wrapper .hover-div{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
opacity:0;
display:inline-block;
text-align:center;
background:rgba(0,0,0,0.3);
-webkit-transition: 0.5s ease-in-out;
-moz-transition: 0.5s ease-in-out;
-o-transition: 0.5s ease-in-out;
transition: 0.5s ease-in-out;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-o-transform: translateY(100%);
-ms-transform: translateY(100%);
transform: translateY(100%);
}
.img-wrapper:hover .hover-div{
top:0;
opacity:1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-o-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
.img-wrapper:hover img {
-webkit-filter:grayscale(1);
-moz-filter:grayscale(1);
filter:grayscale(1);
}
.mybutton{
background:#FFFFFF;
color:#111111;
padding:10px 20px;
border-radius:5px;
display:inline-block;
margin-top:100px;
-webkit-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;
}
.mybutton:hover{
background:#111111;
color:#FFFFFF;
}
<div class="img-wrapper">
<img src="https://unsplash.it/200" >
<div class="hover-div">
<a class="mybutton">My Button</a>
</div>
</div>
Just use ':hover' after the element you want to show the effect on. For example, if you wanted to use it on the header you would create a new css tag called
header:hover{} and then you could put an opactiy of maybe 0.5 to make the object fade on hover. Hope this helps!
Yes it is possible only through HTML and CSS. Below there is an example code:
HTML:
<div class="imagebox">
<div class="transparent"><i class="fa fa-search" aria-hidden="true"></i>
<p>Zoom</p></div>
<img src="images/yourimage.jpg">
</div>
CSS:
.imagebox{
position: relative;
}
.imagebox:hover .transparent{
display: block;
}
.transparent{
background: rgba(0,0,0,0.5);
position: absolute;
height: 100%;
width: 100%;
display: none;
cursor: pointer;
}
.transparent i{
position: absolute;
left: 50%;
top: 30%;
color: #fff;
font-size: 20px;
}
.transparent p{
position: absolute;
left: 45%;
top: 50%;
color: #fff;
font-size: 20px;
}

Can't get these div's to center

I am trying to get these div's to center (all 3 next to each other to be in the center of the page), however I cannot get them to center.
Here is how they look, as an example: http://callum.website/
Code:
HTML
<div class="containercontainer">
<div class="containerleft">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
<div class="container">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
<div class="containerright">
<figure class="image-container">
<img src="https://d13yacurqjgara.cloudfront.net/users/430915/screenshots/2031943/untitled-7_1x.png" alt="eSportsy - eSports PSD Template" width="400" height="300">
<figcaption class="clearfix">
<h4>eSportsy - FREE PSD Template</h4>
<p>in <font color="0ead99"><B>FREEBIES</B></font></p>
Download
</figcaption>
</figure>
</div>
body{
background: #F3F3F3;
margin: 0px;
padding: 0px;
font-family: 'Open Sans', sans-serif;
color: #2A2A2A;
}
h4 {
color: #fff;
margin: 0;
padding: 0;
}
p {
margin: 0;
}
.containercontainer{
width: 66%;
margin: 0 auto;
max-width:100%;
text-align: center;
}
.containerleft {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
float:left;
}
.container {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
}
.containerright {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
float: right
}
.container a{
text-decoration:none;
}
.container img{
bottom: 0;
display: block;
height: auto;
max-width: 100%;
}
.button {
background: #0084b4;
border-radius: 3px;
color: #fff;
display: inline-block;
font-weight: bold;
padding: 4px 8px;
position: absolute;
right: 20px;
top: 30px;
}
.button:hover {
background: #2D76B9;
color: #fff;
}
.dlbutton {
background: #0ead99;
border-radius: 3px;
color: #fff;
display: inline-block;
font-weight: bold;
padding: 4px 8px;
position: absolute;
right: 20px;
top: 30px;
}
.dlbutton:hover {
background: #0eb49f;
color: #fff;
}
.image-container {
border: 6px solid #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
overflow: hidden;
position: relative;
width: 400px;
}
.image-container img {
-webkit-transition: all .4s;
-moz-transition: all .4s;
-ms-transition: all .4s;
-o-transition: all .4s;
transition: all .4s;
}
.image-container:hover img {
-webkit-transform: translateY(-45px);
-moz-transform: translateY(-45px);
-ms-transform: translateY(-45px);
-o-transform: translateY(-45px);
transform: translateY(-45px);
}
.image-container:hover figcaption {
opacity: 1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0);
-webkit-transition: -webkit-transform .4s, opacity .1s;
-moz-transition: -moz-transform .4s, opacity .1s;
-ms-transition: -ms-transform .4s, opacity .1s;
-o-transition: -o-transform .4s, opacity .1s;
transition: transform .4s, opacity .1s;
}
.image-container figcaption {
background: #283449;
bottom: 0;
color: #fff;
height: 50px;
left: 0;
opacity: 0;
padding: 20px;
position: absolute;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-ms-transform: translateY(100%);
-o-transform: translateY(100%);
transform: translateY(100%);
-webkit-transition: -webkit-transform .4s, opacity .1s .3s;
-moz-transition: -moz-transform .4s, opacity .1s .3s;
-ms-transition: -ms-transform .4s, opacity .1s .3s;
-o-transition: -o-transform .4s, opacity .1s .3s;
transition: transform .4s, opacity .1s .3s;
width: 360px;
}
You just need to remove the margin-left from .image-container.
.image-container { margin-left:0; }
Change the size of containerright (from CSS) from 66% to 92%. This will align all the divs in center as well as wouldn't disturb page responsiveness.
Remove:
float: left;
float: right;
and they become centered.
.containerright {
height: 312px;
width: 412px;
font: 87.5%/1.5em sans-serif !important;
margin-top:20px;
display: inline-block;
text-align:left !important;
...
margin:0 auto; // add this
}
Do the same for other container too Which is in centre