#css text hover effect
Explore tagged Tumblr posts
Text
3D Text Hover Effect
#3d text hover effect#text effect css#codingflicks#html css#frontend#html#css#frontenddevelopment#webdesign#css text effects#css text shadow#css text hover effect
4 notes
·
View notes
Photo

Pure CSS Shrink Text Animation on Hover
#shrink text animation#css shrink text animation#CSS Text Animation#css text effects#css animation#css animation examples#learn css animation#learn css#css tricks#css hover animation#html css#codenewbies
0 notes
Text
CULPA MIA - MULTIMUSE MUSE PAGE !!!
This page is completely free. Please support me and my work by liking or reblogging this post.
[ INFORMATION ]
THIS CODE IS 100% JAVASCRIPT FREE!!!
This code comes in three versions: one with rules pop up and one without. one version is with filters.
Info on the filter version: For the sake of proper styling, the filters won't work on all browsers! A pic preview can be found here. Further explanations can be found in the code! Please read carefully.
The theme will adjust to (almost) all screen sizes.
All colors and effects are easy editable. Not many colors are needed.
The code offers 2 main links (Home and Ask) but also two free individual links.
Muse boxes come in two versions (with and without text box).
Hover effect on the muse pictures that reveal individual links (the amount of links is up to you!). Links can be easily edited out to remove the hover effect.
Grayfilter & Colored overlay for Muse Pictures available! (Please read in the root section of the css code very closely. It comes with explanations)
[ GUIDELINES ]
Do not claim as your own.
Do not remove the credit!
Do not use as a base code or take parts of this code for your theme.
Feel free to edit as much as you want!
Further credits and inspiration credits can be found in the code.
Click the SOURCE LINK to be redirected to the preview and the code!
#multimuse page theme#free theme#muse page#muse page theme#page theme#rp theme#theme#indie rp#rph#rpc
438 notes
·
View notes
Text

