Text over image when hovering - html

I want to be able to make text appear over image upon hover without the current effects effecting the text boxes can anyone please assist me with this?
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body {
background: #4d4d4d4d;
}
.pic {
border: 0px solid #55009f;
height: 200px;
width: 200px;
margin: 20px;
overflow: hidden;
}
/*MORPH*/
.morph {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.morph:hover {
-webkit-transform:translate(0px,-10px);
-webkit-filter:grayscale(100%) blur(1px);
}
<link rel="Stylesheet" href="Stylesheet.css">
<div class="morph pic">
<img src="http://lorempixel.com/300/300/sports/1" alt="cricket">
</div>

This is known as imagetooltip
Visit
http://www.dynamicdrive.com/dynamicindex4/imagetooltip.htm
Everything including the demonstration, code and files are there.

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
body {
background: #4d4d4d4d;
}
.morph{
height: 200px;
width: 200px;
text-align:center;
margin:0
}
.pic {
border: 0px solid #55009f;
height: 100%;
width: 100%;
margin: 0px;
overflow: hidden;
}
/*MORPH*/
.pic{
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.morph:hover > .pic{
-webkit-transform:translate(0px,-10px);
-webkit-filter:grayscale(100%) blur(1px);
}
.tooltip{
background:rgba(80,80,80,0.5);
color:black;
z-index:10;
display:none;
position:absolute;
top:100px;
height:200px;
width:200px;
margin-top:-100px;
}
.morph:hover > .tooltip{
display:block;
}
<link rel="Stylesheet" href="Stylesheet.css">
<div class="morph">
<div class="pic">
<img src="http://lorempixel.com/300/300/sports/1" alt="cricket">
</div>
<div class="tooltip">Lorem ipsum sit dolor am ecit, lorem ipsum sit dolor am ecit, I'm sure I got these wrong, but who cares </div>
</div>
You could do it like this :)

I dont see any text that you want to show over there when hovering. But :hover is that to achieve this. So the answer is simply to provide tag element for the text you want to show and hide that, and then on hoverin, show the element. For example:
<div class="imtex">
<img src="some.jpg"/>
<p>hi my text is here</p>
</div>
So the style is:
.imtex {
display: block;
position: relative; //in case you want the child to absolute
}
.imtex img {
display: block;
position:absolute;
z-index: 2;
top: 0;
bottom:0;
left:0;
right: 0;
}
.imtex p {
display: none;
position:absolute;
z-index: 3; //after the image index
top: 0;
bottom:0;
left:0;
right: 0;
}
.imtex:hover p {
display: block;
}

Related

Text appears when box is hovered over, but how to remove underline from text link?

I've been designing a website and have managed to make the background of the boxes fade when they are hovered over, with the text appearing at the same time. I am now adding links to the text, but cannot seem to remove the underline.
I would like to do two things here:
Remove the underline when the text link is hovered over (I would like the text to be black)
Make the text change colour when it is hovered over (to grey)
Your help is much appreciated!
Here's my code:
.box-a {
margin-bottom: 14px;
margin-top: 10px;
width: 100%;
height: 250px;
float: left;
padding: 15px 15px;
box-sizing: border-box;
position: relative;
}
.box_a_background {
width:50%;
height:100%;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
ms-transition: all 0.3s ease;
transition: all 0.3s ease;
position:absolute;
z-index:2;
opacity: 1.0;
background-position: 50% 40%;
float: left;
}
.box-a:hover .box_a_background {opacity: 0.25;}
.text-block-a {
position: absolute;
margin-top: 205px;
overflow: hidden;
height:100%;
color:#000;
transform: translateY(-50%);
text-align:center;
z-index:1;
width: 50%;
}
.text-block-a a:hover {
text-decoration:none;
}
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Arvo' rel='stylesheet'>
</head>
<body>
<div class="container">
<div class="content-area-group">
<div class="box-a">
<div class="text-block-a">
<h4><a href="#">Great cycle routes</h4>
<p>Check out our guide to the best cycle routes in Nottinghamshire.</a></p>
</div>
<div class="box_a_background" style="background-image: url('https://i.postimg.cc/3Nm4HtNY/box-a-image-trent.jpg');"
</div></div>
</div>
<body>
The a tag in HTML defines a hyperlink, which default style is a blue text with an underline to signify to the user that the text can be clicked. To remove it, simply add this code into your CSS:
a {
text-decoration: none;
}
This removes any pre-defined text decoration set for the a tag. text-decoration can add underline, overline, line-through, etc. to your text.
I just added "text-decoration" and it is working, I also deleted an extra "div" element at the end.
a {
text-decoration: none;
}
.box-a {
margin-bottom: 14px;
margin-top: 10px;
width: 100%;
height: 250px;
float: left;
padding: 15px 15px;
box-sizing: border-box;
position: relative;
}
.box_a_background {
width:50%;
height:100%;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
ms-transition: all 0.3s ease;
transition: all 0.3s ease;
position:absolute;
z-index:2;
opacity: 1.0;
background-position: 50% 40%;
float: left;
}
.box-a:hover .box_a_background {opacity: 0.25;}
.text-block-a {
position: absolute;
margin-top: 205px;
overflow: hidden;
height:100%;
color:#000;
transform: translateY(-50%);
text-align:center;
z-index:1;
width: 50%;
}
.text-block-a a:hover {
text-decoration:none;
}
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Arvo' rel='stylesheet'>
</head>
<body>
<div class="container">
<div class="content-area-group">
<div class="box-a">
<div class="text-block-a">
<h4><a href="#">Great cycle routes</h4>
<p>Check out our guide to the best cycle routes in Nottinghamshire.</a></p>
</div>
<div class="box_a_background" style="background-image: url('https://i.postimg.cc/3Nm4HtNY/box-a-image-trent.jpg');"
</div>
</div>
<body>

Zoom image with CSS3 with parent div have border radius overflow

i try to use zoom image(scale CSS3) animation when mouse hover the image, but i have a problem with overflow during the animation, i want use tag <img> because i want put background color besides the image(have background transparency)
this is my problem:
HTML:
<div class="thumbnail">
<div class="divIMG">
<img src="https://d30y9cdsu7xlg0.cloudfront.net/png/14182-200.png" alt="">
</div>
</div>
CSS:
.thumbnail {
margin-top: 20px;
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
.thumbnail div.divIMG {
border-radius: 50%;
border: 4px solid #08456f;
width:200px;
height:200px;
overflow:hidden;
margin: 0 auto;
}
.thumbnail img {
background-color: #c3d3de;
width: 100%;
-webkit-transition: all .7s ease-in-out;
-moz-transition: all .7s ease-in-out;
-o-transition: all .7s ease-in-out;
-ms-transition: all .7s ease-in-out;
transition: all .7s ease-in-out;
}
.thumbnail div.divIMG:hover img {
-webkit-transform:scale(1.1);
transform:scale(1.1);
}
https://jsfiddle.net/j1rdv968/
anyone know a solution?
ps. sorry my english.
You can keep the transforming image inside of the .divIMG div by giving it a position: relative;, and a higher z-index than its child image.
CSS
.thumbnail div.divIMG {
z-index: 3;
position: relative;
}
.thumbnail img {
z-index: 2;
}
.thumbnail {
margin-top: 20px;
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
.thumbnail div.divIMG {
border-radius: 50%;
border: 4px solid #08456f;
width:200px;
height:200px;
overflow:hidden;
margin: 0 auto;
z-index: 3;
position: relative;
}
.thumbnail img {
background-color: #c3d3de;
width: 100%;
-webkit-transition: all .7s ease-in-out;
-moz-transition: all .7s ease-in-out;
-o-transition: all .7s ease-in-out;
-ms-transition: all .7s ease-in-out;
transition: all .7s ease-in-out;
z-index: 2;
}
.thumbnail div.divIMG:hover img {
-webkit-transform:scale(1.1);
transform:scale(1.1);
}
<div class="thumbnail">
<div class="divIMG">
<img src="https://d30y9cdsu7xlg0.cloudfront.net/png/14182-200.png" alt="">
</div>
</div>
JSFiddle

Image hover effect doesn't work over text

I have an image I want to display as a link. I have a hover effect when the mouse is over the image, but I also want to overlay a text label onto the image. The problem is, when the mouse is over the text, the image effect stops working.
My code is below. Can anyone suggest how I can fix this?
<html>
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.pic {
border: 5px solid #FF0000;
float: left;
width: 475px;
height: 375px;
margin: 20px;
overflow: hidden;
position: relative;
-webkit-box-shadow: 5px 5px 5px #C0C0C0;
box-shadow: 5px 5px 5px #C0C0C0;
}
.grow img {
width: 475px;
height: 375px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.grow img:hover {
width: 570px;
height: 450px;
}
.label {
top: 150px;
position:absolute;
text-align:center;
font-size:500%;
color: FF0000;
width: 100%;
}
</style>
<a href="MyLink.html">
<div class="grow pic">
<img src="MyImage.jpg" alt="TITLE">
<div class="label">TITLE</div>
</div>
</a>
You could try disabling pointer-events:
.label { pointer-events:none; }
Your hover is just on your image, apply the hover to the div.
example:
.grow:hover img {
//styles
}

Show a thumbnail caption on hover centered

I'm trying to show a thumbnail caption on hover centered: aligned horizontal and vertical, but not successful.
In the fiddle you see a responsive thumbnail grid with on hover a caption. I gave it a dashed red border so you can see that it is not same size as the thumbnail. I can't get the title caption to be centered in the thumbnail. Maybe my thumbnail grid need a different build. Hope someone can help me.
Here is the fiddle
#content {
position: relative;
display: inline-block;
margin: 110px 40px 100px 40px;
background-color: transparent;
}
.col-25 {
position: relative;
float: left;
width: 25%;
margin: 0;
}
.thumb {
display: block;
margin: 10px;
}
.col-25 img {
width: 100%;
height: auto;
}
.col-25 a:hover img {
opacity: 0.1;
}
.caption {
position: absolute;
top:0;
left:0;
border: dashed 1px red;
width:100%;
height:100%;
opacity: 0;
text-align:center;
vertical-align: middle;
z-index:2;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.col-25 a:hover .caption {
opacity: 1;
}
http://jsfiddle.net/a0zwecou/14/
I have added an inner div to caption and give it a margin height of 25%. Remove the margin for extremely small width size in your media query.
<div class="caption">
<div class="inner-caption">
<h3>Untitled for now</h3>
<p>Caption</p>
</div>
</div>
CSS -
.inner-caption{margin-top:25%;}
JSFIIDLE
only by changing the height and adding padding to caption class.
.caption {
position: absolute;
padding-top:25%;
top:0;
left:0;
border: dashed 1px red;
width:100%;
height:60%;
opacity: 0;
text-align:center;
vertical-align: middle;
z-index:2;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
Try this,
.thumb:hover{border:1px dashed red;background-color:red;}
.caption {
position: absolute;
top:40%;
left:0;
/*border: dashed 1px red;*/ //remove it
width:100%;
/*height:100%;*/ // remove it
opacity: 0;
text-align:center;
vertical-align: middle;
z-index:2;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
Fiddle : http://jsfiddle.net/a0zwecou/20/
see the fiddle here:
http://jsfiddle.net/a0zwecou/13/
and add css:
.caption h3 {
margin-top: 59px;
}
You can simply wrap your caption inside another div and centered that with transate(with all prefixes of course), OR you can simply center that using tables (table + table-cell)
HERE THE PEN, hover the first.
.insideCap{
background: red;
top: 50%;
position: absolute;
width: 100%;
transform: translateY(-50%);
}
OTHER WAY:
parent{
dispaly:table;
}
son{
display: table-cell;
vertical-align: middle;
}
you can try this:
<div id="content">
HTML:
Add this div:
<div class="col-25">
<a class="thumb" href="#">
<img src="http://fakeimg.pl/500x310/999/">
<div class="caption"><div class="caption-text"><h3>Untitled for now</h3><p>Caption</p></div></div>
</a>
</div>
CSS:
add this css in your style:
.caption-text {
left: 0;
position: absolute;
right: 0;
top: 32%;
}
SEE JS Fiddle DEMO

Trying to Display Content Once Image is hovered over

Just making this from scratch for a project of mine. I am wanting to create a hover affect on an image that then displays content about that image on top. The image would dim on the hover and the content would then display above it.
The problem that I am having is the content is going off the opacity of its parent div. How do I make the child div not get affected by the opacity property?
Here is my HTML:
<div class="featured-home-bg">
<div class="background-content">
<div class="featured-home-content">
<h2>Home Name</h2>
<p>Lorem Ipsum leo dormit tan loius ov noetermit.</p>
</div><!--- end featured-home-content --->
</div><!--- end background-content --->
</div><!--- end featured-home-bg --->
Here is my CSS:
.featured-home-bg {
background: url(../images/home-1.jpg) no-repeat;
background-size: 400px;
height: 300px;
}
.background-content {
background-color: #000;
height: 225px;
width: 400px;
opacity: 0;
}
.background-content:hover {
opacity: 0.6;
-webkit-transition: opacity 0.50s ease-in-out;
-moz-transition: opacity 0.50s ease-in-out;
-ms-transition: opacity 0.50s ease-in-out;
-o-transition: opacity 0.50s ease-in-out;
}
.featured-home-content {
width: 400px;
height: 300px;
}
.featured-home-content:hover {
cursor: pointer;
width: 400px;
height: 300px;
}
here this is the way to do that as #Henric Ã…kesson said but here with every div
html
> <div class="image"><!-- image can be placed here --> <div
> class="imagehover">text </div></div>
css
.image {
width: 400px;
height: 400px;
background-color: red;
line-height: 400px;
}
.imagehover{
width: 400px;
height: 400px;
background:;
opacity:0;
text-align: center;
font-size:20px;
transition: 0.2s ease-in-out;
}
.image:hover .imagehover {
transition: 0.2s;
opacity:1;
background-color: rgba(0, 0, 0, 0.5);
text-align:justify;
color:white;
font-size:25px;
font-weight:700;
font-family: "apercu",Helvetica,Arial,sans-serif;
text-align: center;
line-height: 400px;
}
http://jsfiddle.net/d6yhnmnf/5/
I think you would like to have the code something like this?
.featured-home-bg:hover .background-content {
opacity: 0.6;
}