On Image Hover Display text inside a box above image - css

I want text on image hover just like in this website. Using CSS3
https://addapinch.com/

You can try with this (just adopt the color and the divs)
Here is the HTML:
<div class="container">
<div class="row">
<div class="col-md-3 row_cont">
<img class="image_box" src="path_to_the_image" id="image"/>
<div id="overlay">
desired text
</div>
</div>
<div class="col-md-3 row_cont">
<img class="image_box" src="path_to_the_image" id="image"/>
<div id="overlay">
desired text
</div>
</div>
<div class="col-md-3 row_cont">
<img class="image_box" src="path_to_the_image" id="image"/>
<div id="overlay">
desired text
</div>
</div>
<div class="col-md-3 row_cont">
<img class="image_box" src="path_to_the_image" id="image"/>
<div id="overlay">
desired text
</div>
</div>
</div>
</div>
Here is the CSS:
.row_cont {
position:relative;
width:95%;
height:240px;
margin-bottom: 20px;
}
.row_cont {
position:relative;
width:95%;
height:240px;
margin-bottom: 20px;
}
#image {
position:absolute;
width:95%;
height:240px;
/* background:black; */
}
#overlay {
position:absolute;
width:95%;
height:240px;
background: #fff;
opacity: 0;
-webkit-transition: all .6s ease;
-moz-transition: all .6s ease;
-ms-transition: all .6s ease;
-o-transition: all .6s ease;
transition: all .6s ease;
}
#overlay:hover {
opacity: .95;
box-shadow: 0px 0px 30px 3px #000;
}
a.link_hover {
position: relative;
top: 45%;
left: 13%;
font-size: 26px;
font-weight: 600;
text-transform: uppercase;
color: rgba(2, 103, 193, .7);
text-decoration: none;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
a.link_hover:hover {
color: rgba(2, 103, 193, 1);
}
.image_box:hover {
-ms-filter: blur(3px)!important;
filter: blur(3px)!important;
cursor: pointer;
}
Let me know if it is this was helpful

Related

Hover feature and Link shifted

I am new to coding, and I am making a home page. I was trying to get the black and white hover feature on the images of my home pages. However, when I hover my mouse over the image, it does not work. It is only until you hover to the left of the image that the image will turn from color to BW. Any ideas on how to fix this? Any help is greatly appreciated!
Here is my code:
#font-face {
font-family: "p22-underground";
src: qzo1okq;
}
.container {
position: absolute;
padding-bottom: 0px;
margin-top: -125px;
margin-right: -70px;
float: left;
}
.Marlon {
position: absolute;
margin-top: -275px;
margin-left: 15px;
}
/*B&W*/
.blue {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.blue:hover {
-webkit-filter: grayscale(100%);
}
.blue {
position: relative;
background-position: left top;
margin-top: 120px;
margin-left: -250px;
max-width:100%;
height:auto;
text-align: center;
}
/*B&W*/
.Tammy {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.Tammy:hover {
-webkit-filter: grayscale(100%);
display: block;
}
.Tammy {
position: relative;
background-position: left top;
margin-top: -5px;
margin-left: -250px;
max-width:100%;
height:auto;
text-align: center;
}
/*B&W*/
.Tacos {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.Tacos:hover {
-webkit-filter: grayscale(100%);
}
.Tacos {
position: relative;
background-position: center;
margin-top: -623px;
margin-left: 100px;
max-width:100%;
text-align: center;
}
/*B&W*/
.Glasses {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.Glasses:hover {
-webkit-filter: grayscale(100%);
}
.Glasses {
position: relative;
background-position: center;
margin-top: -5px;
margin-left: 100px;
max-width:100%;
height:auto;
text-align: center;
}
/*B&W*/
.Door {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.Door:hover {
-webkit-filter: grayscale(100%);
}
.Door{
position: relative;
background-position: right top;
margin-top: -623px;
Margin-left:700px;
max-width:100%;
height:auto;
text-align: center;
}
.Social {
position: relative;
text-align: center;
inline: block;
padding-bottom: 0px;
top:-25px;
bottom: 0px;
margin:auto;
}
body {
background-image: url("http://ac.aup.edu/~a94241/background.jpeg");
}
ul {
list-style-type: none;
height: 50px;
margin: 150;
padding: 80;
overflow: hidden;
margin-top: 200px;
background-color: black;
font-family: "p22-underground";
font-weight: "500";
font-size: 150%;
}
li {
float: none;
color: "#fcf8de";
position: relative;
display: inline-block;
bottom: 12px;
margin-left: 10px;
margin-right: 10px;
}
li a {
display: block;
color: "#fcf8de";
text-align: center;
padding: 14px 16px;
margin-left: 5px;
}
footer {
height:10px;
padding: 20px;
margin-top:100px;
text-align:left;
vertical-align:middle;
padding-top: 14px;
background-color: black;
font-family: "p22-underground";
font-weight: "300";
position:static;
}
<!DOCTYPE html>
<html>
<head>
<script src="https://use.typekit.net/qzo1okq.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
</head>
<body>
<div class="container">
<a href="http://ac.aup.edu/~a94241/Marlon Coding.html">
<img src="http://ac.aup.edu/~a94241/cactus.png" alt="Cactus Vector" width="100" height="90">
</a>
</div>
<div class="Marlon">
<a href="http://ac.aup.edu/~a94241/Marlon Coding.html">
<img src="http://ac.aup.edu/~a94241/Marlon Vector.png" alt="Marlon Vector" width="450" height="550">
</a>
</div>
<ul>
<center>
<h1 style="font-p22-underground-sc, sans-serif;font-style:normal; font-weight:500; font-size:80% "</h1>
<li>PHILOSOPHIE</li>
<li>MENU</li>
<li>NOUS TROUVER</li>
<li>AVIS</li>
<li>CONTACT
</li>
</ul>
</center>
<div class="opacity">
<div class="blue">
<a href="http://ac.aup.edu/~a94241/Philosophie.html">
<img src="http://ac.aup.edu/~a94241/blue car.png" alt="BlueCar" width="300" height="310">
</a>
</div>
<div class="Tammy">
<a href="http://ac.aup.edu/~a94241/Avis.html">
<img src="http://ac.aup.edu/~a94241/tammy Lunch.png" alt="TammyLunch" width="300" height="310">
</a>
</div>
<div class="Tacos">
<a href="http://ac.aup.edu/~a94241/Contact.html">
<img src="http://ac.aup.edu/~a94241/tacos.png" alt="Tacos" width="300" height="310">
</a>
</div>
<div class="Glasses">
<a href="http://ac.aup.edu/~a94241/Menu.html">
<img src="http://ac.aup.edu/~a94241/Glasses.png" alt="Glasses" width="300" height="310">
</a>
</div>
<div class="Door">
<a href="http://ac.aup.edu/~a94241/Nous Trouver.html">
<img src="http://ac.aup.edu/~a94241/door.png" alt="Door" width="300" height="620">
</a>
</div>
</div>
<footer>
<p1><font color="#fcf8de">CALL: 01 40 60 12 12</font></p1>
<div class="Social">
<a href="https://www.facebook.com/restaurantmarlon">
<img src="http://ac.aup.edu/~a94241/facebook.png" alt="Facebook Vector" width="20" height="25">
</a>
<a href="https://www.instagram.com/restaurantmarlon/">
<img src="http://ac.aup.edu/~a94241/instragram.png" alt="Instargram Vector" width="20" height="25">
</a>
</div>
</footer>
</body>
</html>

Text Align on 2 Lines

I have four elements with text, some of which has text on two lines. I want to place the text in the center of the element, which I've done with text-align. However, the text that is on two lines I would like to be left-aligned with itself so it's flush to the left.
Like this:
First Line of text
Second line of text
JS Fiddle: http://jsfiddle.net/nj1pnnoj/1/
HTML:
<body>
<div id='nw' class='bg'>
<div class='overlay'>
<span class='caption'>Night <br /> Life</span>
</div>
</div>
<div id='ne' class='bg'>
<div class='overlay'>
<span class='caption'>News</span>
</div>
</div>
<div id='sw' class='bg'>
<div class='overlay'>
<span class='caption'>Food & Drink</span>
</div>
</div>
<div id='se' class='bg'>
<div class='overlay'>
<span class='caption'>Events</span>
</div>
</div>
</body>
CSS:
body {
background: url('http://www.bootply.com/assets/example/bg_blueplane.jpg');
height:100%;
margin:0;
padding:0;
}
div.bg {
position:fixed;
width:50%;
height:50%
}
#nw {
top:0;
left:0;
background-image: url('clevelandnight.jpg');
background-size:cover;
text-align: center;
text-align-last:left;
}
#ne {
top:0;
left:50%;
background-image: url('news1.jpg');
background-size:cover;
}
#sw {
top:50%;
left:0;
background-image: url('drinks1.jpg');
background-size:cover;
text-align: center;
}
#se {
top:50%;
left:50%;
background-image: url('clevelandday.jpg');
background-size:cover;
text-align: center;
}
.overlay {
height:100%;
-webkit-transition: all .4s ease-out;
-moz-transition: all .4s ease-out;
-o-transition: all .4s ease-out;
-ms-transition: all .4s ease-out;
transition: all .4s ease-out;
}
.bg:hover .overlay {
background:rgba(0, 0, 0, .75);
opacity: 1;
height:100%;
}
.caption {
font-family: 'Open Sans Condensed', sans-serif;
font-weight:100;
color:white;
z-index:100;
font-size:24pt;
-webkit-transition: font-size .4s ease-out 1s;
-moz-transition: font-size .4s ease-out 1s;
-o-transition: font-size .4s ease-out 1s;
-ms-transition: font-size .4s ease-out 1s;
}
.bg:hover .caption {
font-size:72px;
}
You can add text-align: left and display: inline-block to the inner span elements:
.overlay span{
text-align:left;
display: inline-block;
}
http://jsfiddle.net/nj1pnnoj/2/

css transition on multiple elements

I have multiple css transitions on different elements.
In my example, if you hover over the circle section the transitions occur on both the circle and the box color change underneath. However if you come out of the circle and into the box section, the circle transition does not occur
See fiddle for complete example: http://jsfiddle.net/Lsnbpt8r/
Heres my html:
div class="row">
<div class="col-sm-4 text-center transistion">
<div class="box">
<i class="circle-pos circle glyphicon glyphicon-home icon"></i>
<h3 class="heading">
Construction
</h3>
<p>This is how we do it</p>
</div>
</div>
<div class="col-sm-4 text-center transistion">
<div class="box">
<i class="circle-pos circle glyphicon glyphicon-wrench icon"></i>
<h3 class="heading">
Interior Design
</h3>
<p>This is how we do it</p>
</div>
</div>
<div class="col-sm-4 text-center transistion">
<div class="box">
<i class="circle-pos circle glyphicon glyphicon-thumbs-up icon"></i>
<h3 class="heading">
Service
</h3>
<p>This is how we do it</p>
</div>
</div>
</div>
Here's some of my css:
.circle {
width: 120px;
height: 120px;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
background: #f3f3f3;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.circle:hover{
width: 100px;
height: 100px;
background: #f7f7f7;
}
.box{
border: 0px 1px 2px 1px solid #f1f1f1;
border-top: 5px solid #003176;
height: 200px;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-o-transition: all 300ms linear;
-ms-transition: all 300ms linear;
transition: all 300ms linear;
}
.box:hover{
background-color: #135379;
}
How can I make it so that whatever part of the section is hovered on all element transitions will take place ?
Cheers in advance.
It's because the effects are applied to each element's :hover:
.circle:hover{
width: 100px;
height: 100px;
background: #f7f7f7;
}
...
.circle-pos:hover{
margin-top: -50px;
}
So, if you hover the box, but not the circle, it won't have any effect. Instead, set the transition to the :hover of the common parent container, in this case, the .box div:
Updated Fiddle
.box:hover .circle{
width: 100px;
height: 100px;
background: #f7f7f7;
}
....
.box:hover .circle-pos{
margin-top: -50px;
}
EDIT
The same with the .icon:hover { if you want, it can be .box:hover .icon{: http://jsfiddle.net/Lsnbpt8r/3/

Overflow Hidden Not working correctly with radius border

I am trying to create a nice hover effect for a my project i am working on and the overflow hidden doesn't seem to be working in safari Take a look. learn.michaelscimeca.com
HTML:
<div class="thumnnail">
<img class="mainbg" src="img/shoppee.jpg" alt="">
<div class="textbox">
<img src="/img/eye.png" alt="">
<span class="launch">View Project</span>
</div>
</div>
CSS:
.thumnnail .textbox .launch a {
margin-left: -78px;
text-align: center;
margin-top: 10px;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
padding: 15px 40px;
position: absolute;
top: 45px;
left: 50%;
background-color: #1c51c8;
border-radius: 100%;
text-transform: uppercase;
-ms-transition: all .5s ease;
/* this is for the animation effect to bring the textbox down to up and up to down */
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}
.thumnnail .textbox .launch a:hover {
background-color: #093db4;
}
.thumnnail:hover {
border: 10px solid #0d46c8;
/* this is to alter the border on rollover */
border-radius: 100%;
/* this is to round out the div tag */
/* to get rid of the greyscale on rollover */
-webkit-filter: grayscale(0%);
-moz-filter: grayscale(0%);
-o-filter: grayscale(0%);
-ms-filter: grayscale(0%);
overflow: hidden! important;
}
.thumnnail:hover img {
/* width:120%;
height:120%;*/
}
.thumnnail:hover .textbox {
height: 100px;
}
Change your transition from:
transition: all .5s ease;
to:
transition: border .5s ease;
And then post your CSS and HTML so that other people can see what the problem was.

CSS3 transition changes another elements's margin

I have this HTML document:
<div id="c">
<div class="base">
<div class="cb" id="red" data-color="Red">
</div>
</div>
<div class="base">
<div class="cb" id="green" data-color="Green">
</div>
</div>
<div class="base">
<div class="cb" id="blue" data-color="Blue">
</div>
</div>
</div>
​
and this is my CSS:
<style type="text/css">
.cb {
display: inline-block;
background-color: #56a100;
width: 70%;
height: 70%;
margin-top: 15%;
filter: alpha(opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
-ms-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.cb:hover {
display: inline-block;
filter: alpha(opacity=100);
-moz-opacity: 1;
opacity: 1;
width: 100%;
height: 100%;
margin-top: auto;
-ms-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.base {
display: inline-block;
width: 50px;
height: 50px;
margin-left: 5px;
margin-top: 20px;
border-style: ridge;
text-align: center;
vertical-align: central;
}
</style>
​
but when I put mouse on one of the .cb elements the others go down!
you can see Demo Here. Does anybody how to stop the other elements to going down?
Remove display: inline-block; from .base class and make it float to the left float: left;.
Here's fixed demo http://jsfiddle.net/pTCFL/2/

Resources