🧡 Tuesday Tips #3 🧡
Your website is more than just a collection of pages—it’s your digital home. It should reflect you, your interests, and your personality. But with so many sites out there, how do you make yours stand out?
Here are 25 ways to make your website feel more personal, unique, and personalized to you!
........................................................................................................
🎨 Design & Aesthetics
1. Custom Color Palette – Pick colors that resonate with your personality and aesthetic.
2. Unique Typography Choices – Use a mix of fonts that match your vibe.
3. Handwritten or Doodle Elements – Add personal sketches or notes.
4. Custom Cursor – Let visitors use a fun, themed cursor on your site.
5. Personalized Favicon – A tiny but powerful detail that makes your site feel complete.
6. Themed Layouts for Different Pages – Make each page visually distinct but cohesive.
7. Custom Backgrounds – Textures, gradients, or even a personal photograph.
8. Retro or Experimental CSS Styles – Go wild with unique styles that make your site stand out.
9. Create a Custom Hand-Drawn Logo – Instead of a standard logo, try sketching one yourself for a unique touch.
10. Add Subtle Animations – Small hover effects, background animations, or cursor trails can bring your site to life.
11. Play With Layering Elements – Overlap images, text, and shapes for a more dynamic look.
12. Design a Personalized Loading Screen – A custom loading animation or message adds a fun detail visitors will remember.
13. Add Your Own Handwriting as a Font – Convert your handwriting into a web font for a truly personal touch.
14. Design a Seasonal Theme Switcher – Let visitors toggle between different seasonal or mood-based color palettes.
........................................................................................................
📜 Content & Personality
15. Create a Behind-the-Scenes Page – Show how your website was built, share your thought process, or include fun bloopers.
16. Add a "The Making Of" Section – Share drafts, sketches, or early concepts behind your creative works.
17. Include a Personal Dictionary of Words You Love – A list of favorite words, phrases, or slang you frequently use.
18. Design a "Things That Make Me Happy" Page – A simple, uplifting page filled with personal joys.
19. Show Your Progress on a Learning Goal – Track and share your journey in learning a new skill, language, or hobby.
........................................................................................................
💾 Interactivity & Engagement
20. Add a Clickable Mood Indicator – Let visitors see your current mood with an emoji or phrase that changes over time.
21. Create a Dynamic Banner That Updates Automatically – Display different messages depending on the time of day or special occasions.
22. Add a "What I'm Listening To" Widget – A live-updating display of your current favorite song or playlist.
23. Embed a Poll or Voting Feature – Let visitors vote on fun topics or help you make creative decisions.
24. Introduce a Mini Personality Quiz – Something quirky like “Which of my favorite books/movies are you?”
25. Make an "Ask Me Anything" Page – An interactive page where visitors can submit questions for you to answer.
Closing: Make It Yours!
Your website should be you in digital form—fun, unique, and engaging. Whether you add just one or all 25 ideas, the most important thing is to have fun and make it your own.
If you try any of these ideas, let me know—I’d love to see what you create!
-----------------------------------------------------------------
Want to help the Small Web movement grow?
Join us on other platforms. ♥
FB Page & Group:
facebook.com/thesmallweb
facebook.com/groups/thesmallweb
Twitter/X:
x.com/smallweblove
Tumblr Community:
tumblr.com/communities/thesmallweb
Mastodon:
indieweb.social/@thesmallweb
#small web#indie web#web revival#old web#blog#neocities#2000s web#decentralized social media#decentralizedfuture#old internet#decentralization
16 notes
·
View notes
Note
Sorry to throw another ask at ya like this, but I meant to ask this in the last one.
How did you do that cool text trick in the new chapter?
It's alright! I'm actually really proud of being able to get that effect to work!
It's a little bit of CSS i managed to find! You can find a whole explanation here!
It was a bit of a pain in the ass because every time i wanted to make a new line with that effect, i needed to add a new class to the Work Skin. So the Work Skin Page wound up comically long and looking like this:
i had them labeled as hovertext1, hovertext2, hovertext3 etc.
Also it doesn't like quotation marks. Broke the whole thing because i added quotations out of habit since it was dialogue. so it would be best to format it like "<changing text here>"
But yeah if you want the full details then check out that link!!
27 notes
·
View notes
Text
Weekly News for Designers № 727 - Fixing CLS Problems, CSS One-Line Upgrades, Future Roles for Designers
New Post has been published on https://thedigitalinsider.com/weekly-news-for-designers-%e2%84%96-727-fixing-cls-problems-css-one-line-upgrades-future-roles-for-designers/
Weekly News for Designers № 727 - Fixing CLS Problems, CSS One-Line Upgrades, Future Roles for Designers
Happy Birthday, Macintosh Forty years ago, Apple introduced the world to the Macintosh computer.
Free Instagram Story Templates A collection of Instagram Story templates for Photoshop, Figma, Sketch, After Effects, Premiere Pro, and Final Cut Pro.
12 Modern CSS One-Line Upgrades Learn about the CSS properties to enhance your projects, reduce technical debt, eliminate JavaScript, and improve the UX.
The Diagram that Shows the Value of Great UX
Fading Content Using Transparent Gradients in CSS Here are two methods for achieving text content fading with CSS. One uses mask-image and the other background-clip.
Top Logo Stinger Premiere Pro Templates We share a collection of logo stinger templates for Premiere Pro that stand out with their style, functionality, and ease of use.
Five Future Roles for Designers Jorge Arango shares five possible future careers for designers in our now AI-driven world.
CSS Blurry Shimmer Effect Learn how to create a CSS blurring effect, but not with box-shadow.
The CSS Snippets Every Developer Should Know Discover the CSS snippets that every front-end developer should know about in 2024.
What’s the Environmental Impact of Your Website? Eric examines the relationship between the web and the planet and shows how to measure your website’s impact.
Git and GitHub Essentials If you’re new to Git or GitHub, this extensive beginner’s guide of the most common commands is for you.
Fixing Cumulative Layout Shift Problems
The Most Underused CSS Media Queries: hover & any-hover Learn how to use the hover and any-hover media queries for responsive design and better experiences on all devices.
Improve Your Logo Design Skills Melinda Livsey shares how she improved her logo design skills by studying the work of Paul Rand and Saul Bass.
#2024#After Effects#ai#amp#apple#background#background-clip#bass#birthday#box#box-shadow#Careers#computer#content#CSS#CSS Snippets#Design#Designer News#designers#Developer#devices#effects#Environmental#environmental impact#figma#Future#git#github#gradients#hover
2 notes
·
View notes
Text
Create Inline & Floating Social Share Bars With The Socializer.css
Socializer.css is a CSS library that makes it easy to create inline or floating share buttons for all major social platforms including Facebook, Twitter, WhatsApp, Reddit, LinkedIn, Pinterest, and more. With 6 button shapes, 9 hover effects, 5 text styles, and over 15 customization options for borders, backgrounds, and shadows – you have over 13,000 possible variations to fit any design…

