How to write Text on a image. - html

How to add TEXT in the image...so that the TEXT is view-able only when the image becomes dark when mouse is placed over it.. something like ..the one given in the example image below...
Thanks for your help.
.image {
width: 250px;
height: 200px;
background: black;
position: relative;
overflow: hidden;
}
.image img {
transition: all ease 1s;
}
.image:hover img { /* Darkening effect on mouseover */
background: black;
opacity: 0.7;
}
.image .arrow { /* Creates a half triangle with top and left arrow transparent */
opacity: 0;
border-color: transparent #f2f2f2 #f2f2f2 transparent;
transition: all ease 1s;
position: relative;
}
.image:hover .arrow { /* Mouseover effect */
opacity: 1;
font-family: Roboto;
font-size: 36px;
text-align: center;
border-image: none;
border-style: solid;
border-width: 45px;
position: absolute;
bottom: 0;
font-weight: normal;
width: 0;
height: 0;
right: 0;
}
.image:hover .arrow {
border-image: none;
border-style: solid;
border-width: 45px;
bottom: 0;
display: block;
font-family: Roboto;
font-size: 36px;
font-weight: normal;
height: 0;
opacity: 1;
position: absolute;
right: 0;
text-align: center;
width: 0;
}
.image .arrow {
border-color: transparent #f2f2f2 #f2f2f2 transparent;
opacity: 0;
position: relative;
transition: all 1s ease 0s;
}
.image .arrow span {
left: 5px;
position: relative;
top: -10px;
}
<div class="image">
<img src="http://lorempixel.com/250/200/sports" />
<div class="arrow"><span>></span></div>
</div>
enter image description here

It's simple. Create some text inside your wrapper div, then order the text to display on hovering the wrapper. Below is a demo of this logic.
The HTML:
<div class="image">
<p>I'm some very interesting text!</p>
<div class="arrow"><span>></span></div>
</div>
The CSS:
p{
color: #fff;
opacity: 0;
font-weight: bold;
text-align: center;
font-size:32px;
color: red;
/* bring your own prefixes */
transform: translate(0, 50%);
transition: all .5 ease;
}
.image:hover p {
visibility: visible;
opacity: 1;
}
CODEPEN DEMO

i think you can create like this
you need to change the position of the .image class so that text div can appear overlap on that
.image-hover-wrapper {
display:none;
text-align: center;
width: 250px;
color: red;
font-size: 35px;
position: relative;
top: -125px;
background: rgba(255,255,255,0.6);
}
.image:hover > .image-hover-wrapper{
display:block;
opacity:0.8;
transition-property: animation;
transition-duration: 2s;
transition-timing-function: linear;
}
<div class="image">
<img src="http://lorempixel.com/250/200/sports" />
<div class="arrow"><span></span></div>
<div class="image-hover-wrapper">
Hii
</div>
</div>
and here is the
Updated DEmo

Related

How to make pull up effect during hovering element? Just see this code once

I am trying to create an effect when div class="container" is being hovered, a smooth upper transition occurs of another div from bottom. Only during hover, this should happen cause I want that .bottom div to be hidden. When that div is not hidden, I can see the effect as I want. But as I hide the bottom div, that hovering effect smooth transition effect cannot be seen. Check this code once.
HTML CODE
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
CSS code
.box{
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top:80px;
left:0;
/* display: none; */
}
.box:hover .bottom {
display: block;
transition: linear 0.2s;
top:55px;
}
Here is the codepen link
https://codepen.io/Biebk/pen/MWpREqb
First off, rather than display: none to hide the incoming element altogether, you can set its opacity to 0, and then when the parent is hovered, set it to 1, like so:
.bottom {
opacity: 0;
}
.box:hover .bottom {
opacity: 1;
}
I suppose that given you want an incoming "pull-up" effect on hover, you want to that element to also "pull-down" when the hover ends. You can reverse the same effect by using a :not(:hover) on the parent element:
.box:not(:hover) .bottom {
opacity: 0;
}
Also, be sure to set the transition on the non-hovered state. The following example provides the smooth transition you're looking for:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
transition: all .25s ease;
}
.box:not(:hover) .bottom {
top: 80px;
opacity: 0;
}
.box:hover .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
A secondary approach would be to place the bottom div as a sibling to the box, and use the adjacent sibling combinator to apply the hover effects:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
font-size: 20px;
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
top: 80px;
opacity: 0;
cursor: default;
transition: all .25s ease;
}
.box:hover + .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
</div>
<div class="bottom">
Everyone
</div>
Use opacity property rather than display to achieve the desired effect, then
use the following code
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
opacity: 0;
}
.box:hover .bottom{
opacity: 1;
transition: opacity 0.2s , top 1s;
top: 55px;
}
Use the following code.
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.hovered{
transition: all .2s;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
visibility: hidden;
}
.hovered:hover+.bottom {
transition: all .2s;
top: 55px;
visibility: visible;
}
<div class="box">
<div class="hovered">Hello</div>
<div class="bottom">
Everyone
</div>
</div>

