Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS responsive floating Tooltips - impossible?

I am trying to make tooltips in pure css and I would like them to be responsive, meaning they should float inside and where there is no space on left side they should show on the right side or top or bottom side for example.

I am trying something like this

Fiddle

span {
  position: relative;
}
div {
  margin: 150px 100px 50px 50px;
  border: 1px solid Black;
  height: 100px;
}
left,
right,
bottom,
top {
  position: absolute;
  background: black;
  color: white;
  max-width: 90px;
}
left {
  left: 0;
}
right {
  right: 0;
}
bottom {
  margin: 0 auto;
  bottom: 0;
  left: 0;
  right: 0;
}
top {
  margin: 0 auto;
  top: 0;
  left: 0;
  right: 0;
}
<span>
<div>
    <top>
        TOP
    </top>
    
    <bottom>
        BOTTOM
    </bottom>
    
    <right>
        RIGHT
    </right>
    
    <left>
        LEFT
    </left>
</div>
</span>

But it really doesn't work.

The real problem is that I can't set fixed widths for the parent element because they have to adapt to any parent element.

I am wondering if is this still possible in pure CSS but looks like I must calculate everything in javascript...

like image 690
itsme Avatar asked Nov 11 '15 07:11

itsme


2 Answers

From what I understand you are doing everything fine, but you just forget that you parent is an inline element (<span>) therefore you must set it as display:inline-block/block in order to work.

From MDN

HTML (Hypertext Markup Language) elements are usually "inline" elements or "block-level" elements. An inline element occupies only the space bounded by the tags that define the inline element. Elements

The following elements are "inline":

b, big, i, small, tt
abbr, acronym, cite, code, dfn, em, kbd, strong, samp, time, var
a, bdo, br, img, map, object, q, script, span, sub, sup
button, input, label, select, textarea

So with that in mind your fiddle will be something like this:

Snippet

span {
  position: relative;
  display: block
}
div {
  margin: 150px 100px 50px 50px;
  border: 1px solid Black;
  height: 100px;
}
left,
right,
bottom,
top {
  position: absolute;
  background: black;
  color: white;
  max-width: 90px;
}
left {
  left: 0;
}
right {
  right: 0;
}
bottom {
  margin: 0 auto;
  bottom: 0;
  left: 0;
  right: 0;
}
top {
  margin: 0 auto;
  top: 0;
  left: 0;
  right: 0;
}
<span>
<div>
    <top>
        TOP
    </top>
    
    <bottom>
        BOTTOM
    </bottom>
    
    <right>
        RIGHT
    </right>
    
    <left>
        LEFT
    </left>
</div>
</span>

Note: with the snippet above the left/right child will be out of the div parent (without changing margin to it), which I'm not sure that's what you want.

So another option (if you want to keep them inside the div parent) is to set the div with position:relative


So in your fiddle by just adding that we have this result:

Snippet:

div {
  margin: 150px 100px 50px 50px;
  border: 1px solid Black;
  height: 100px;
  position: relative
}
left,
right,
bottom,
top {
  position: absolute;
  background: black;
  color: white;
  max-width: 90px;
}
left {
  left: 0;
}
right {
  right: 0;
}
bottom {
  margin: 0 auto;
  bottom: 0;
  left: 0;
  right: 0;
}
top {
  margin: 0 auto;
  top: 0;
  left: 0;
  right: 0;
}
<span>
<div>
    <top>
        TOP
    </top>
    
    <bottom>
        BOTTOM
    </bottom>
    
    <right>
        RIGHT
    </right>
    
    <left>
        LEFT
    </left>
</div>
</span>
like image 113
dippas Avatar answered Nov 16 '22 15:11

dippas


Here is a fully responsive tooltip or modal which utilizes no javascript. (external link to Codepen) You can activate the popup by hovering or clicking.

If you hover, the popup will dismiss once it loses focus (this is the typical behavior experienced on desktop for a tooltip).

You can also click the logo which is what would be done to trigger the popup on a mobile device. If you have activated the popup via click, the popup will remain open until you click the popup a second time to dismiss it. (This is the type of behavior that you would experience on a mobile device with a tooltip or modal window)

This utilizes no javascript by leveraging the CSS pseudo attribute :target and pointer-events. For the :hover and :active classes I have used the general sibling selector and the immediate sibling selector because there is a known bug in some browser when you combine the use of pseudo selectors paired with sibling selectors.

.badge {
  position: relative;
  width: 300px;
  text-align: center;
  user-select: none;
  -webkit-transform: translateZ(0);
}
.logo {
  background-image: url('data:image/gif;base64,R0lGODlhyADIAMQdAG1tbWlpadLS0tvb22RkZPv7+4yMjHZ2dqqqqsrKynx8fLOzs+jo6GBgYKOjo1xcXIODg7q6uu7u7pSUlJubm3FxcfLy8vb29uHh4cLCwv///3R0dHNzc////wAAAAAAACH5BAEAAB0ALAAAAADIAMgAAAX/YCeOZGmeaKqupua+cFxYzCAkWbQsSO/vkUxCM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SyUClFVNlMCAjwKr5F9bE8jy4AFKKAB48FhtORKEWbGU32aYJ9qFbCAspqVtNaLrAUyYAB9BsCMPJvO+fC5LE9VTAR9mJ8BMmCB0eqWtJHVwGkNAPk2fW1nbyZsG5egiNC6EkBfELjtdKNrXkYRowADQAAEQKgvH2VXLyCSVDhlUAH3BgACCBjAIyd63v+iVzgDWIABhtAAye1Lu4FsIbOmgVP2gZCyBzDAAgYgVb0CeK/TPQIDMuAACIDtAfMDQAXgeyRPQYMEJV4uZQEAAQdkALd7zDCN7xbQAjBAAAiYAIjD62NPkPiMc6yAMtzrYxdPAAECYEB/oVvjJ9uYtwNIQAQcYAAIKIADYDuw5A7j5S+H98DLUAAEDOCACCRgAM/dsGOhDGU277EAFmDAAASQgAxEYAELQACf+6znCGQgAQIYAAMs0GQ4uzkPIQAAOw==');
  width: 200px;
  height: 200px;
  cursor: pointer;
  display: block;
  margin: 0 auto
}
#trigger a {
  display: block;
  height: 100%;
  width: 100%;
}
.dialog {
  background: #fff;
  bottom: 100%;
  color: #666;
  display: block;
  left: -25px;
  opacity: 0;
  padding: 25px;
  pointer-events: none;
  position: absolute;
  width: 100%;
  transform: translateY(10px);
  transition: all .25s ease-out;
}
#trigger:hover ~ .dialog,
#trigger:hover + .dialog #trigger:active ~ .dialog,
#trigger:active + .dialog {
  opacity: 1;
}
.dialog:target {
  opacity: 1;
  pointer-events: auto;
}
.close.box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
<div class="badge" style="margin-top:150px;">
  <div id="trigger" class="logo">
    <a href="#open1">&nbsp;</a>
  </div>
  <div id="open1" class="dialog">
    <a href="#close" title="Close" class="close box"></a>
    <h2>Tooltip</h2>

    <p>Click this tooltip to dismiss.</p>

  </div>
</div>
like image 22
davidcondrey Avatar answered Nov 16 '22 14:11

davidcondrey