View On WordPress
2 notes
·
View notes
Text
Yet Another Age Verification Pop-up for Squarespace
I wanted to add an Age Gate / Age Verification pop-up for Squarespace. The top search engine result had some code, but it A) didn't work B) didn't look very good and C) didn't have any functionality for tracking cookies. Instead, use this code:
First, put this into the injected code in the Header
<!-- Age Verification Pop-up HTML --> <div id="age-verification-popup"> <div class="popup-content"> <h2>ARE YOU 21+?</h2> <div class="image-circle-container" style="margin-bottom: 24px;"> <img src="https://images.squarespace-cdn.com/content/6788837817ec6330feff09fe/a0416e38-e21f-4f14-88b3-0a8c8589e435/lambi_lamb_black.png" alt="LAMBI" class="centered-image" fetchpriority="high" loading="eager" decoding="async" data-loader="raw"> </div> <div class="button-container"> <button id="verify-button-yes">YES</button> <button id="verify-button-no">NO</button> </div> <p class="disclaimer"> You must be of legal drinking age in<br> your respective country for entry.<br><br> We encourage drinking responsibly! </p> </div> </div>
Next, inject this CSS:
/* Style for Age Verification Pop-up */ #age-verification-popup { display: none; /* Initially hidden, JS will show it if needed */ position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent black overlay */ z-index: 9999; font-family: Arial, sans-serif; /* Or choose a font that matches */ } .popup-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #fff; /* White background */ padding: 40px 30px; /* Adjust padding as needed */ text-align: center; border: 1px solid #ccc; /* Optional: adds a light border */ min-width: 300px; /* Minimum width */ box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Optional subtle shadow */ } /* Optional logo styling */ /* .popup-logo { max-width: 80px; margin-bottom: 20px; } */ .popup-content h2 { font-size: 1.2em; /* Adjust size as needed */ margin-top: 0; margin-bottom: 25px; font-weight: bold; line-height: 1.4; color: #000; /* Black text */ } .button-container { margin-bottom: 25px; } #verify-button-yes, #verify-button-no { background-color: #000; /* Black background */ color: #fff; /* White text */ padding: 12px 30px; /* Adjust padding */ border: none; cursor: pointer; font-size: 1em; font-weight: bold; margin: 0 5px; /* Space between buttons */ min-width: 80px; /* Minimum width for buttons */ transition: background-color 0.2s ease; /* Smooth hover effect */ } #verify-button-yes:hover, #verify-button-no:hover { background-color: #333; /* Slightly lighter black on hover */ } .popup-content .disclaimer { font-size: 0.9em; /* Smaller font size for disclaimer */ color: #555; /* Grey text */ line-height: 1.5; } .image-circle-container { width: 70px; /* Adjust size of the circle as needed */ height: 70px; /* Must be the same as width for a perfect circle */ background-color: transparent; /* Black background */ border-radius: 50%; /* This makes the div circular */ display: flex; /* Enables flexbox for easy centering */ justify-content: center; /* Centers content (image) horizontally */ align-items: center; /* Centers content (image) vertically */ overflow: hidden; /* Ensures image doesn't spill outside the circle if it's too big */ margin-left: auto; /* Centers the circle container itself horizontally */ margin-right: auto; /* Centers the circle container itself horizontally */ } .centered-image { display: block; /* Removes extra space below the image */ height: 50px; /* Your desired image height */ width: auto; /* Let width adjust automatically to maintain aspect ratio */ max-width: 90%; /* Optional: Prevents image from touching the circle edge */ max-height: 90%;/* Optional: Prevents image from touching the circle edge */ }
Finally, inject this code into the footer
<script> // JavaScript for Age Verification Pop-up with Cookies document.addEventListener("DOMContentLoaded", function () { const popup = document.getElementById("age-verification-popup"); const verifyButtonYes = document.getElementById("verify-button-yes"); const verifyButtonNo = document.getElementById("verify-button-no"); const cookieName = "ageVerified"; // Name of our cookie // Function to set a cookie function setCookie(name, value, days) { let expires = ""; if (days) { const date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toUTCString(); } // Add SameSite=Lax and Secure attributes for better security, especially if using HTTPS // For local testing (http), you might omit 'Secure' // document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=Lax; Secure"; document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=Lax"; // Use this line if not using HTTPS for testing } // Function to get a cookie function getCookie(name) { const nameEQ = name + "="; const ca = document.cookie.split(';'); for(let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) === ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); } return null; } // Check if the age verification cookie exists const isVerified = getCookie(cookieName); if (!isVerified) { // If the cookie doesn't exist, show the pop-up if (popup) { popup.style.display = "block"; } } else { // If the cookie exists, keep the pop-up hidden (it's hidden by default CSS) console.log("Age already verified."); } // Event listener for the "YES" button if (verifyButtonYes) { verifyButtonYes.addEventListener("click", function () { // Set a cookie to remember verification for 365 days setCookie(cookieName, "yes", 365); // Hide the pop-up if (popup) { popup.style.display = "none"; } }); } // Event listener for the "NO" button if (verifyButtonNo) { verifyButtonNo.addEventListener("click", function () { // Redirect the user to the specified URL when they click "NO" window.location.href = "https://www.youtube.com/watch?v=s50vvwTystA"; }); } }); </script>
Enjoy!
0 notes
Text
Tutorial: 3D effect em textos
Exemplo do efeito aqui!
Existem dois tipos de efeitos! O sem hover (o exemplo de cima) e o com hover (o exemplo de baixo)
Agora, vou ensinar a fazer o efeito sem hover.
Primeiramente, você deve colocar esse code no seu css.
3dht {color: #666;
font-family: ‘Calibri’;
font-size:25px;
line-height:25px;
font-weight: italic;
margin:0px;
padding:0px;
text-align:center;
letter-spacing: 1px;
text-shadow: -2px 0px #E86060, 2px 0px #54d2cb;
}
(o que dá o efeito 3D é o que está em negrito, no código acima)
Para aplicar o efeito 3D, cole esse código onde você quiser que apareça.
<3dht>Título em 3D aqui</3dht>
Agora, vou ensinar a fazer o efeito com hover.
Cole esse código no seu css.
3dht2 {
color: #666;
font-family: 'Calibri’;
font-size:25px;
line-height:25px;
font-weight: italic;
margin:0px;
padding:0px;
text-align:center;
letter-spacing: 1px;
text-shadow: -2px 0px #E86060, 2px 0px #54d2cb;
}
3dht2:hover {
text-shadow: 0px 0px #666, 0px 0px #696969;
transition: all .5s ease-in-out!important;
-webkit-transition: all .5s ease-in-out!important;
}
(o que dá o efeito hover é o que está em negrito, no código acima)
Para aplicar esse feito 3D com hover, você deve usar esse código.
<3dht2>Título em 3D aqui</3dht2>
0 notes
Text
CSS Animated Text Overlay
#css animated text overlay#css animation examples#html css animation#css animation tutorial#html css#codingflicks#frontend#css#html#css3#frontenddevelopment#learn to code#webdesign#animation#css image hover effects
10 notes
·
View notes
Video
youtube
Divi Pro Secret: Build a Dynamic Button That Shifts Colors Like Magic!
Learn how to create a Divi Theme Custom Animated Color Changing Button using the Divi Text Module, custom CSS, and built-in hover options. This eye-catching button effect adds a dynamic touch to your website, making your call-to-action stand out. With just a few tweaks, you can create a smooth color-changing animation that reacts to user interaction, enhancing both design and user engagement. Whether you're designing a landing page, sales funnel, or interactive UI, this Divi animated button will help your site look more professional and modern.
0 notes
Video
youtube
Mastering Animated CSS Text Effects with Animate.css in Minutes!
YOUTUBE DESCRIPTION
Looking to master Animated CSS Text Effects with Animate.css in minutes? This video is your ultimate guide to making your website stand out with stunning animations! Whether you're a beginner or an experienced developer, I'll walk you through the best Animate.css effects, customization tips, and real-world applications to make your website visually engaging.
🚀 What You’ll Learn: ✅ How to easily integrate Animate.css into your website ✅ The top CSS text effects that grab user attention ✅ Real-world examples and best practices ✅ Advanced customization to enhance user experience
No prior coding experience? No worries! This tutorial is beginner-friendly and gets straight to the point. By the end of this video, you’ll be creating smooth and eye-catching text animations like a pro!
💡 Want more CSS tricks? Subscribe for weekly tutorials and hit the bell icon to stay updated!
📌 10 SEO-Optimized Hashtags
#CSSAnimations #WebDesign #AnimateCSS #TextEffects #WebDevelopment #FrontendDevelopment #HTMLCSS #CSSTricks #AnimatedText #WebDesignTips
🔑 35 SEO Tags
animated css text effects, animate.css tutorial, how to use animate.css, css animations, web design animations, text animation css, best css animations, easy css text effects, css animation library, animate.css examples, css motion graphics, how to animate text with css, cool css text effects, web design tricks, modern web design, html css animations, css animation tutorial, css hover effects, front-end development, animate.css cdn, smooth text animations, css transition effects, animate.css for beginners, how to create text animations, css3 animations, css keyframes, website animation effects, css typography, best css libraries, how to use css animations, text effects with css, best css animation library, animate.css vs gsap, simple text animations
0 notes
Text
Lightboxes
YAYINDA! https://mguzel.com.tr/lightboxes/
Lightboxes
Lightboxes Shortcodes
The lightboxes are driven by Visual Composer Single Image shortcodes.
Single Image
Simple popups with different styles.
DEFAULT
DEFAULT WITH BORDER
WITH ICON
HOVER EFFECT
Simple Image Gallery
Image gallery in the same row.
Zoom Image Gallery
Image gallery in the same row.
Zoom Image Gallery + Carousel
Dialog with CSS animation
Animations are added with simple CSS transitions, you can make them look however you wish.
Open with fade-zoom animation
Dialog example
This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.
Open with fade-slide animation
Dialog example
This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.
Popup with video or map
In this example lightboxes are automatically disabled on small screen size and default behavior of link is triggered.
Open YouTube Video
Open Vimeo Video
Open Google Map
Open YouTube Video
Open Vimeo Video
Open Google Map
Ajax
You have full control of what is displayed in popup, align it to any side via CSS, enable or disable scroll on right side of window.
Load Ajax Content
Form
Entered data is not lost if you open and close the popup or if you go to another page and then press back browser button.
Open Form
Hata: İletişim formu bulunamadı.
0 notes
Text
Dark Mode Design: Why It’s Popular and How to Do It Right
Why Is Dark Mode So Popular?
Dark mode has become a widely adopted UI trend due to its aesthetic appeal, reduced eye strain, and energy efficiency. Major platforms like Apple, Google, and Microsoft have embraced dark mode as a standard feature.
Key Benefits of Dark Mode:
✅ Reduces Eye Strain: Ideal for low-light environments, making text easier to read. ✅ Battery Efficiency: OLED and AMOLED screens consume less power in dark mode. ✅ Modern & Stylish Aesthetic: Gives apps and websites a sleek, futuristic look. ✅ Improves Focus: Reduces screen glare, making content stand out.
How to Design Dark Mode Correctly
1. Choose the Right Dark Color Palette 🎨
Avoid pure black (#000000), as it creates high contrast and strain.
Use dark grays (e.g., #121212, #1E1E1E) for a softer, comfortable UI.
Accent colors should be muted to prevent harsh brightness.
👉 Example: Google’s Material Design suggests #121212 as a dark mode base.
2. Maintain Proper Contrast for Readability 🔤
Text should be light but not too bright (e.g., #E0E0E0 instead of pure white #FFFFFF).
Aim for a contrast ratio of at least 4.5:1 for accessibility.
Avoid using bright neon colors on dark backgrounds, as they can cause eye strain.
3. Use Soft Shadows and Elevation 🏔️
Add subtle shadows to distinguish elements instead of bright borders.
Use translucent overlays instead of solid background colors.
Ensure hover and focus states remain visible in dark mode.
👉 Example: Apple’s macOS Big Sur UI uses soft highlights and depth effects.
4. Allow Users to Toggle Between Light & Dark Mode 🔄
Provide a theme switcher so users can choose their preference.
Detect system-wide dark mode settings and adjust UI automatically.
👉 Example: Many websites use prefers-color-scheme in CSS to detect dark mode:css@media (prefers-color-scheme: dark) { body { background-color: #121212; color: #E0E0E0; } }
5. Optimize Images and Icons for Dark Mode 🖼️
Transparent PNGs or SVGs should adapt to both light and dark themes.
Use lighter versions of images and logos for better contrast.
👉 Example: Google Chrome’s dark mode version of the logo has lighter edges for visibility.
6. Ensure Accessibility and User Comfort ♿
Follow WCAG (Web Content Accessibility Guidelines) to ensure readability.
Allow users to adjust brightness and contrast in settings.
Use color-blind-friendly palettes for a more inclusive design.
Conclusion
Dark mode is not just a trend — it’s a UX necessity that improves readability, enhances aesthetics, and saves battery life. However, designing it properly requires careful color choices, contrast management, and accessibility considerations.
WEBSITE: https://www.ficusoft.in/web-designing-training-in-chennai/
0 notes
Text
Next Level CSS Styling for Cursors
New Post has been published on https://thedigitalinsider.com/next-level-css-styling-for-cursors/
Next Level CSS Styling for Cursors
The cursor is a staple of the desktop interface but is scarcely touched by websites. This is for good reason. People expect their cursors to stay fairly consistent, and meddling with them can unnecessarily confuse users. Custom cursors also aren’t visible for people using touch interfaces — which excludes the majority of people.
Geoff has already covered styling cursors with CSS pretty comprehensively in “Changing the Cursor with CSS for Better User Experience (or Fun)” so this post is going to focus on complex and interesting styling.
Custom cursors with JavaScript
Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can use an element as our cursor, which lets us style it however we would anything else. This lets us transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.
In its most basic form, we just need a div that continuously positions itself to the cursor location. We can do this with the mousemove event listener. While we’re at it, we may as well add a cool little effect when clicking via the mousedown event listener.
That’s wonderful. Now we’ve got a bit of a custom cursor going that scales on click. You can see that it is positioned based on the mouse coordinates relative to the page with JavaScript. We do still have our default cursor showing though, and it is important for our new cursor to indicate intent, such as changing when hovering over something clickable.
We can disable the default cursor display completely by adding the CSS rule cursor: none to *. Be aware that some browsers will show the cursor regardless if the document height isn’t 100% filled.
We’ll also need to add pointer-events: none to our cursor element to prevent it from blocking our interactions, and we’ll show a custom effect when hovering certain elements by adding the pressable class.
Very nice. That’s a lovely little circular cursor we’ve got here.
Fallbacks, accessibility, and touchscreens
People don’t need a cursor when interacting with touchscreens, so we can disable ours. And if we’re doing really funky things, we might also wish to disable our cursor for users who have the prefers-reduced-motion preference set.
We can do this without too much hassle:
What we’re doing here is checking if the user is accessing the site with a touchscreen or if they prefer reduced motion and then only enabling the custom cursor if they aren’t. Because this is handled with JavaScript, it also means that the custom cursor will only show if the JavaScript is active, otherwise falling back to the default cursor functionality as defined by the browser.
const isTouchDevice = "ontouchstart"in window || navigator.maxTouchPoints > 0; const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches; if (!isTouchDevice && !prefersReducedMotion && cursor) // Cursor implementation is here
Currently, the website falls back to the default cursors if JavaScript isn’t enabled, but we could set a fallback cursor more similar to our styled one with a bit of CSS. Progressive enhancement is where it’s at!
Here we’re just using a very basic 32px by 32px base64-encoded circle. The 16 values position the cursor hotspot to the center.
html cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0Jve D0iMCAwIDMyIDMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iYmxhY2siIC8+Cjwvc3ZnPg==") 16 16, auto;
Taking this further
Obviously this is just the start. You can go ballistic and completely overhaul the cursor experience. You can make it invert what is behind it with a filter, you can animate it, you could offset it from its actual location, or anything else your heart desires.
As a little bit of inspiration, some really cool uses of custom cursors include:
Studio Mesmer switches out the default cursor for a custom eye graphic when hovering cards, which is tasteful and fits their brand.
Iara Grinspun’s portfolio has a cursor implemented with JavaScript that is circular and slightly delayed from the actual position which makes it feel floaty.
Marlène Bruhat’s portfolio has a sleek cursor that is paired with a gradient that appears behind page elements.
Aleksandr Yaremenko’s portfolio features a cursor that isn’t super complex but certainly stands out as a statement piece.
Terra features a giant glowing orb containing text describing what you’re hovering over.
Please do take care when replacing browser or native operating system features in this manner. The web is accessible by default, and we should take care to not undermine this. Use your power as a developer with taste and restraint.
#Accessibility#ADD#amp#animations#Articles#browser#CSS#css-tricks#data#desktop#Developer#display#event#Events#eye#Features#filter#Filters#focus#form#heart#HTML#Inspiration#it#JavaScript#motion#offset#One#operating system#power
0 notes
Link
[ad_1] You have for sure heard about the new CSS Anchor Positioning, right? It’s a feature that allows you to link any element from the page to another one, i.e., the anchor. It’s useful for all the tooltip stuff, but it can also create a lot of other nice effects. In this article, we will study menu navigation where I rely on anchor positioning to create a nice hover effect on links. CodePen Embed Fallback Cool, right? We have a sliding effect where the blue rectangle adjusts to fit perfectly with the text content over a nice transition. If you are new to anchor positioning, this example is perfect for you because it’s simple and allows you to discover the basics of this new feature. We will also study another example so stay until the end! Note that only Chromium-based browsers fully support anchor positioning at the time I’m writing this. You’ll want to view the demos in a browser like Chrome or Edge until the feature is more widely supported in other browsers. The initial configuration Let’s start with the HTML structure which is nothing but a nav element containing an unordered list of links: We will not spend too much time explaining this structure because it can be different if your use case is different. Simply ensure the semantic is relevant to what you are trying to do. As for the CSS part, we will start with some basic styling to create a horizontal menu navigation. ul padding: 0; margin: 0; list-style: none; display: flex; gap: .5rem; font-size: 2.2rem; ul li a color: #000; text-decoration: none; font-weight: 900; line-height: 1.5; padding-inline: .2em; display: block; Nothing fancy so far. We remove some default styling and use Flexbox to align the elements horizontally. CodePen Embed Fallback Sliding effect First off, let’s understand how the effect works. At first glance, it looks like we have one rectangle that shrinks to a small height, moves to the hovered element, and then grows to full height. That’s the visual effect, but in reality, more than one element is involved! Here is the first demo where I am using different colors to better see what is happening. CodePen Embed Fallback Each menu item has its own “element” that shrinks or grows. Then we have a common “element” (the one in red) that slides between the different menu items. The first effect is done using a background animation and the second one is where anchor positioning comes into play! The background animation We will animate the height of a CSS gradient for this first part: /* 1 */ ul li background: conic-gradient(lightblue 0 0) bottom/100% 0% no-repeat; transition: .2s; /* 2 */ ul li:is(:hover,.active) background-size: 100% 100%; transition: .2s .2s; /* 3 */ ul:has(li:hover) li.active:not(:hover) background-size: 100% 0%; transition: .2s; We’ve defined a gradient with a 100% width and 0% height, placed at the bottom. The gradient syntax may look strange, but it’s the shortest one that allows me to have a single-color gradient. Related: “How to correctly define a one-color gradient” Then, if the menu item is hovered or has the .active class, we make the height equal to 100%. Note the use of the delay here to make sure the growing happens after the shrinking. Finally, we need to handle a special case with the .active item. If we hover any item (that is not the active one), then the .active item gets the shirking effect (the gradient height is equal to 0%). That’s the purpose of the third selector in the code. CodePen Embed Fallback Our first animation is done! Notice how the growing begins after the shrinking completes because of the delay we defined in the second selector. The anchor positioning animation The first animation was quite easy because each item had its own background animation, meaning we didn’t have to care about the text content since the background automatically fills the whole space. We will use one element for the second animation that slides between all the menu items while adapting its width to fit the text of each item. This is where anchor positioning can help us. Let’s start with the following code: ul:before content:""; position: absolute; position-anchor: --li; background: red; transition: .2s; ul li:is(:hover, .active) anchor-name: --li; ul:has(li:hover) li.active:not(:hover) anchor-name: none; To avoid adding an extra element, I will prefer using a pseudo-element on the ul. It should be absolutely-positioned and we will rely on two properties to activate the anchor positioning. We define the anchor with the anchor-name property. When a menu item is hovered or has the .active class, it becomes the anchor element. We also have to remove the anchor from the .active item if another item is in a hovered state (hence, the last selector in the code). In other words, only one anchor is defined at a time. Then we use the position-anchor property to link the pseudo-element to the anchor. Notice how both use the same notation --li. It’s similar to how, for example, we define @keyframes with a specific name and later use it inside an animation property. Keep in mind that you have to use the syntax, meaning the name must always start with two dashes (--). CodePen Embed Fallback The pseudo-element is correctly placed but nothing is visible because we didn’t define any dimension! Let’s add the following code: ul:before bottom: anchor(bottom); left: anchor(left); right: anchor(right); height: .2em; The height property is trivial but the anchor() is a newcomer. Here’s how Juan Diego describes it in the Almanac: The CSS anchor() function takes an anchor element’s side and resolves to the where it is positioned. It can only be used in inset properties (e.g. top, bottom, bottom, left, right, etc.), normally to place an absolute-positioned element relative to an anchor. Let’s check the MDN page as well: The anchor() CSS function can be used within an anchor-positioned element’s inset property values, returning a length value relative to the position of the edges of its associated anchor element. Usually, we use left: 0 to place an absolute element at the left edge of its containing block (i.e., the nearest ancestor having position: relative). The left: anchor(left) will do the same but instead of the containing block, it will consider the associated anchor element. That’s all — we are done! Hover the menu items in the below demo and see how the pseudo-element slides between them. CodePen Embed Fallback Each time you hover over a menu item it becomes the new anchor for the pseudo-element (the ul:before). This also means that the anchor(...) values will change creating the sliding effect! Let’s not forget the use of the transition which is important otherwise, we will have an abrupt change. We can also write the code differently like this: ul:before content:""; position: absolute; inset: auto anchor(right, --li) anchor(bottom, --li) anchor(left, --li); height: .2em; background: red; transition: .2s; In other words, we can rely on the inset shorthand instead of using physical properties like left, right, and bottom, and instead of defining position-anchor, we can include the anchor’s name inside the anchor() function. We are repeating the same name three times which is probably not optimal here but in some situations, you may want your element to consider multiple anchors, and in such cases, this syntax will make sense. Combining both effects Now, we combine both effects and, tada, the illusion is perfect! CodePen Embed Fallback Pay attention to the transition values where the delay is important: ul:before transition: .2s .2s; ul li transition: .2s; ul li:is(:hover,.active) transition: .2s .4s; ul:has(li:hover) li.active:not(:hover) transition: .2s; We have a sequence of three animations — shrink the height of the gradient, slide the pseudo-element, and grow the height of the gradient — so we need to have delays between them to pull everything together. That’s why for the sliding of the pseudo-element we have a delay equal to the duration of one animation (transition: .2 .2s) and for the growing part the delay is equal to twice the duration (transition: .2s .4s). Bouncy effect? Why not?! Let’s try another fancy animation in which the highlight rectangle morphs into a small circle, jumps to the next item, and transforms back into a rectangle again! CodePen Embed Fallback I won’t explain too much for this example as it’s your homework to dissect the code! I’ll offer a few hints so you can unpack what’s happening. Like the previous effect, we have a combination of two animations. For the first one, I will use the pseudo-element of each menu item where I will adjust the dimension and the border-radius to simulate the morphing. For the second animation, I will use the ul pseudo-element to create a small circle that I move between the menu items. Here is another version of the demo with different coloration and a slower transition to better visualize each animation: CodePen Embed Fallback The tricky part is the jumping effect where I am using a strange cubic-bezier() but I have a detailed article where I explain the technique in my CSS-Tricks article “Advanced CSS Animation Using cubic-bezier()”. Conclusion I hope you enjoyed this little experimentation using the anchor positioning feature. We only looked at three properties/values but it’s enough to prepare you for this new feature. The anchor-name and position-anchor properties are the mandatory pieces for linking one element (often called a “target” element in this context) to another element (what we call an “anchor” element in this context). From there, you have the anchor() function to control the position. Related: CSS Anchor Positioning Guide [ad_2] Source link
0 notes