CSS Tooltips

Developer
Size
2,599 Kb
Views
6,072

How do I make an css tooltips?

This is a very basic CSS tooltip, using the data-tooltip element for population. What is a css tooltips? How do you make a css tooltips? This script and codes were developed by Daryll Doyle on 24 January 2023, Tuesday.

CSS Tooltips Previews

CSS Tooltips - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Tooltips</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrapper"> <a href="#" data-tooltip="This is a tooltip" class="tooltip">This is a link element</a> <span data-tooltip="This is a longer tooltip" class="tooltip">This is a span element</span> <div data-tooltip="This is a super long tooltip, it should wrap when it hits the 200px max width" class="tooltip">This is a div!</div> <a href="#" data-tooltip="This is a title element" class="tooltip">This is another link element, this time with a longer link!</a> <a href="#" data-tooltip="" class="tooltip">This is an element with no tooltip content set</a>
</div>
</body>
</html>

CSS Tooltips - Script Codes CSS Codes

.wrapper { padding: 20px; text-align: center;
}
.wrapper * { display: block; margin-top: 30px;
}
.tooltip { position: relative; cursor: pointer;
}
.tooltip:after { content: attr(data-tooltip); display: block; position: absolute; left: 50%; top: -100%; max-width: 200px; background: rgba(0, 0, 0, 0.8); padding: 5px 10px; color: #eee; z-index: 999; -webkit-transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, -webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24); transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, -webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24); transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24); transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24), -webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24); -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); pointer-events: none; visibility: hidden; opacity: 0;
}
.tooltip[data-tooltip]:not([data-tooltip=""]):hover:after { visibility: visible; opacity: 1; -webkit-transform: translateY(-12px); transform: translateY(-12px);
}
CSS Tooltips - Script Codes
CSS Tooltips - Script Codes
Home Page Home
Developer Daryll Doyle
Username darylldoyle
Uploaded January 24, 2023
Rating 3
Size 2,599 Kb
Views 6,072
Do you need developer help for 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!

Daryll Doyle (darylldoyle) Script Codes
Create amazing captions 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!