CSS positioning helper tips icon

Good Morning,
I have this line of code:
<div class="navigation">
<a href="~/Uploads/TimeSlotTemplate.xlsx" download>Download Upload Template</a> <div class="help-tip"> <p>This is the inline help tip! You can explain to your users what this section of your web app is about.</p></div>
<a href="~/Uploads/TimeSlotTemplate.xlsx" download>Download Upload Template</a> <div class="help-tip"> <p>This is the inline help tip! You can explain to your users what this section of your web app is about.</p></div></div>
What I am trying to do is have the help-tip div go right next to the link. The paragraph appears when you put your mouse over the help-tip div. I am looking to get the paragraph to go directly under the help-tip icon in short of an overlay style. When I remove the position absolute for the both elements the icon goes right next to the icon and the paragraph goes under the icon, but it creates a massive amount of space.
Here is my css
.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{ /* The tooltip */
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{ /* 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%; }
}
and here is a jfiddle
https://jsfiddle.net/13275tvz/1/
Need some HTML and CSS Fix
When you are making the element position absolute, make sure it's parent have the position relative property.
HTML
<div class="navigation">
<div class="link-container">
<a href="~/Uploads/TimeSlotTemplate.xlsx" download>Download Upload Template</a> <div class="help-tip"> <p>This is the inline help tip! You can explain to your users what this section of your web app is about.</p></div>
</div>
<div class="link-container">
<a href="~/Uploads/TimeSlotTemplate.xlsx" download>Download Upload Template</a> <div class="help-tip"> <p>This is the inline help tip! You can explain to your users what this section of your web app is about.</p></div></div>
</div>
CSS
.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;
}
.link-container{
position:relative;
display:inline-block;
}
.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: 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{ /* 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 Accordingly..
Link for reference
hope this helps..
you need change position to relative, display to inline-block and desmiss top, right.
.help-tip {
position: relative;
/* 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;
display: inline-block;
}

How to hide tooltip?

I am using css to create tooltip, 4 tooltips are placed sequentially, 2nd tooltip appears on the popup content of 1st tooltip
The following code is placed in between jsp file in liferay, every jsp file has the tooltip code in it. If I open the 1st tooltip, other tooltips appear on the popup content of 1st tooltip,
I need to show the popup contents without any interruption. How do I do that?
My code is
.help-tip {
position: absolute;
top: 34px;
right: 120px;
text-align: center;
background-color: #a3c2c2;
border-radius: 50%;
width: 14px;
height: 10px;
font-size: 10px;
line-height: 16px;
cursor: default;
}
.help-tip:before {
content: '?';
font-weight: normal;
font-size: 10px;
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: center;
/*background-color: #a3c2c2;*/
padding: 5px;
width: 170px;
position: absolute;
border-radius: 6px;
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.4);
right: -100px;
/*color: #000000;*/
font-size: 14px;
line-height: 1.4;
color: #000000;
background: #FBF5E6;
background: -webkit-linear-gradient(top, #FBF5E6, #FFFFFF);
background: linear-gradient(top, #FBF5E6, #FFFFFF);
border: 1px solid #CFB57C;
}
.help-tip p:before {
/* The pointer of the tooltip */
position: absolute;
content: '';
width: 0;
height: 0;
border: 6px solid transparent;
border-bottom-color: #66ccff;
right: 100px;
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%;
}
}
<div class="help-tip">
<p>This is the inline edit help tip!</p>
</div>
Due to using the exact same code for each tooltip, every tooltip will have the CSS property, position: absolute; and that could be causing the problem. Try changing all the positions to relative.

css create translucent background with some text when hover

I want to create a translucent background and display some text when user hover on the image like this http://demo.rocknrolladesigns.com/html/jarvis/#team . Is there anyway to make it without jquery?If yes,can anyone please teach me?
.container {
display: inline-block;
overflow: visible;
font-family: sans-serif;
font-size: 1em;
}
.theimg {
display: block;
width: 314px;
height: 223px;
border: solid 1px lightgray;
border-bottom: none;
transition: all .5s ease;
}
.container:hover .theimg {
opacity: 0.3;
}
.thename {
border: solid 1px lightgray;
text-align: center;
padding: 6px 0 6px 0;
transition: all .5s ease;
}
.container:hover .thename {
color: white;
background-color: #ffd600;
}
.thecover {
position: relative;
text-align: center;
top: -200px;
padding: 6px 0 6px 0;
opacity: 0;
transition: all .5s ease;
}
.container:hover .thecover {
top: -170px;
opacity: 1;
}
.thetitle {
font-size: 1.4em;
color: #515a7c;
font-weight: bold;
display: inline;
opacity: 1;
}
Yes, you can make it with CSS only:
<div class=container>
<img class=theimg src='http://demo.rocknrolladesigns.com/html/jarvis/images/team/team1.png' />
<div class=thename>MIKE ROSS</div>
<div class=thecover>
<div class=thetitle>FOUNDER</div>
</div>
</div>
See this and this for more info. jsfiddle
#wrapper span {
visibility:hidden;
position:absolute;
left: 50px;
top: 70px;
}
#wrapper:hover span {
visibility:visible;
}
#wrapper:hover img {
opacity: 0.4;
filter: alpha(opacity=40); /* For IE8 and earlier */
}
<div id="wrapper">
<img src="http://jonamdall.files.wordpress.com/2011/06/small-nyan-cat11.gif" />
<span>This is cat!</span>
</div>

