Giter VIP home page Giter VIP logo

Comments (13)

Vikom avatar Vikom commented on August 18, 2024

I have the same problem. Screenshot for reference.
center-tooltip

from hint.css.

chinchang avatar chinchang commented on August 18, 2024

@renatomartins if you issue is same @Vikom, you could do this:

To the :before elements of hint--top & hint--bottom give a negative margin of 6px.

.hint--top:before, .hit--bottom:before {
 margin-left: -6px;
}

This will center the arrows on the element width. Though tooltips won't be centered as thats lil tricky and is still a question.

from hint.css.

jamiebuilds avatar jamiebuilds commented on August 18, 2024

Without using an additional element instead of ::before, ::after, there is only one decent way of doing this: http://codepen.io/thejameskyle/pen/fzjwy

Even there it breaks in several different places.

I think the best way to handle this would to be to use javascript to modify the existing tooltips, putting them into an additional element. Leaving the current css as is by default.

from hint.css.

robertimes avatar robertimes commented on August 18, 2024

I believe this should do it:

.hint--top:after{
  transform: translateX(-50%);
}

(add necessary browser prefixes)

from hint.css.

stevelacey avatar stevelacey commented on August 18, 2024

I took @robertimes example a little further, this works pretty well for me:

// center hints

.#{$prefix}top, .#{$prefix}bottom {
    &, &:hover, &:focus {
        &:after, &:before {
            transform: translate(-50%, 8px);
            margin-left: 0;
        }
    }
}

from hint.css.

ahfeel avatar ahfeel commented on August 18, 2024

@stevelacey solution works like a charm. +1 !

from hint.css.

stevelacey avatar stevelacey commented on August 18, 2024

@ahfeel I just noticed that my left/right tooltips do a little slide out transition whilst my top/bottom ones don't, presumably because of my fix... it doesn't bother me, I'd rather have them centred, but an inconsistency worth noting.

from hint.css.

sahat avatar sahat commented on August 18, 2024

@stevelacey 👍

from hint.css.

chinchang avatar chinchang commented on August 18, 2024

Working on this as part of #94

from hint.css.

chinchang avatar chinchang commented on August 18, 2024

This is now default behavior of the library from v2.0 :)

from hint.css.

stevelacey avatar stevelacey commented on August 18, 2024

@chinchang now* ?

from hint.css.

chinchang avatar chinchang commented on August 18, 2024

@stevelacey fixed the typo. Thanks...that was a dangerous one :P

from hint.css.

stevelacey avatar stevelacey commented on August 18, 2024

😄👌

from hint.css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.