1
I would like to know, basically, how do these balloons appear when we hover above the icon:
It can appear at any position of the correct screen!?
But how to align it with the icon?
1
I would like to know, basically, how do these balloons appear when we hover above the icon:
It can appear at any position of the correct screen!?
But how to align it with the icon?
3
Utilize tooltip
already included in Bootstrap, see documentation.
Use the attribute data-placement
to set the tip position on the top, bottom, left or right side of the element:
Tip: You can also use the data-placement attribute with an "auto" value, which will allow the browser to decide the tool tip position. For example, if the value is "auto left", the tooltip will be displayed on the left side when possible, otherwise on the right. Source: https://www.w3schools.com/bootstrap/bootstrap_tooltip.asp
$('[data-toggle="tooltip"]').tooltip();
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="Atenção!"></i>
Netinho, I would like to know how to do without a framework, because I have web tools with minimal styles, so it is not convenient to use a framework just for this. But I appreciate the tip!
Thank you. Here’s an example with pure CSS. If that’s what you want, I’ll edit the answer and include the code. https://jsfiddle.net/s7ph5kcu/3/ Att.
3
If you are using bootstrap follow the reply of Netinho Santos, if not using can create and stylize with CSS even.
p {
text-align: center;
margin-top: 50px;
font-size: 30px;
font-weight: bold;
}
p:hover ~ span {
display: block;
}
span {
display: none;
color: #fff;
background-color: red;
width: 13%;
padding: 10px;
border-radius: 4px;
position: relative;
top: -100px;
left: 60%;
}
<p>TEXTO</p>
<span>Informações</span>
Leandro, I would like to know how to do without a framework, because I have web tools with minimal styles, so it is not convenient to use a framework just for this. But I appreciate the tip!
But the example I gave here has no framework is pure CSS.
Oops! Now that I understand! Good! that’s right!
Then I style and position the balloon wherever I want, right !?
Then you will be putting it as you want, this, in the left, in the top, in the background-color if you want another color, in the color for the color of the text, etc...
Leandro, can you explain to me how this works ~
in h1:hover ~ span
? I’ve never seen this before! I wanted to understand better!
By the way, I pass the mouse where is positioned the span
it also appears... it should not be only in "TEXT"?
There I am saying when the text is h1
is with the Hover that is when you have the mouse on top it takes ~
(for this purpose the tilde) element span
and applies the effects.
It’s just that I made a very simple example, this is because span is at the same height or within the H1 there it suffers the effect Hover tbm. But then just position it different or change the tag of the text, has several ways to do.
I edited the answer, blza. Now only when the mouse in the text triggers the tooltip.
He’s taking the whole line...
Yes because it’s a Tg p by default takes the whole line.
Browser other questions tagged javascript html
You are not signed in. Login or sign up in order to post.
Here where I work the proxy does not let see the image, but by the description, I believe you mean
tooltip
(?)– MarceloBoni
@Marceloboni if that’s it
tooltip
, it is stylized. It has how to do this!?– rbz
If I could see the image would help a lot to give you a correct answer kkkk I will try to visualize by cell phone
– MarceloBoni
If you’re using it Bootstrap already comes with tooltip just incorporate it.
– LeAndrade
As you can see here there are several examples of
tooltip
stylized.– MarceloBoni
A complex example of tooltip with 0 dependency on js
– MarceloBoni
@Leandro wanted the basics, to understand how it really works, how to style, etc
– rbz
@Marceloboni really is stylization of
tooltip
? That onetooltip
is not from the browser!?– rbz
Downvoter, tell your -1 reason that I will improve the question! (Each guy suitcases bug)
– rbz