Tooltip with HTML content without JavaScript

There are plenty of JavaScript-based libraries that show tooltips when you hover your mouse over a certain area of a web page. Some are rather plain, some allow the tooltip to display HTML content styled with CSS.
But is there a way to show a styled tooltip without using JavaScript? If you just use the title attribute, tags are not processed (e.g. foo<br />bar doesn't produce a line break). I'm looking for a solution that allows one to display styled HTML content without using any JavaScript.
I have made a little example using css
.hover {
position: relative;
top: 50px;
left: 50px;
}
.tooltip {
/* hide and position tooltip */
top: -10px;
background-color: black;
color: white;
border-radius: 5px;
opacity: 0;
position: absolute;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-ms-transition: opacity 0.5s;
-o-transition: opacity 0.5s;
transition: opacity 0.5s;
}
.hover:hover .tooltip {
/* display tooltip on hover */
opacity: 1;
}
<div class="hover">hover
<div class="tooltip">asdadasd
</div>
</div>
FIDDLE
http://jsfiddle.net/8gC3D/471/
Using the title attribute:
Link
Similar to koningdavid's, but works on display:none and block, and adds additional styling.
div.tooltip {
position: relative;
/* DO NOT include below two lines, as they were added so that the text that
is hovered over is offset from top of page*/
top: 10em;
left: 10em;
/* if want hover over icon instead of text based, uncomment below */
/* background-image: url("../images/info_tooltip.svg");
/!* width and height of svg *!/
width: 16px;
height: 16px;*/
}
/* hide tooltip */
div.tooltip span {
display: none;
}
/* show and style tooltip */
div.tooltip:hover span {
/* show tooltip */
display: block;
/* position relative to container div.tooltip */
position: absolute;
bottom: 1em;
/* prettify */
padding: 0.5em;
color: #000000;
background: #ebf4fb;
border: 0.1em solid #b7ddf2;
/* round the corners */
border-radius: 0.5em;
/* prevent too wide tooltip */
max-width: 10em;
}
<div class="tooltip">
hover_over_me
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec quis purus dui. Sed at orci. </span>
</div>
This one is very interesting,
HTML and CSS only
.help-tip {
position: absolute;
top: 18px;
left: 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 span {
display: block;
transform-origin: 100% 0%;
-webkit-animation: fadeIn 0.3s ease-in-out;
animation: fadeIn 0.3s ease-in-out;
}
.help-tip span {
display: none;
text-align: left;
background-color: #1E2021;
padding: 5px;
width: 200px;
position: absolute;
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
left: -4px;
color: #FFF;
font-size: 13px;
line-height: 1.4;
}
.help-tip span:before {
position: absolute;
content: '';
width: 0;
height: 0;
border: 6px solid transparent;
border-bottom-color: #1E2021;
left: 10px;
top: -12px;
}
.help-tip span:after {
width: 100%;
height: 40px;
content: '';
position: absolute;
top: -40px;
left: 0;
}
<span class="help-tip">
<span > This is the inline help tip! </span>
</span>
Pure CSS:
.app-tooltip {
position: relative;
}
.app-tooltip:before {
content: attr(data-title);
background-color: rgba(97, 97, 97, 0.9);
color: #fff;
font-size: 12px;
padding: 10px;
position: absolute;
bottom: -50px;
opacity: 0;
transition: all 0.4s ease;
font-weight: 500;
z-index: 2;
}
.app-tooltip:after {
content: '';
position: absolute;
opacity: 0;
left: 5px;
bottom: -16px;
border-style: solid;
border-width: 0 10px 10px 10px;
border-color: transparent transparent rgba(97, 97, 97, 0.9) transparent;
transition: all 0.4s ease;
}
.app-tooltip:hover:after,
.app-tooltip:hover:before {
opacity: 1;
}
<div href="#" class="app-tooltip" data-title="Your message here"> Test here</div>
Another similar way to do it with CSS:
#img { }
#img:hover {visibility:hidden}
#thistext {font-size:22px;color:white }
#thistext:hover {color:black;}
#hoverme {width:50px;height:50px;}
#hoverme:hover {
background-color:green;
position:absolute ;
left:300px;
top:100px;
width:40%;
height:20%;
}
<p id="hoverme"><img id="img" src="http://a.deviantart.net/avatars/l/o/lol-cat.jpg"></img><span id="thistext">LOCATZ!!!!</span></p>
Try the Js Fiddle
Here are some links about transitions and other ways to do it:
http://www.w3schools.com/css3/css3_transitions.asp
http://dev.opera.com/articles/view/css3-show-and-hide/
You can use the title attribute, e.g. if you want to have a Tooltip over a text, just make:
<span title="This is a Tooltip">This is a text</span>
This is my solution for this:
https://gist.github.com/BryanMoslo/808f7acb1dafcd049a1aebbeef8c2755
The element recibes a "tooltip-title" attribute with the tooltip text and it is displayed with CSS on hover, I prefer this solution because I don't have to include the tooltip text as a HTML element!
#HTML
<button class="tooltip" tooltip-title="Save">Hover over me</button>
#CSS
body{
padding: 50px;
}
.tooltip {
position: relative;
}
.tooltip:before {
content: attr(tooltip-title);
min-width: 54px;
background-color: #999999;
color: #fff;
font-size: 12px;
border-radius: 4px;
padding: 9px 0;
position: absolute;
top: -42px;
left: 50%;
margin-left: -27px;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:after {
content: "";
position: absolute;
top: -9px;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #999999 transparent transparent;
visibility: hidden;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover:before,
.tooltip:hover:after{
visibility: visible;
opacity: 1;
}