Prevent words from cutting off into a new line

ditto

I'm wanting to prevent each word within the hover element from cutting off into a new line.

Here's a JSBin of the issue.

It's also vital that the alignment of the tooltip is central to the hover element, and that the hover element is the width of however long the string of text becomes (no set width). How may I do this?

[data-tooltip]:hover {
    position:relative;
}
[data-tooltip]:hover:after {
    margin-top:7px;
    padding:8px;
    content:attr(data-tooltip);
    text-align:center;
    color:#fff;
    border-radius:3px;
    background:rgba(0, 0, 0, .8);
}
[data-tooltip]:hover:after,
[data-tooltip]:hover:before {
    position:absolute;
    top:100%;
    left:50%;
    -webkit-transform:translateX(-50%);
    -ms-transform:translateX(-50%);
    transform:translateX(-50%)
}
[data-tooltip]:hover:before {
    margin-top:2px;
    content:'';
    border-right:6px solid transparent;
    border-bottom:6px solid rgba(0, 0, 0, .8);
    border-left:6px solid transparent;
}
<span data-tooltip="boo">boo</span>
<span data-tooltip="boo boo">boo</span>
<span data-tooltip="boo boo boo">boo</span>
<span data-tooltip="boo boo boo boo">boo</span>
<span data-tooltip="boo boo boo boo">boo</span>
<span data-tooltip="boo boo boo boo boo">boo</span>

lmgonzalves

Add white-space: nowrap; to the tooltip element:

[data-tooltip]:hover:after {
    white-space: nowrap;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Prevent words from cutting off into a new line

From Dev

regex strip off words from line - proceeded by java

From Dev

How to prevent Div from creating a new line

From Dev

PHP cutting off text from a query result

From Dev

d3 line chart cutting off at the top

From Dev

Prevent H1 tag from breaking to new line

From Dev

SwiftUI - Prevent users from adding New Line (\n) in TextEditor

From Dev

CSS prevent span from moving down to new line

From Dev

Remove trailing new line from 'clipboard' to prevent execution on the terminal?

From Dev

How to Prevent TD from ending up on a new line?

From Dev

TranslateAnimation from middle to Top Left without cutting off view

From Dev

Display a string from another cell, cutting off any word fragments

From Dev

How do I prevent Sublime Text 3 from auto-indenting a line as a one off

From Dev

Camera Cutting Off Scene

From Dev

Cutting the corners off a layout

From Dev

Print the same columns as a new line cutting after delimiter in awk

From Dev

How can I prevent shift-delete from cutting in Windows?

From Dev

How to prevent osmconvert from cutting last 2 digits in lat/lon

From Dev

How to prevent input from cutting tails of the letters without changing the height?

From Dev

Prevent flexbox display in a new line

From Dev

Stop PHPStorm from cutting/copying the entire line if nothing is selected

From Dev

Prevent Apple Watch from turning off the screen

From Dev

Prevent the screen from locking when it turns off

From Dev

Remove the multiple comma's from specific column of tab delimited fileand print the words on new line

From Dev

Django cutting off uploaded file

From Dev

CSS transition cutting off early

From Dev

Android ListView footer cutting off

From Dev

Slick Slider - Cutting off Image

From Dev

RecyclerView cutting off last item

Related Related

  1. 1

    Prevent words from cutting off into a new line

  2. 2

    regex strip off words from line - proceeded by java

  3. 3

    How to prevent Div from creating a new line

  4. 4

    PHP cutting off text from a query result

  5. 5

    d3 line chart cutting off at the top

  6. 6

    Prevent H1 tag from breaking to new line

  7. 7

    SwiftUI - Prevent users from adding New Line (\n) in TextEditor

  8. 8

    CSS prevent span from moving down to new line

  9. 9

    Remove trailing new line from 'clipboard' to prevent execution on the terminal?

  10. 10

    How to Prevent TD from ending up on a new line?

  11. 11

    TranslateAnimation from middle to Top Left without cutting off view

  12. 12

    Display a string from another cell, cutting off any word fragments

  13. 13

    How do I prevent Sublime Text 3 from auto-indenting a line as a one off

  14. 14

    Camera Cutting Off Scene

  15. 15

    Cutting the corners off a layout

  16. 16

    Print the same columns as a new line cutting after delimiter in awk

  17. 17

    How can I prevent shift-delete from cutting in Windows?

  18. 18

    How to prevent osmconvert from cutting last 2 digits in lat/lon

  19. 19

    How to prevent input from cutting tails of the letters without changing the height?

  20. 20

    Prevent flexbox display in a new line

  21. 21

    Stop PHPStorm from cutting/copying the entire line if nothing is selected

  22. 22

    Prevent Apple Watch from turning off the screen

  23. 23

    Prevent the screen from locking when it turns off

  24. 24

    Remove the multiple comma's from specific column of tab delimited fileand print the words on new line

  25. 25

    Django cutting off uploaded file

  26. 26

    CSS transition cutting off early

  27. 27

    Android ListView footer cutting off

  28. 28

    Slick Slider - Cutting off Image

  29. 29

    RecyclerView cutting off last item

HotTag

Archive