CSS only tooltips
How do I make an css only tooltips?
What is a css only tooltips? How do you make a css only tooltips? This script and codes were developed by Samuel Janes on 14 September 2022, Wednesday.
CSS only tooltips - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS only tooltips</title> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,400i,700" rel="stylesheet"> <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='center'> <div class='field'> <button class='has-tooltip'>This is a button</button> <span class='tooltip blue'><p>This is a blue tooltip</p></span> </div> <div class='field'> <button class='has-tooltip'>This is a button</button> <span class='tooltip red'> <p>This is a red tooltip</p> <img src="http://www.placehold.it/1920X1080" /> </span> </div> <div class='field'> <button class='has-tooltip'>This is a button</button> <span class='tooltip green'> <p>This is a green tooltip</p> </span> </div> <div class='field'> <button class='has-tooltip'>This is a button</button> <span class='tooltip purple'> <p>This is a purple tooltip</p> </span> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
</body>
</html>
CSS only tooltips - Script Codes CSS Codes
* { box-sizing: border-box;
}
body { min-height: 100vh; display: flex; justify-content: center; align-items: center;
}
body, button, input, textarea, select { font-family: "Raleway", sans-serif;
}
.center { width: 100%; max-width: 1200px; text-align: center; margin: auto; display: flex; justify-content: center; flex-wrap: wrap; padding: 20px;
}
button, .btn, input[type='submit'] { padding: 20px 60px; border: none; outline: none; background: #47b8e0; transition: 0.15s ease-in-out; color: white; text-decoration: none; border-radius: 5px; display: inline-block;
}
button:hover, button:focus, .btn:hover, .btn:focus, input[type='submit']:hover, input[type='submit']:focus { background: #23a3d1;
}
.has-tooltip:hover + .tooltip,
.has-tooltip:focus + .tooltip,
.has-tooltip.hover + .tooltip { opacity: 1; transform: translate(-50%, -100%) scale(1) rotate(0deg); pointer-events: inherit;
}
.tooltip { display: block; position: absolute; top: 0px; left: 50%; transform: translate(-50%, -50%) scale(0.75) rotate(5deg); transform-origin: bottom center; padding: 10px 30px; border-radius: 5px; background: rgba(0, 0, 0, 0.75); text-align: center; color: white; transition: 0.15s ease-in-out; opacity: 0; width: 100%; max-width: 100vw; pointer-events: none; z-index: 5;
}
.tooltip.blue { background: rgba(71, 184, 224, 0.75);
}
.tooltip.blue:after { border-top: 5px solid rgba(71, 184, 224, 0.75);
}
.tooltip.red { background: rgba(231, 29, 54, 0.75);
}
.tooltip.red:after { border-top: 5px solid rgba(231, 29, 54, 0.75);
}
.tooltip.green { background: rgba(46, 196, 182, 0.75);
}
.tooltip.green:after { border-top: 5px solid rgba(46, 196, 182, 0.75);
}
.tooltip.purple { background: rgba(165, 147, 224, 0.75);
}
.tooltip.purple:after { border-top: 5px solid rgba(165, 147, 224, 0.75);
}
.tooltip:hover { opacity: 1; transform: translate(-50%, -100%) scale(1) rotate(0deg); pointer-events: inherit;
}
.tooltip img { max-width: 100%;
}
.tooltip:after { content: ""; display: block; margin: 0 auto; widtH: 0; height: 0; border: 5px solid transparent; border-top: 5px solid rgba(0, 0, 0, 0.75); position: absolute; bottom: 0; left: 50%; transform: translate(-50%, 100%);
}
.field { position: relative; padding: 20px;
}
Developer | Samuel Janes |
Username | SamuelJanes |
Uploaded | September 14, 2022 |
Rating | 4.5 |
Size | 3,273 Kb |
Views | 24,288 |
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!
Name | Size |
Clipped Navigation | 2,966 Kb |
Multi-Step Sign Up Form | 4,177 Kb |
Material Ripple Effect on Button | 2,972 Kb |
New Portfolio Idea | 8,720 Kb |
Bottom Right Menu | 2,426 Kb |
Responsive Carousel Slider with Jquery | 3,456 Kb |
Navigation layout | 3,069 Kb |
Navigation triangle | 2,759 Kb |
Modest Mouse Night on the Sun in CSS | 3,042 Kb |
Hamburger Menus | 2,520 Kb |
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!
Name | Username | Size |
Slider | Mohammed-fawzy | 2,634 Kb |
Review test | Otro_user_gil | 4,054 Kb |
A Different Type of Gallery | DonPage | 2,950 Kb |
Exploding Text | Jjmartucci | 4,749 Kb |
CSS Grid Overlay | Cliffpyles | 3,090 Kb |
Simple search using AngularJS | Haykou | 1,802 Kb |
CSS 3D Radio buttons | Andreasnylin | 1,650 Kb |
Mosaic transition effect between two photos using jQuery | Stathisg | 2,518 Kb |
A Pen by Xand0r | Xand0r | 1,928 Kb |
A Pen by John Malc | F789gh | 1,420 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!