Also versuche ich, einen kleinen Tooltip-Code für meine Webseite zu erstellen. Ich bin für die nächste Stunde frustriert, weil das einfach nicht funktionieren will. Wenn ich möchte, dass der Tooltip außerhalb des Elements angezeigt wird, zu dem er weitergeleitet wurde, werden alle Leerzeichen im Tooltip zu Zeilenumbrüchen.CSS-Whitespaces werden zu newline, wenn Element außerhalb des übergeordneten Elements steht
/*css*/
*[tooltip=left]:after{
content: attr(data-tooltip);
padding: 10px;
border-radius: 5px;
background: white;
position: absolute;
display: block;
max-width: 200px;
min-height: 15px;
word-spacing:normal;
word-break: keep-all;
top: 50%;
left: calc(100% + 20px);
transform: translateY(-50%);
z-index: 999;
}
*[tooltip=left]:hover:before {
content: "";
position: absolute;
top: 50%;
display: inline;
white-space: pre-line;
transform: translateY(-50%);
margin-left: calc(100% + 10px);
width: 0;
height: 0;
border-style: solid;
border-width: 10px 10px 10px 0;
border-color: transparent #ffffff transparent
}
/*The actual text:
Saves the rendered image as a png file. Notice that the resolution is the same as the document window.*/