Pure CSS Tooltips

Developer
Size
2,271 Kb
Views
18,216

How do I make an pure css tooltips?

What is a pure css tooltips? How do you make a pure css tooltips? This script and codes were developed by Karl Saunders on 20 November 2022, Sunday.

Pure CSS Tooltips Previews

Pure CSS Tooltips - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS Tooltips</title> <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="tool-tip" data-tooltip-title="Left tooltip" data-tooltip-position="left">Left</div>
<div class="tool-tip" data-tooltip-title="Top tooltip" data-tooltip-position="top">Top</div>
<div class="tool-tip" data-tooltip-title="Bottom tooltip" data-tooltip-position="bottom">Bottom</div>
<div class="tool-tip" data-tooltip-title="Right tooltip" data-tooltip-position="right">Right</div>
</body>
</html>

Pure CSS Tooltips - Script Codes CSS Codes

body { width: 100vw; height: 100vh; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; font-family: 'Roboto'; font-size: 14px; font-weight: 400; margin: 0;
}
.tool-tip { border: 1px solid #ccc; padding: 5px 15px; position: relative; cursor: pointer; margin: 0 10px; text-transform: uppercase;
}
.tool-tip::after { background-color: #323a45; border-radius: 2px; color: #fff; content: attr(data-tooltip-title) " "; font-weight: normal; min-width: 100px; padding: 5px 8px; text-align: center; text-transform: none;
}
.tool-tip::before { width: 0; height: 0; content: "";
}
.tool-tip::before,
.tool-tip::after { position: absolute; -webkit-transition: opacity 250ms ease 0ms, -webkit-transform 250ms ease 0ms; transition: opacity 250ms ease 0ms, -webkit-transform 250ms ease 0ms; transition: opacity 250ms ease 0ms, transform 250ms ease 0ms; transition: opacity 250ms ease 0ms, transform 250ms ease 0ms, -webkit-transform 250ms ease 0ms; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; opacity: 0; z-index: -1;
}
.tool-tip[data-tooltip-position="top"]::after,
.tool-tip[data-tooltip-position="bottom"]::after { left: 50%;
}
.tool-tip[data-tooltip-position="top"]::after { -webkit-transform: translate3d(-50%, 10px, 0); transform: translate3d(-50%, 10px, 0);
}
.tool-tip[data-tooltip-position="bottom"]::after { -webkit-transform: translate3d(-50%, -10px, 0); transform: translate3d(-50%, -10px, 0);
}
.tool-tip[data-tooltip-position="top"]::after { bottom: calc(100% + 10px);
}
.tool-tip[data-tooltip-position="bottom"]::after { top: calc(100% + 10px);
}
.tool-tip[data-tooltip-position="left"]::after,
.tool-tip[data-tooltip-position="right"]::after { top: 50%;
}
.tool-tip[data-tooltip-position="left"]::after { -webkit-transform: translate3d(10px, -50%, 0); transform: translate3d(10px, -50%, 0);
}
.tool-tip[data-tooltip-position="right"]::after { -webkit-transform: translate3d(-10px, -50%, 0); transform: translate3d(-10px, -50%, 0);
}
.tool-tip[data-tooltip-position="left"]::after { right: calc(100% + 10px);
}
.tool-tip[data-tooltip-position="right"]::after { left: calc(100% + 10px);
}
/* Pointers */
.tool-tip[data-tooltip-position="top"]::before,
.tool-tip[data-tooltip-position="bottom"]::before { border-left: 7px solid transparent; border-right: 7px solid transparent; left: 50%;
}
.tool-tip[data-tooltip-position="top"]::before { -webkit-transform: translate3d(-50%, 10px, 0); transform: translate3d(-50%, 10px, 0);
}
.tool-tip[data-tooltip-position="bottom"]::before { -webkit-transform: translate3d(-50%, -10px, 0); transform: translate3d(-50%, -10px, 0);
}
.tool-tip[data-tooltip-position="top"]::before { border-top: 7px solid #323a45; bottom: calc(100% + 3px);
}
.tool-tip[data-tooltip-position="bottom"]::before { border-bottom: 7px solid #323a45; top: calc(100% + 3px);
}
.tool-tip[data-tooltip-position="left"]::before,
.tool-tip[data-tooltip-position="right"]::before { border-top: 7px solid transparent; border-bottom: 7px solid transparent; top: 50%;
}
.tool-tip[data-tooltip-position="left"]::before { -webkit-transform: translate3d(10px, -50%, 0); transform: translate3d(10px, -50%, 0);
}
.tool-tip[data-tooltip-position="right"]::before { -webkit-transform: translate3d(-10px, -50%, 0); transform: translate3d(-10px, -50%, 0);
}
.tool-tip[data-tooltip-position="left"]::before { border-left: 7px solid #323a45; right: calc(100% + 3px);
}
.tool-tip[data-tooltip-position="right"]::before { border-right: 7px solid #323a45; left: calc(100% + 3px);
}
.tool-tip:hover::before,
.tool-tip:hover::after { opacity: 1; z-index: 100;
}
.tool-tip[data-tooltip-position="top"]:hover::before,
.tool-tip[data-tooltip-position="bottom"]:hover::before,
.tool-tip[data-tooltip-position="top"]:hover::after,
.tool-tip[data-tooltip-position="bottom"]:hover::after { -webkit-transform: translate3d(-50%, 0px, 0); transform: translate3d(-50%, 0px, 0);
}
.tool-tip[data-tooltip-position="left"]:hover::before,
.tool-tip[data-tooltip-position="right"]:hover::before,
.tool-tip[data-tooltip-position="left"]:hover::after,
.tool-tip[data-tooltip-position="right"]:hover::after { -webkit-transform: translate3d(0px, -50%, 0); transform: translate3d(0px, -50%, 0);
}
Pure CSS Tooltips - Script Codes
Pure CSS Tooltips - Script Codes
Home Page Home
Developer Karl Saunders
Username Mobius1
Uploaded November 20, 2022
Rating 3
Size 2,271 Kb
Views 18,216
Do you need developer help for Pure CSS Tooltips?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Karl Saunders (Mobius1) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!