Jump to content

Welcome to CodeNameJessica

โœจ Welcome to CodeNameJessica! โœจ

๐Ÿ’ป Where tech meets community.

Hello, Guest! ๐Ÿ‘‹
You're just a few clicks away from joining an exclusive space for tech enthusiasts, problem-solvers, and lifelong learners like you.

๐Ÿ” Why Join?
By becoming a member of CodeNameJessica, youโ€™ll get access to:
โœ… In-depth discussions on Linux, Security, Server Administration, Programming, and more
โœ… Exclusive resources, tools, and scripts for IT professionals
โœ… A supportive community of like-minded individuals to share ideas, solve problems, and learn together
โœ… Project showcases, guides, and tutorials from our members
โœ… Personalized profiles and direct messaging to collaborate with other techies

๐ŸŒ Sign Up Now and Unlock Full Access!
As a guest, you're seeing just a glimpse of what we offer. Don't miss out on the complete experience! Create a free account today and start exploring everything CodeNameJessica has to offer.

  • Entries

    202
  • Comments

    0
  • Views

    4049

Entries in this blog

Chrome 133 Goodies

by: Geoff Graham
Fri, 31 Jan 2025 15:27:50 +0000


I often wonder what it’s like working for the Chrome team. You must get issued some sort of government-level security clearance for the latest browser builds that grants you permission to bash on them ahead of everyone else and come up with these rad demos showing off the latest features. No, I’m, not jealous, why are you asking?

Totally unrelated, did you see the release notes for Chrome 133? It’s currently in beta, but the Chrome team has been publishing a slew of new articles with pretty incredible demos that are tough to ignore. I figured I’d round those up in one place.

attr() for the masses!

We’ve been able to use HTML attributes in CSS for some time now, but it’s been relegated to the content property and only parsed strings.

<h1 data-color="orange">Some text</h1>
h1::before {
  content: ' (Color: ' attr(data-color) ') ';
}

Bramus demonstrates how we can now use it on any CSS property, including custom properties, in Chrome 133. So, for example, we can take the attribute’s value and put it to use on the element’s color property:

h1 {
  color: attr(data-color type(<color>), #fff)
}

This is a trite example, of course. But it helps illustrate that there are three moving pieces here:

  1. the attribute (data-color)
  2. the type (type(<color>))
  3. the fallback value (#fff)

We make up the attribute. It’s nice to have a wildcard we can insert into the markup and hook into for styling. The type() is a new deal that helps CSS know what sort of value it’s working with. If we had been working with a numeric value instead, we could ditch that in favor of something less verbose. For example, let’s say we’re using an attribute for the element’s font size:

<div data-size="20">Some text</div>

Now we can hook into the data-size attribute and use the assigned value to set the element’s font-size property, based in px units:

h1 {
  color: attr(data-size px, 16);
}

The fallback value is optional and might not be necessary depending on your use case.

Scroll states in container queries!

This is a mind-blowing one. If you’ve ever wanted a way to style a sticky element when it’s in a “stuck” state, then you already know how cool it is to have something like this. Adam Argyle takes the classic pattern of an alphabetical list and applies styles to the letter heading when it sticks to the top of the viewport. The same is true of elements with scroll snapping and elements that are scrolling containers.

In other words, we can style elements when they are “stuck”, when they are “snapped”, and when they are “scrollable”.

Quick little example that you’ll want to open in a Chromium browser:

The general idea (and that’s all I know for now) is that we register a container… you know, a container that we can query. We give that container a container-type that is set to the type of scrolling we’re working with. In this case, we’re working with sticky positioning where the element “sticks” to the top of the page.

.sticky-nav {
  container-type: scroll-state;
}

A container can’t query itself, so that basically has to be a wrapper around the element we want to stick. Menus are a little funny because we have the <nav> element and usually stuff it with an unordered list of links. So, our <nav> can be the container we query since we’re effectively sticking an unordered list to the top of the page.

<nav class="sticky-nav">
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Blog</a></li>
  </ul>
</nav>

We can put the sticky logic directly on the <nav> since it’s technically holding what gets stuck:

.sticky-nav {
  container-type: scroll-state; /* set a scroll container query */
  position: sticky; /* set sticky positioning */
  top: 0; /* stick to the top of the page */
}

I supposed we could use the container shorthand if we were working with multiple containers and needed to distinguish one from another with a container-name. Either way, now that we’ve defined a container, we can query it using @container! In this case, we declare the type of container we’re querying:

@container scroll-state() { }

And we tell it the state we’re looking for:

@container scroll-state(stuck: top) {

If we were working with a sticky footer instead of a menu, then we could say stuck: bottom instead. But the kicker is that once the <nav> element sticks to the top, we get to apply styles to it in the @container block, like so:

.sticky-nav {
  border-radius: 12px;
  container-type: scroll-state;
  position: sticky;
  top: 0;

  /* When the nav is in a "stuck" state */
  @container scroll-state(stuck: top) {
    border-radius: 0;
    box-shadow: 0 3px 10px hsl(0 0 0 / .25);
    width: 100%;
  }
}

It seems to work when nesting other selectors in there. So, for example, we can change the links in the menu when the navigation is in its stuck state:

.sticky-nav {
  /* Same as before */

  a {
    color: #000;
    font-size: 1rem;
  }

  /* When the nav is in a "stuck" state */
  @container scroll-state(stuck: top) {
    /* Same as before */

    a {
      color: orangered;
      font-size: 1.5rem;
    }
  }
}

So, yeah. As I was saying, it must be pretty cool to be on the Chrome developer team and get ahead of stuff like this, as it’s released. Big ol’ thanks to Bramus and Adam for consistently cluing us in on what’s new and doing the great work it takes to come up with such amazing demos to show things off.


Chrome 133 Goodies originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Geoff Graham
Fri, 31 Jan 2025 14:11:00 +0000


When using View Transitions youโ€™ll notice the page becomes unresponsive to clicks while a View Transition is running. […] This happens because of the ::view-transition pseudo element โ€“ the one that contains all animated snapshots โ€“ gets overlayed on top of the document and captures all the clicks.

::view-transition /* 👈 Captures all the clicks! */
โ””โ”€ ::view-transition-group(root)
   โ””โ”€ ::view-transition-image-pair(root)
      โ”œโ”€ ::view-transition-old(root)
      โ””โ”€ ::view-transition-new(root)

The trick? It’s that sneaky little pointer-events property! Slapping it directly on the :view-transition allows us to click “under” the pseudo-element, meaning the full page is interactive even while the view transition is running.

::view-transition {
  pointer-events: none;
}

I always, always, always forget about pointer-events, so thanks to Bramus for posting this little snippet. I also appreciate the additional note about removing the :root element from participating in the view transition:

:root {
  view-transition-name: none;
}

He quotes the spec noting the reason why snapshots do not respond to hit-testing:

Elements participating in a transition need to skip painting in their DOM location because their image is painted in the corresponding ::view-transition-new() pseudo-element instead. Similarly, hit-testing is skipped because the elementโ€™s DOM location does not correspond to where its contents are rendered.


Keeping the page interactive while a View Transition is running originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

The Mistakes of CSS

by: Juan Diego Rodrรญguez
Thu, 30 Jan 2025 14:31:08 +0000


Surely you have seen a CSS property and thought “Why?” For example:

Why doesn’t z-index work on all elements, and why is it “-index” anyways?

Or:

Why do we need interpolate-size to animate to auto?

You are not alone. CSS was born in 1996 (it can legally order a beer, you know!) and was initially considered a way to style documents; I don’t think anyone imagined everything CSS would be expected to do nearly 30 years later. If we had a time machine, many things would be done differently to match conventions or to make more sense. Heck, even the CSS Working Group admits to wanting a time-traveling contraption… in the specifications!

NOTE:ย If we had a time machine, this property wouldnโ€™t need to exist.

CSS Values and Units Module Level 5, Section 10.4

If by some stroke of opportunity, I was given free rein to rename some things in CSS, a couple of ideas come to mind, but if you want more, you can find an ongoing list of mistakes made in CSS… by the CSS Working Group! Take, for example, background-repeat:

Not quite a mistake, because it was a reasonable default for the 90s, but it would be more helpful since then if background-repeat defaulted to no-repeat.

Right now, people are questioning if CSS Flexbox and CSS Grid should share more syntax in light of the upcoming CSS Masonry layout specifications.

Why not fix them? Sadly, it isn’t as easy as fixing something. People already built their websites with these quirks in mind, and changing them would break those sites. Consider it technical debt.

This is why I think the CSS Working Group deserves an onslaught of praise. Designing new features that are immutable once shipped has to be a nerve-wracking experience that involves inexact science. It’s not that we haven’t seen the specifications change or evolve in the past โ€” they most certainly have โ€” but the value of getting things right the first time is a beast of burden.


The Mistakes of CSS originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Juan Diego Rodrรญguez
Wed, 29 Jan 2025 14:13:53 +0000


Have you ever stumbled upon something new and went to research it just to find that there is little-to-no information about it? It’s a mixed feeling: confusing and discouraging because there is no apparent direction, but also exciting because it’s probably new to lots of people, not just you. Something like that happened to me while writing an Almanac’s entry for the @view-transition at-rule and its types descriptor.

You may already know about Cross-Document View Transitions: With a few lines of CSS, they allow for transitions between two pages, something that in the past required a single-app framework with a side of animation library. In other words, lots of JavaScript.

To start a transition between two pages, we have to set the @view-transition at-rule’s navigation descriptor to auto on both pages, and that gives us a smooth cross-fade transition between the two pages. So, as the old page fades out, the new page fades in.

@view-transition {
  navigation: auto;
}

That’s it! And navigation is the only descriptor we need. In fact, it’s the only descriptor available for the @view-transition at-rule, right? Well, turns out there is another descriptor, a lesser-known brother, and one that probably envies how much attention navigation gets: the types descriptor.

What do people say about types?

Cross-Documents View Transitions are still fresh from the oven, so it’s normal that people haven’t fully dissected every aspect of them, especially since they introduce a lot of new stuff: a new at-rule, a couple of new properties and tons of pseudo-elements and pseudo-classes. However, it still surprises me the little mention of types. Some documentation fails to even name it among the valid  @view-transition descriptors. Luckily, though, the CSS specification does offer a little clarification about it:

The types descriptor sets the active types for the transition when capturing or performing the transition.

To be more precise, types can take a space-separated list with the names of the active types (as <custom-ident>), or none if there aren’t valid active types for that page.

  • Name: types
  • For: @view-transition
  • Value: none | <custom-ident>+
  • Initial: none

So the following values would work inside types:

@view-transition {
  navigation: auto;
  types: bounce;
}

/* or a list */

@view-transition {
  navigation: auto;
  types: bounce fade rotate;
}

Yes, but what exactly are “active” types? That word “active” seems to be doing a lot of heavy lifting in the CSS specification’s definition and I want to unpack that to better understand what it means.

Active types in view transitions

The problem: A cross-fade animation for every page is good, but a common thing we need to do is change the transition depending on the pages we are navigating between. For example, on paginated content, we could slide the content to the right when navigating forward and to the left when navigating backward. In a social media app, clicking a user’s profile picture could persist the picture throughout the transition. All this would mean defining several transitions in our CSS, but doing so would make them conflict with each other in one big slop. What we need is a way to define several transitions, but only pick one depending on how the user navigates the page.

The solution: Active types define which transition gets used and which elements should be included in it. In CSS, they are used through :active-view-transition-type(), a pseudo-class that matches an element if it has a specific active type. Going back to our last example, we defined the document’s active type as bounce. We could enclose that bounce animation behind an :active-view-transition-type(bounce), such that it only triggers on that page.

/* This one will be used! */
html:active-view-transition-type(bounce) {
  &::view-transition-old(page) {
    /* Custom Animation */
  }

  &::view-transition-new(page) {
    /* Custom Animation */
  }
}

This prevents other view transitions from running if they don’t match any active type:

/* This one won't be used! */
html:active-view-transition-type(slide) {
  &::view-transition-old(page) {
    /* Custom Animation */
  }

  &::view-transition-new(page) {
    /* Custom Animation */
  }
}

I asked myself whether this triggers the transition when going to the page, when out of the page, or in both instances. Turns out it only limits the transition when going to the page, so the last bounce animation is only triggered when navigating toward a page with a bounce value on its types descriptor, but not when leaving that page. This allows for custom transitions depending on which page we are going to.

The following demo has two pages that share a stylesheet with the bounce and slide view transitions, both respectively enclosed behind an :active-view-transition-type(bounce) and :active-view-transition-type(slide) like the last example. We can control which page uses which view transition through the types descriptor.

The first page uses the bounce animation:

@view-transition {
  navigation: auto;
  types: bounce;
}

The second page uses the slide animation:

@view-transition {
  navigation: auto;
  types: slide;
}

You can visit the demo here and see the full code over at GitHub.

Theย typesย descriptor is used more in JavaScript

The main problem is that we can only control the transition depending on the page we’re navigating to, which puts a major cap on how much we can customize our transitions. For instance, the pagination and social media examples we looked at aren’t possible just using CSS, since we need to know where the user is coming from. Luckily, using the types descriptor is just one of three ways that active types can be populated. Per spec, they can be:

  1. Passed as part of the arguments to startViewTransition(callbackOptions)
  2. Mutated at any time, using the transitionโ€™s types
  3. Declared for a cross-document view transition, using the types descriptor.

The first option is when starting a view transition from JavaScript, but we want to trigger them when the user navigates to the page by themselves (like when clicking a link). The third option is using the types descriptor which we already covered. The second option is the right one for this case! Why? It lets us set the active transition type on demand, and we can perform that change just before the transition happens using the pagereveal event. That means we can get the user’s start and end page from JavaScript and then set the correct active type for that case.

I must admit, I am not the most experienced guy to talk about this option, so once I demo the heck out of different transitions with active types I’ll come back with my findings! In the meantime, I encourage you to read about active types here if you are like me and want more on view transitions:


What on Earth is theย `types`ย Descriptor in View Transitions? originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

Sigma Browser

by: aiparabellum.com
Tue, 28 Jan 2025 07:28:06 +0000


In the digital age, where online privacy and security are paramount, tools like Sigma Browser are gaining significant attention. Sigma Browser is a privacy-focused web browser designed to provide users with a secure, fast, and ad-free browsing experience. Built with advanced features to protect user data and enhance online anonymity, Sigma Browser is an excellent choice for individuals and businesses alike. In this article, weโ€™ll dive into its features, how it works, benefits, pricing, and more to help you understand why Sigma Browser is a standout in the world of secure browsing.

Features of Sigma Browser AI

Sigma Browser offers a range of features tailored to ensure privacy, speed, and convenience. Here are some of its key features:

  1. Ad-Free Browsing: Enjoy a seamless browsing experience without intrusive ads.
  2. Enhanced Privacy: Built-in privacy tools to block trackers and protect your data.
  3. Fast Performance: Optimized for speed, ensuring quick page loads and smooth navigation.
  4. Customizable Interface: Personalize your browsing experience with themes and settings.
  5. Cross-Platform Sync: Sync your data across multiple devices for a unified experience.
  6. Secure Browsing: Advanced encryption to keep your online activities private.

How It Works

Sigma Browser is designed to be user-friendly while prioritizing security. Hereโ€™s how it works:

  1. Download and Install: Simply download Sigma Browser from its official website and install it on your device.
  2. Set Up Privacy Settings: Customize your privacy preferences, such as blocking trackers and enabling encryption.
  3. Browse Securely: Start browsing the web with enhanced privacy and no ads.
  4. Sync Across Devices: Log in to your account to sync bookmarks, history, and settings across multiple devices.
  5. Regular Updates: The browser receives frequent updates to improve performance and security.

Benefits of Sigma Browser AI

Using Sigma Browser comes with numerous advantages:

  • Improved Privacy: Protects your data from third-party trackers and advertisers.
  • Faster Browsing: Eliminates ads and optimizes performance for quicker loading times.
  • User-Friendly: Easy to set up and use, even for non-tech-savvy individuals.
  • Cross-Device Compatibility: Access your browsing data on any device.
  • Customization: Tailor the browser to suit your preferences and needs.

Pricing

Sigma Browser offers flexible pricing plans to cater to different users:

  • Free Version: Includes basic features like ad-free browsing and privacy protection.
  • Premium Plan: Unlocks advanced features such as cross-device sync and priority support. Pricing details are available on the official website.

Sigma Browser Review

Sigma Browser has received positive feedback from users for its focus on privacy and performance. Many appreciate its ad-free experience and the ability to customize the interface. The cross-platform sync feature is also a standout, making it a convenient choice for users who switch between devices. Some users have noted that the premium plan could offer more features, but overall, Sigma Browser is highly regarded for its security and ease of use.

Conclusion

Sigma Browser is a powerful tool for anyone looking to enhance their online privacy and browsing experience. With its ad-free interface, robust privacy features, and fast performance, it stands out as a reliable choice in the crowded browser market. Whether youโ€™re a casual user or a business professional, Sigma Browser offers the tools you need to browse securely and efficiently. Give it a try and experience the difference for yourself.

The post Sigma Browser appeared first on AI Parabellum.

Sigma Browser

by: aiparabellum.com
Tue, 28 Jan 2025 07:28:06 +0000


In the digital age, where online privacy and security are paramount, tools like Sigma Browser are gaining significant attention. Sigma Browser is a privacy-focused web browser designed to provide users with a secure, fast, and ad-free browsing experience. Built with advanced features to protect user data and enhance online anonymity, Sigma Browser is an excellent choice for individuals and businesses alike. In this article, weโ€™ll dive into its features, how it works, benefits, pricing, and more to help you understand why Sigma Browser is a standout in the world of secure browsing.

Features of Sigma Browser AI

Sigma Browser offers a range of features tailored to ensure privacy, speed, and convenience. Here are some of its key features:

  1. Ad-Free Browsing: Enjoy a seamless browsing experience without intrusive ads.
  2. Enhanced Privacy: Built-in privacy tools to block trackers and protect your data.
  3. Fast Performance: Optimized for speed, ensuring quick page loads and smooth navigation.
  4. Customizable Interface: Personalize your browsing experience with themes and settings.
  5. Cross-Platform Sync: Sync your data across multiple devices for a unified experience.
  6. Secure Browsing: Advanced encryption to keep your online activities private.

How It Works

Sigma Browser is designed to be user-friendly while prioritizing security. Hereโ€™s how it works:

  1. Download and Install: Simply download Sigma Browser from its official website and install it on your device.
  2. Set Up Privacy Settings: Customize your privacy preferences, such as blocking trackers and enabling encryption.
  3. Browse Securely: Start browsing the web with enhanced privacy and no ads.
  4. Sync Across Devices: Log in to your account to sync bookmarks, history, and settings across multiple devices.
  5. Regular Updates: The browser receives frequent updates to improve performance and security.

Benefits of Sigma Browser AI

Using Sigma Browser comes with numerous advantages:

  • Improved Privacy: Protects your data from third-party trackers and advertisers.
  • Faster Browsing: Eliminates ads and optimizes performance for quicker loading times.
  • User-Friendly: Easy to set up and use, even for non-tech-savvy individuals.
  • Cross-Device Compatibility: Access your browsing data on any device.
  • Customization: Tailor the browser to suit your preferences and needs.

Pricing

Sigma Browser offers flexible pricing plans to cater to different users:

  • Free Version: Includes basic features like ad-free browsing and privacy protection.
  • Premium Plan: Unlocks advanced features such as cross-device sync and priority support. Pricing details are available on the official website.

Sigma Browser Review

Sigma Browser has received positive feedback from users for its focus on privacy and performance. Many appreciate its ad-free experience and the ability to customize the interface. The cross-platform sync feature is also a standout, making it a convenient choice for users who switch between devices. Some users have noted that the premium plan could offer more features, but overall, Sigma Browser is highly regarded for its security and ease of use.

Conclusion

Sigma Browser is a powerful tool for anyone looking to enhance their online privacy and browsing experience. With its ad-free interface, robust privacy features, and fast performance, it stands out as a reliable choice in the crowded browser market. Whether youโ€™re a casual user or a business professional, Sigma Browser offers the tools you need to browse securely and efficiently. Give it a try and experience the difference for yourself.

The post Sigma Browser appeared first on AI Parabellum.

by: Chris Coyier
Mon, 27 Jan 2025 17:10:10 +0000


I love a good exposรฉ on how a front-end team operates. Like what technology they use, why, and how, particularly when there are pain points and journeys through them.

Jim Simon of Reddit wrote one a bit ago about their teams build process. They were using something Rollup based and getting 2-minute build times and spent quite a bit of time and effort switching to Vite and now are getting sub-1-second build times. I don’t know if “wow Vite is fast” is the right read here though, as they lost type checking entirely. Vite means esbuild for TypeScript which just strips types, meaning no build process (locally, in CI, or otherwise) will catch errors. That seems like a massive deal to me as it opens the door to all contributions having TypeScript errors. I admit I’m fascinated by the approach though, it’s kinda like treating TypeScript as a local-only linter. Sure, VS Code complains and gives you red squiggles, but nothing else will, so use that information as you will. Very mixed feelings.

Vite always seems to be front and center in conversations about the JavaScript ecosystem these days. The tooling section of this year’s JavaScript Rising Stars:

Vite has been the big winner again this year, renewing for the second time its State of JS awards as the most adopted and loved technology. It’s rare to have both high usage and retention, let alone maintain it. We are eagerly waiting to see how the new void(0) company will impact the Vite ecosystem next year!

(Interesting how it’s actually Biome that gained the most stars this year and has large goals about being the toolchain for the web, like Vite)

Vite actually has the bucks now to make a real run at it. It’s always nail biting and fascinating to see money being thrown around at front-end open source, as a strong business model around all that is hard to find.

Maybe there is an enterprise story to capture? Somehow I can see that more easily. I would guess that’s where the new venture vlt is seeing potential. npm, now being owned by Microsoft, certainly had a story there that investors probably liked to see, so maybe vlt can do it again but better. It’s the “you’ve got their data” thing that adds up to me. Not that I love it, I just get it. Vite might have your stack, but we write checks to infrastructure companies.

That tinge of worry extends to Bun and Deno too. I think they can survive decently on momentum of developers being excited about the speed and features. I wouldn’t say I’ve got a full grasp on it, but I’ve seen some developers be pretty disillusioned or at least trepidatious with Deno and their package registry JSR. But Deno has products! They have enterprise consulting and various hosting. Data and product, I think that is all very smart. Mabe void(0) can find a product play in there. This all reminds me of XState / Stately which took a bit of funding, does open source, and productizes some of what they do. Their new Store library is getting lots of attention which is good for the gander.

To be clear, I’m rooting for all of these companies. They are small and only lightly funded companies, just like CodePen, trying to make tools to make web development better. ๐Ÿ’œ

by: Andy Clarke
Mon, 27 Jan 2025 15:35:44 +0000


Honestly, itโ€™s difficult for me to come to terms with, but almost 20 years have passed since I wrote my first book, Transcending CSS. In it, I explained how and why to use what was the then-emerging Multi-Column Layout module.

Hint: I published an updated version, Transcending CSS Revisited, which is free to read online.

Perhaps because, before the web, Iโ€™d worked in print, I was over-excited at the prospect of dividing content into columns without needing extra markup purely there for presentation. Iโ€™ve used Multi-Column Layout regularly ever since. Yet, CSS Columns remains one of the most underused CSS layout tools. I wonder why that is?

Holes in the specification

For a long time, there were, and still are, plenty of holes in Multi-Column Layout. As Rachel Andrew โ€” now a specification editor โ€” noted in her article five years ago:

โ€œThe column boxes created when you use one of the column properties canโ€™t be targeted. You canโ€™t address them with JavaScript, nor can you style an individual box to give it a background colour or adjust the padding and margins. All of the column boxes will be the same size. The only thing you can do is add a rule between columns.โ€

Sheโ€™s right. And thatโ€™s still true. You canโ€™t style columns, for example, by alternating background colours using some sort of :nth-column() pseudo-class selector. You can add a column-rule between columns using border-style values like dashed, dotted, and solid, and who can forget those evergreen groove and ridge styles? But you canโ€™t apply border-image values to a column-rule, which seems odd as they were introduced at roughly the same time. The Multi-Column Layout is imperfect, and thereโ€™s plenty I wish it could do in the future, but that doesnโ€™t explain why most people ignore what it can do today.

Patchy browser implementation for a long time

Legacy browsers simply ignored the column properties they couldnโ€™t process. But, when Multi-Column Layout was first launched, most designers and developers had yet to accept that websites neednโ€™t look the same in every browser.

Early on, support for Multi-Column Layout was patchy. However, browsers caught up over time, and although there are still discrepancies โ€” especially in controlling content breaks โ€” Multi-Column Layout has now been implemented widely. Yet, for some reason, many designers and developers I speak to feel that CSS Columns remain broken. Yes, thereโ€™s plenty that browser makers should do to improve their implementations, but that shouldnโ€™t prevent people from using the solid parts today.

Readability and usability with scrolling

Maybe the main reason designers and developers havenโ€™t embraced Multi-Column Layout as they have CSS Grid and Flexbox isnโ€™t in the specification or its implementation but in its usability. Rachel pointed this out in her article:

โ€œOne reason we donโ€™t see multicol used much on the web is that it would be very easy to end up with a reading experience which made the reader scroll in the block dimension. That would mean scrolling up and down vertically for those of us using English or another vertical writing mode. This is not a good reading experience!โ€

Thatโ€™s true. No one would enjoy repeatedly scrolling up and down to read a long passage of content set in columns. She went on:

โ€œNeither of these things is ideal, and using multicol on the web is something we need to think about very carefully in terms of the amount of content we might be aiming to flow into our columns.โ€

But, letโ€™s face it, thinking very carefully is what designers and developers should always be doing.

Sure, if youโ€™re dumb enough to dump a large amount of content into columns without thinking about its design, youโ€™ll end up serving readers a poor experience. But why would you do that when headlines, images, and quotes can span columns and reset the column flow, instantly improving readability? Add to that container queries and newer unit values for text sizing, and there really isnโ€™t a reason to avoid using Multi-Column Layout any longer.

A brief refresher on properties and values

Letโ€™s run through a refresher. There are two ways to flow content into multiple columns; first, by defining the number of columns you need using the column-count property:

Second, and often best, is specifying the column width, leaving a browser to decide how many columns will fit along the inline axis. For example, Iโ€™m using column-width to specify that my columns are over 18rem. A browser creates as many 18rem columns as possible to fit and then shares any remaining space between them.

Then, there is the gutter (or column-gap) between columns, which you can specify using any length unit. I prefer using rem units to maintain the guttersโ€™ relationship to the text size, but if your gutters need to be 1em, you can leave this out, as thatโ€™s a browserโ€™s default gap.

The final column property is that divider (or column-rule) to the gutters, which adds visual separation between columns. Again, you can set a thickness and use border-style values like dashed, dotted, and solid.

These examples will be seen whenever you encounter a Multi-Column Layout tutorial, including CSS-Tricksโ€™ own Almanac. The Multi-Column Layout syntax is one of the simplest in the suite of CSS layout tools, which is another reason why there are few reasons not to use it.

Multi-Column Layout is even more relevant today

When I wrote Transcending CSS and first explained the emerging Multi-Column Layout, there were no rem or viewport units, no :has() or other advanced selectors, no container queries, and no routine use of media queries because responsive design hadnโ€™t been invented.

We didnโ€™t have calc() or clamp() for adjusting text sizes, and there was no CSS Grid or Flexible Box Layout for precise control over a layout. Now we do, and all these properties help to make Multi-Column Layout even more relevant today.

Now, you can use rem or viewport units combined with calc() and clamp() to adapt the text size inside CSS Columns. You can use :has() to specify when columns are created, depending on the type of content they contain. Or you might use container queries to implement several columns only when a container is large enough to display them. Of course, you can also combine a Multi-Column Layout with CSS Grid or Flexible Box Layout for even more imaginative layout designs.

Using Multi-Column Layout today

Three examples of multi-column page layouts displayed side-by-side featuring a fictional female country musician.
Patty Meltt is an up-and-coming country music sensation. Sheโ€™s not real, but the challenges of designing and developing websites like hers are.

My challenge was to implement a flexible article layout without media queries which adapts not only to screen size but also whether or not a <figure> is present. To improve the readability of running text in what would potentially be too-long lines, it should be set in columns to narrow the measure. And, as a final touch, the text size should adapt to the width of the container, not the viewport.

A two-column layout of text topped with a large heading that spans both columns.
Article with no <figure> element. What would potentially be too-long lines of text are set in columns to improve readability by narrowing the measure.
To column layout with text on the left and a large image on the right.
Article containing a <figure> element. No column text is needed for this narrower measure.

The HTML for this layout is rudimentary. One <section>, one <main>, and one <figure> (or not:)

<section>
  <main>
    <h1>About Patty</h1>
    <p>โ€ฆ</p>
  </main>

  <figure>
    <img>
  </figure>
</section>

I started by adding Multi-Column Layout styles to the <main> element using the column-width property to set the width of each column to 40ch (characters). The max-width and automatic inline margins reduce the content width and center it in the viewport:

main {
  margin-inline: auto;
  max-width: 100ch;
  column-width: 40ch;
  column-gap: 3rem;
  column-rule: .5px solid #98838F;
}

Next, I applied a flexible box layout to the <section> only if it :has() a direct descendant which is a <figure>:

section:has(> figure) {
  display: flex;
  flex-wrap: wrap;
  gap: 0 3rem;
}

This next min-width: min(100%, 30rem) โ€” applied to both the <main> and <figure> โ€” is a combination of the min-width property and the min() CSS function. The min() function allows you to specify two or more values, and a browser will choose the smallest value from them. This is incredibly useful for responsive layouts where you want to control the size of an element based on different conditions:

section:has(> figure) main {
  flex: 1;
  margin-inline: 0;
  min-width: min(100%, 30rem);
}

section:has(> figure) figure {
  flex: 4;
  min-width: min(100%, 30rem);
}

Whatโ€™s efficient about this implementation is that Multi-Column Layout styles are applied throughout, with no need for media queries to switch them on or off.

Adjusting text size in relation to column width helps improve readability. This has only recently become easy to implement with the introduction of container queries, their associated values including cqi, cqw, cqmin, and cqmax. And the clamp() function. Fortunately, you donโ€™t have to work out these text sizes manually as ClearLeftโ€™s Utopia will do the job for you.

My headlines and paragraph sizes are clamped to their minimum and maximum rem sizes and between them text is fluid depending on their containerโ€™s inline size:

h1 { font-size: clamp(5.6526rem, 5.4068rem + 1.2288cqi, 6.3592rem); }

h2 { font-size: clamp(1.9994rem, 1.9125rem + 0.4347cqi, 2.2493rem); }

p { font-size: clamp(1rem, 0.9565rem + 0.2174cqi, 1.125rem); }

So, to specify the <main> as the container on which those text sizes are based, I applied a container query for its inline size:

main {
  container-type: inline-size;
}

Open the final result in a desktop browser, when youโ€™re in front of one. Itโ€™s a flexible article layout without media queries which adapts to screen size and the presence of a <figure>. Multi-Column Layout sets text in columns to narrow the measure and the text size adapts to the width of its container, not the viewport.

Modern CSS is solving many prior problems

A two-column layout of text with a large heading above it spanning both columns.
Structure content with spanning elements which will restart the flow of columns and prevent people from scrolling long distances.
Same two-column text layout, including an image in the first column.
Prevent figures from dividing their images and captions between columns.

Almost every article Iโ€™ve ever read about Multi-Column Layout focuses on its flaws, especially usability. CSS-Tricksโ€™ own Geoff Graham even mentioned the scrolling up and down issue when he asked, โ€œWhen Do You Use CSS Columns?โ€

โ€œBut an entire long-form article split into columns? I love it in newspapers but am hesitant to scroll down a webpage to read one column, only to scroll back up to do it again.โ€

Fortunately, the column-span property โ€” which enables headlines, images, and quotes to span columns, resets the column flow, and instantly improves readability โ€” now has solid support in browsers:

h1, h2, blockquote {
  column-span: all; 
}

But the solution to the scrolling up and down issue isnโ€™t purely technical. It also requires content design. This means that content creators and designers must think carefully about the frequency and type of spanning elements, dividing a Multi-Column Layout into shallower sections, reducing the need to scroll and improving someoneโ€™s reading experience.

Another prior problem was preventing headlines from becoming detached from their content and figures, dividing their images and captions between columns. Thankfully, the break-after property now also has widespread support, so orphaned images and captions are now a thing of the past:

figure {
  break-after: column;
}

Open this final example in a desktop browser:

You should take a fresh look at Multi-Column Layout

Multi-Column Layout isnโ€™t a shiny new tool. In fact, it remains one of the most underused layout tools in CSS. Itโ€™s had, and still has, plenty of problems, but they havenโ€™t reduced its usefulness or its ability to add an extra level of refinement to a product or websiteโ€™s design. Whether you havenโ€™t used Multi-Column Layout in a while or maybe have never tried it, nowโ€™s the time to take a fresh look at Multi-Column Layout.


Revisiting CSS Multi-Column Layout originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Preethi
Fri, 24 Jan 2025 14:59:25 +0000


When it comes to positioning elements on a page, including text, there are many ways to go about it in CSS โ€” the literal position property with corresponding inset-* properties, translate, margin, anchor() (limited browser support at the moment), and so forth. The offset property is another one that belongs in that list.

The offset property is typically used for animating an element along a predetermined path. For instance, the square in the following example traverses a circular path:

<div class="circle">
  <div class="square"></div>
</div>
@property --p {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}
.square {
  offset: top 50% right 50% circle(50%) var(--p);
  transition: --p 1s linear;

  /* Equivalent to:
    offset-position: top 50% right 50%;
    offset-path: circle(50%);
    offset-distance: var(--p); */

  /* etc. */
}

.circle:hover .square{ --p: 100%; }

A registered CSS custom property (--p) is used to set and animate the offset distance of the square element. The animation is possible because an element can be positioned at any point in a given path using offset. and maybe you didnโ€™t know this, but offset is a shorthand property comprised of the following constituent properties:

  • offset-position: The pathโ€™s starting point
  • offset-path: The shape along which the element can be moved
  • offset-distance: A distance along the path on which the element is moved
  • offset-rotate: The rotation angle of an element relative to its anchor point and offset path
  • offset-anchor: A position within the element thatโ€™s aligned to the path

The offset-path property is the one thatโ€™s important to what weโ€™re trying to achieve. It accepts a shape value โ€” including SVG shapes or CSS shape functions โ€” as well as reference boxes of the containing element to create the path.

Reference boxes? Those are an elementโ€™s dimensions according to the CSS Box Model, including content-box, padding-box, border-box, as well as SVG contexts, such as the view-box, fill-box, and stroke-box. These simplify how we position elements along the edges of their containing elements. Hereโ€™s an example: all the small squares below are placed in the default top-left corner of their containing elementsโ€™ content-box. In contrast, the small circles are positioned along the top-right corner (25% into their containing elementsโ€™ square perimeter) of the content-box, border-box, and padding-box, respectively.

<div class="big">
  <div class="small circle"></div>
  <div class="small square"></div>
  <p>She sells sea shells by the seashore</p>
</div>

<div class="big">
  <div class="small circle"></div>
  <div class="small square"></div>
  <p>She sells sea shells by the seashore</p>
</div>

<div class="big">
  <div class="small circle"></div>
  <div class="small square"></div>
  <p>She sells sea shells by the seashore</p>
</div>
.small {
  /* etc. */
  position: absolute;

  &.square {
    offset: content-box;
    border-radius: 4px;
  }

  &.circle { border-radius: 50%; }
}

.big {
  /* etc. */
  contain: layout; /* (or position: relative) */

  &:nth-of-type(1) {
    .circle { offset: content-box 25%; }
  }

  &:nth-of-type(2) {
    border: 20px solid rgb(170 232 251);
    .circle { offset: border-box 25%; }
  }

  &:nth-of-type(3) {
    padding: 20px;
    .circle { offset: padding-box 25%; }
  }
}

Note: You can separate the elementโ€™s offset-positioned layout context if you donโ€™t want to allocated space for it inside its containing parent element. Thatโ€™s how Iโ€™ve approached it in the example above so that the paragraph text inside can sit flush against the edges. As a result, the offset positioned elements (small squares and circles) are given their own contexts using position: absolute, which removes them from the normal document flow.

This method, positioning relative to reference boxes, makes it easy to place elements like notification dots and ornamental ribbon tips along the periphery of some UI module. It further simplifies the placement of texts along a containing blockโ€™s edges, as offset can also rotate elements along the path, thanks to offset-rotate. A simple example shows the date of an article placed at a blockโ€™s right edge:

<article>
  <h1>The Irreplaceable Value of Human Decision-Making in the Age of AI</h1>
  <!-- paragraphs -->
  <div class="date">Published on 11<sup>th</sup> Dec</div>
  <cite>An excerpt from the HBR article</cite>
</article>
article {
  container-type: inline-size;
  /* etc. */
}

.date {
  offset: padding-box 100cqw 90deg / left 0 bottom -10px;
  
  /*
    Equivalent to:
    offset-path: padding-box;
    offset-distance: 100cqw; (100% of the container element's width)
    offset-rotate: 90deg;
    offset-anchor: left 0 bottom -10px;
  */
}

As we just saw, using the offset property with a reference box path and container units is even more efficient โ€” you can easily set the offset distance based on the containing elementโ€™s width or height. Iโ€™ll include a reference for learning more about container queries and container query units in the โ€œFurther Readingโ€ section at the end of this article.

Thereโ€™s also the offset-anchor property thatโ€™s used in that last example. It provides the anchor for the elementโ€™s displacement and rotation โ€” for instance, the 90 degree rotation in the example happens from the elementโ€™s bottom-left corner. The offset-anchor property can also be used to move the element either inward or outward from the reference box by adjusting inset-* values โ€” for instance, the bottom -10px arguments pull the elementโ€™s bottom edge outwards from its containing elementโ€™s padding-box. This enhances the precision of placements, also demonstrated below.

<figure>
  <div class="big">4</div>
  <div class="small">number four</div>
</figure>
.small {
  width: max-content;
  offset: content-box 90% -54deg / center -3rem;

  /*
    Equivalent to:
    offset-path: content-box;
    offset-distance: 90%;
    offset-rotate: -54deg;
    offset-anchor: center -3rem;
  */

  font-size: 1.5rem;
  color: navy;
}

As shown at the beginning of the article, offset positioning is animateable, which allows for dynamic design effects, like this:

<article>
  <figure>
    <div class="small one">17<sup>th</sup> Jan. 2025</div>
    <span class="big">Seminar<br>on<br>Literature</span>
    <div class="small two">Tickets Available</div>
  </figure>
</article>
@property --d {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.small {
  /* other style rules */
  offset: content-box var(--d) 0deg / left center;

  /*
    Equivalent to:
    offset-path: content-box;
    offset-distance: var(--d);
    offset-rotate: 0deg;
    offset-anchor: left center;
  */

  transition: --d .2s linear;

  &.one { --d: 2%; }
  &.two { --d: 70%; }
}

article:hover figure {
  .one { --d: 15%;  }
  .two { --d: 80%;  }
}

Wrapping up

Whether for graphic designs like text along borders, textual annotations, or even dynamic texts like error messaging, CSS offset is an easy-to-use option to achieve all of that. We can position the elements along the reference boxes of their containing parent elements, rotate them, and even add animation if needed.

Further reading


Positioning Text Around Elements With CSS Offset originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Geoff Graham
Thu, 23 Jan 2025 17:21:15 +0000


I was reading through Juan’s recent Almanac entry for the @counter-style at-rule and I’ll be darned if he didn’t uncover and unpack some extremely interesting things that we can do to style lists, notably the list marker. You’re probably already aware of the ::marker pseudo-element. You’ve more than likely dabbled with custom counters using counter-reset and counter-increment. Or maybe your way of doing things is to wipe out the list-style (careful when doing that!) and hand-roll a marker on the list item’s ::before pseudo.

But have you toyed around with @counter-style? Turns out it does a lot of heavy lifting and opens up new ways of working with lists and list markers.

You can style the marker of just one list item

This is called a “fixed” system set to a specific item.

@counter-style style-fourth-item {
  system: fixed 4;
  symbols: "💠";
  suffix: " ";
}

li {
  list-style: style-fourth-item;
}

You can assign characters to specific markers

If you go with an “additive” system, then you can define which symbols belong to which list items.

@counter-style dice {
  system: additive;
  additive-symbols: 6 "โš…", 5 "โš„", 4 "โšƒ", 3 "โš‚", 2 "โš", 1 "โš€";
  suffix: " ";
}

li {
  list-style: dice;
}

Notice how the system repeats once it reaches the end of the cycle and begins a new series based on the first item in the pattern. So, for example, there are six sides to typical dice and we start rolling two dice on the seventh list item, totaling seven.

You can add a prefix and suffix to list markers

A long while back, Chris showed off a way to insert punctuation at the end of a list marker using the list item’s ::before pseudo:

ol {
  list-style: none;
  counter-reset: my-awesome-counter;

  li {
    counter-increment: my-awesome-counter;

    &::before {
      content: counter(my-awesome-counter) ") ";
    }
  }
}

That’s much easier these days with @counter-styles:

@counter-style parentheses {
  system: extends decimal;
  prefix: "(";
  suffix: ") ";
}

You can style multiple ranges of list items

Let’s say you have a list of 10 items but you only want to style items 1-3. We can set a range for that:

@counter-style single-range {
  system: extends upper-roman;
  suffix: ".";
  range: 1 3;
}

li {
  list-style: single-range;
}

We can even extend our own dice example from earlier:

@counter-style dice {
  system: additive;
  additive-symbols: 6 "โš…", 5 "โš„", 4 "โšƒ", 3 "โš‚", 2 "โš", 1 "โš€";
  suffix: " ";
}

@counter-style single-range {
  system: extends dice;
  suffix: ".";
  range: 1 3;
}

li {
  list-style: single-range;
}

Another way to do that is to use the infinite keyword as the first value:

@counter-style dice {
  system: additive;
  additive-symbols: 6 "โš…", 5 "โš„", 4 "โšƒ", 3 "โš‚", 2 "โš", 1 "โš€";
  suffix: " ";
}

@counter-style single-range {
  system: extends dice;
  suffix: ".";
  range: infinite 3;
}

li {
  list-style: single-range;
}

Speaking of infinite, you can set it as the second value and it will count up infinitely for as many list items as you have.

Maybe you want to style two ranges at a time and include items 6-9. I’m not sure why the heck you’d want to do that but I’m sure you (or your HIPPO) have got good reasons.

@counter-style dice {
  system: additive;
  additive-symbols: 6 "โš…", 5 "โš„", 4 "โšƒ", 3 "โš‚", 2 "โš", 1 "โš€";
  suffix: " ";
}

@counter-style multiple-ranges {
  system: extends dice;
  suffix: ".";
  range: 1 3, 6 9;
}

li {
  list-style: multiple-ranges;
}

You can add padding around the list markers

You ever run into a situation where your list markers are unevenly aligned? That usually happens when going from, say, a single digit to a double-digit. You can pad the marker with extra characters to line things up.

/* adds leading zeroes to list item markers */
@counter-style zero-padded-example {
  system: extends decimal;
  pad: 3 "0";
}

Now the markers will always be aligned… well, up to 999 items.

That’s it!

I just thought those were some pretty interesting ways to work with list markers in CSS that run counter (get it?!) to how I’ve traditionally approached this sort of thing. And with @counter-style becoming Baseline “newly available” in September 2023, it’s well-supported in browsers.


Some Things You Might Not Know About Custom Counter Styles originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Geoff Graham
Tue, 21 Jan 2025 14:21:32 +0000


Chris wrote about “Likes” pages a long while back. The idea is rather simple: “Like” an item in your RSS reader and display it in a feed of other liked items. The little example Chris made is still really good.

There were two things Chris noted at the time. One was that he used a public CORS proxy that he wouldn’t use in a production environment. Good idea to nix that, security and all. The other was that he’d consider using WordPress transients to fetch and cache the data to work around CORS.

I decided to do that! The result is this WordPress block I can drop right in here. I’ll plop it in a <details> to keep things brief.

Open Starred Feed
Link on 1/6/2025

The :empty pseudo-class

We can use the :empty pseudo-class as a way to style elements on your webpage that are empty.

You might wonder why youโ€™d want to style something thatโ€™s empty. Letโ€™s say youโ€™re creating a todo list.

You want to put your todo items in a list, but what about when you donโ€™t…

Link on 1/8/2025

CSS Wish List 2025

Back in 2023, I belatedly jumped on the bandwagon of people posting their CSS wish lists for the coming year.  This year Iโ€™m doing all that again, less belatedly! (I didnโ€™t do it last year because I couldnโ€™t even.  Get it?)

I started this post by looking at what I…

Link on 1/9/2025

aria-description Does Not Translate

It does, actually. In Firefox. Sometimes.

A major risk of using ARIA to define text content is it typically gets overlooked in translation. Automated translation services often do not capture it. Those who pay for localization services frequently miss content in ARIA attributes when sending text strings to localization vendors.

Content buried…

It’s a little different. For one, I’m only fetching 10 items at a time. We could push that to infinity but that comes with a performance tax, not to mention I have no way of organizing the items for them to be grouped and filtered. Maybe that’ll be a future enhancement!

The Chris demo provided the bones and it does most of the heavy lifting. The “tough” parts were square-pegging the thing into a WordPress block architecture and then getting transients going. This is my first time working with transients, so I thought I’d share the relevant code and pick it apart.

function fetch_and_store_data() {
  $transient_key = 'fetched_data';
  $cached_data = get_transient($transient_key);

  if ($cached_data) {
    return new WP_REST_Response($cached_data, 200);
  }

  $response = wp_remote_get('https://feedbin.com/starred/a22c4101980b055d688e90512b083e8d.xml');
  if (is_wp_error($response)) {
    return new WP_REST_Response('Error fetching data', 500);
  }

  $body = wp_remote_retrieve_body($response);
  $data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
  $json_data = json_encode($data);
  $array_data = json_decode($json_data, true);

  $items = [];
  foreach ($array_data['channel']['item'] as $item) {
    $items[] = [
      'title' => $item['title'],
      'link' => $item['link'],
      'pubDate' => $item['pubDate'],
      'description' => $item['description'],
    ];
  }

  set_transient($transient_key, $items, 12 * HOUR_IN_SECONDS);

  return new WP_REST_Response($items, 200);
}

add_action('rest_api_init', function () {
  register_rest_route('custom/v1', '/fetch-data', [
    'methods' => 'GET',
    'callback' => 'fetch_and_store_data',
  ]);
});

Could this be refactored and written more efficiently? All signs point to yes. But here’s how I grokked it:

function fetch_and_store_data() {

}

The function’s name can be anything. Naming is hard. The first two variables:

$transient_key = 'fetched_data';
$cached_data = get_transient($transient_key);

The $transient_key is simply a name that identifies the transient when we set it and get it. In fact, the $cached_data is the getter so that part’s done. Check!

I only want the $cached_data if it exists, so there’s a check for that:

if ($cached_data) {
  return new WP_REST_Response($cached_data, 200);
}

This also establishes a new response from the WordPress REST API, which is where the data is cached. Rather than pull the data directly from Feedbin, I’m pulling it and caching it in the REST API. This way, CORS is no longer an issue being that the starred items are now locally stored on my own domain. That’s where the wp_remote_get() function comes in to form that response from Feedbin as the origin:

$response = wp_remote_get('https://feedbin.com/starred/a22c4101980b055d688e90512b083e8d.xml');

Similarly, I decided to throw an error if there’s no $response. That means there’s no freshly $cached_data and that’s something I want to know right away.

if (is_wp_error($response)) {
  return new WP_REST_Response('Error fetching data', 500);
}

The bulk of the work is merely parsing the XML data I get back from Feedbin to JSON. This scours the XML and loops through each item to get its title, link, publish date, and description:

$body = wp_remote_retrieve_body($response);
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
$json_data = json_encode($data);
$array_data = json_decode($json_data, true);

$items = [];
foreach ($array_data['channel']['item'] as $item) {
  $items[] = [
    'title' => $item['title'],
    'link' => $item['link'],
    'pubDate' => $item['pubDate'],
    'description' => $item['description'],
  ];
}

“Description” is a loaded term. It could be the full body of a post or an excerpt โ€” we don’t know until we get it! So, I’m splicing and trimming it in the block’s Edit component to stub it at no more than 50 words. There’s a little risk there because I’m rendering the HTML I get back from the API. Security, yes. But there’s also the chance I render an open tag without its closing counterpart, muffing up my layout. I know there are libraries to address that but I’m keeping things simple for now.

Now it’s time to set the transient once things have been fetched and parsed:

set_transient($transient_key, $items, 12 * HOUR_IN_SECONDS);

The WordPress docs are great at explaining the set_transient() function. It takes three arguments, the first being the $transient_key that was named earlier to identify which transient is getting set. The other two:

  • $value: This is the object we’re storing in the named transient. That’s the $items object handling all the parsing.
  • $expiration: How long should this transient last? It wouldn’t be transient if it lingered around forever, so we set an amount of time expressed in seconds. Mine lingers for 12 hours before it expires and then updates the next time a visitor hits the page.

OK, time to return the items from the REST API as a new response:

return new WP_REST_Response($items, 200);

That’s it! Well, at least for setting and getting the transient. The next thing I realized I needed was a custom REST API endpoint to call the data. I really had to lean on the WordPress docs to get this going:

add_action('rest_api_init', function () {
  register_rest_route('custom/v1', '/fetch-data', [
    'methods' => 'GET',
    'callback' => 'fetch_and_store_data',
  ]);
});

That’s where I struggled most and felt like this all took wayyyyy too much time. Well, that and sparring with the block itself. I find it super hard to get the front and back end components to sync up and, honestly, a lot of that code looks super redundant if you were to scope it out. That’s another story altogether.

Enjoy reading what we’re reading! I put a page together that pulls in the 10 most recent items with a link to subscribe to the full feed.


Creating a “Starred” Feed originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Chris Coyier
Mon, 20 Jan 2025 16:31:11 +0000


HTML is fun to think about. The old classic battle of “HTML is a programming language” has surfaced in the pages of none other than WIRED magazine. I love this argument, not even for it’s merit, but for the absolutely certainty that you will get people coming out of the woodwork to tell you that HTML, is not, in fact, a programming language. Each of them will have their own exotic and deeply personal reasons why. I honestly don’t even care or believe their to be any truth to be found in the debate, but I find it fascinating as a social experiment. It’s like cracking an IE 6 “joke” at a conference. You will get laughs.

I wrote a guest blog post Relatively New Things You Should Know about HTML Heading Into 2025 at the start of the year here which had me thinking about it anyway. So here’s more!

You know there are those mailto: “protocol” style links you can use, like:

<a href="mailto:chriscoyier@gmail.com">Email Chris</a>

And they work fine. Or… mostly fine. They work if there is an email client registered on the device. That’s generally the case, but it’s not 100%. And there are more much more esoteric ones, as Brian Kardell writes:

Over 30% of websites include at least one mailto: link. Almost as many sites include a tel: link. Thereโ€™s plenty of webcal: and fax:geo: is used on over 20,300 sites. sms: is used on 42,600+ websites.

A tel: link on my Mac tries to open FaceTime. What does it do on a computer with no calling capability at all, like my daughter’s Fire tablet thingy? Nothing, probably. Just like clicking on a skype: link on my computer here, which doesn’t have Skype installed does: nothing. A semantic HTML link element that looks and clicks like any other link that does nothing is, well, it’s not good. Brian spells out a situation where it’s extra not good, where a link could say like “Call Pizza Parlor” with the actual phone number buried behind the scenes in HTML, whereas if it was just a phone number, mobile browser that support it would automatically turn it into a clickable link, which is surely better.


Every once in a while I get excited about the prospect of writing HTML email with just regular ol’ semantic HTML that you’d write anywhere else. And to be fair: some people absolutely do that and it’s interesting to follow those developments.

The last time I tried to get away with “no tables”, the #1 thing that stops me is that you can’t get a reasonable width and centered layout without them in old Outlook. Oh well, that’s the job sometimes.


Ambiguity. That’s one thing that there is plenty of in HTML and I suspect people’s different brains handle it quite differently. Some people try something and it if works they are pleased with that and move on. “Works” being a bit subjective of course, since works on the exact browser you’re using at the time as a developer isn’t necessarily reflective of all users. Some people absolutely fret over the correct usage of HTML in all sorts of situations. That’s my kinda people.

In Stephanie Eckles’ A Call for Consensus on HTML Semantics she lists all sorts of these ambiguities, honing in on particularly tricky ones where there are certainly multiple ways to approach it.

Should testimonials be in aย figureย or aย blockquoteย orโ€ฆ both? (Honestly, when the heck should we even useย figureย orย blockquoteย in generalโ€ฆ does anyone really know? 😅)

While I’m OK with the freedom and some degree of ambiguity, I like to sweat the semantics and kinda do wish there were just emphatically right answers sometimes.


Wanna know why hitting an exact markup pattern matters sometimes? Aside from good accessibility and potentially some SEO concern, sometimes you get good bonus behavior. Simon Willison blogged about Footnotes that work in RSS readers, which is one such situation, building on some thoughts and light research I had done. This is pretty niche, but if you do footnotes just exactly so you’ll get very nice hover behavior in NetNewsWire for footnotes, which happens to be an RSS reader that I like.


They talk about paving the cowpaths in web standards. Meaning standardizing ideas when it’s obvious authors are doing it a bunch. I, for one, have certainly seen “spoilers” implemented quite a bit in different ways. Tracy Durnell wonders if we should just add it to HTML directly.

by: Temani Afif
Fri, 17 Jan 2025 14:57:39 +0000


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.

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:

<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li class="active"><a href="#">About</a></li>
    <li><a href="#">Projects</a></li>
    <li><a href="#">Blog</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>

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.

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.

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.

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 <dashed-indent> syntax, meaning the name must always start with two dashes (--).

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 <length> 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.

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!

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!

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:

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


Fancy Menu Navigation Using Anchor Positioning originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

Thea

by: aiparabellum.com
Fri, 17 Jan 2025 02:59:35 +0000


https://www.theastudy.com/?referralCode=aipara

Thea Study is a revolutionary AI-powered platform designed to optimize studying and learning for students of all levels. With its user-friendly interface and cutting-edge technology, Thea serves as a personalized study companion that adapts to your learning style. Whether youโ€™re preparing for standardized tests, mastering school subjects, or needing quick summaries of your notes, Thea offers an innovative solution tailored to your needs. Completely free until April 15, 2025, Thea is transforming how students prepare for academic success.

Features of Thea

Thea offers a robust suite of features aimed at enhancing study efficiency and understanding:

  1. Smart Study
    • Practice with varied questions using the Socratic method to improve comprehension.
    • Gain deeper understanding through dynamic, interactive learning.
  2. Flashcards
    • Create instant, interactive flashcards for effective memorization.
    • Review on-the-go with engaging games and activities.
  3. Summarize
    • Upload study materials, and Thea generates concise summaries in seconds.
    • Break down complex content into manageable, digestible parts.
  4. Study Guides
    • Generate comprehensive study guides effortlessly.
    • Download guides instantly for offline use.
  5. Test Simulation
    • Experience real exam conditions with Theaโ€™s test environment.
    • Reduce test anxiety and enhance readiness for the big day.
  6. Spaced Repetition
    • Utilize scientifically-backed learning techniques to strengthen long-term memory.
    • Review material at optimal intervals for maximum retention.
  7. Language Support
    • Access Thea in over 80 languages for a truly global learning experience.
  8. Customizable Difficulty Levels
    • Adjust question difficulty to match your learning needs, from beginner to advanced.

How It Works

Thea is designed to be intuitive and easy to use. Hereโ€™s how it works:

  1. Create a free account to access all features.
  2. Start by uploading study materials or selecting a subject.
  3. Choose the desired study feature: flashcards, summaries, or tests.
  4. Let Thea generate personalized content tailored to your input.
  5. Practice using interactive tools like Smart Study or Test Simulation.
  6. Track your progress and refine your approach based on performance.

Benefits of Thea

Thea offers numerous advantages for students aiming to optimize their academic efforts:

  1. Time Efficiency
    • Thea reduces study time by offering precise, ready-to-use materials.
  2. Stress Reduction
    • Simulated test environments and organized study guides help alleviate anxiety.
  3. Personalized Learning
    • Adaptive features cater to individual learning styles and needs.
  4. Accessibility
    • Completely free until 2025, making it accessible to all learners globally.
  5. Versatility
    • Suitable for various subjects, including math, history, biology, and more.
  6. Global Reach
    • Supports multiple languages and educational systems worldwide.

Pricing

Thea is currently free to use with no paywalls, ensuring accessibility to students worldwide. This free access is guaranteed until at least April 15, 2025. Pricing details for future plans are yet to be finalized, but the platformโ€™s affordability will remain a priority.

Thea Review

Students and educators worldwide highly praise Thea for its innovative and effective approach to studying. Testimonials highlight its ability to improve grades, reduce stress, and make learning engaging. Users appreciate features like the instant flashcards, test simulation, and comprehensive summaries, which set Thea apart from other study platforms. The platform is often described as a game-changer that combines advanced AI with simplicity and usability.

Conclusion

Thea Study is redefining how students approach learning by offering a comprehensive, AI-powered study solution. From personalized content to real exam simulations, Thea ensures that every student can achieve their academic goals with ease. Whether youโ€™re preparing for AP exams, IB tests, or regular coursework, Theaโ€™s innovative tools will save you time and enhance your understanding. With free access until 2025, thereโ€™s no better time to explore Thea as your ultimate study companion.

The post Thea appeared first on AI Parabellum.

Thea

by: aiparabellum.com
Fri, 17 Jan 2025 02:59:35 +0000


https://www.theastudy.com/?referralCode=aipara

Thea Study is a revolutionary AI-powered platform designed to optimize studying and learning for students of all levels. With its user-friendly interface and cutting-edge technology, Thea serves as a personalized study companion that adapts to your learning style. Whether youโ€™re preparing for standardized tests, mastering school subjects, or needing quick summaries of your notes, Thea offers an innovative solution tailored to your needs. Completely free until April 15, 2025, Thea is transforming how students prepare for academic success.

Features of Thea

Thea offers a robust suite of features aimed at enhancing study efficiency and understanding:

  1. Smart Study
    • Practice with varied questions using the Socratic method to improve comprehension.
    • Gain deeper understanding through dynamic, interactive learning.
  2. Flashcards
    • Create instant, interactive flashcards for effective memorization.
    • Review on-the-go with engaging games and activities.
  3. Summarize
    • Upload study materials, and Thea generates concise summaries in seconds.
    • Break down complex content into manageable, digestible parts.
  4. Study Guides
    • Generate comprehensive study guides effortlessly.
    • Download guides instantly for offline use.
  5. Test Simulation
    • Experience real exam conditions with Theaโ€™s test environment.
    • Reduce test anxiety and enhance readiness for the big day.
  6. Spaced Repetition
    • Utilize scientifically-backed learning techniques to strengthen long-term memory.
    • Review material at optimal intervals for maximum retention.
  7. Language Support
    • Access Thea in over 80 languages for a truly global learning experience.
  8. Customizable Difficulty Levels
    • Adjust question difficulty to match your learning needs, from beginner to advanced.

How It Works

Thea is designed to be intuitive and easy to use. Hereโ€™s how it works:

  1. Create a free account to access all features.
  2. Start by uploading study materials or selecting a subject.
  3. Choose the desired study feature: flashcards, summaries, or tests.
  4. Let Thea generate personalized content tailored to your input.
  5. Practice using interactive tools like Smart Study or Test Simulation.
  6. Track your progress and refine your approach based on performance.

Benefits of Thea

Thea offers numerous advantages for students aiming to optimize their academic efforts:

  1. Time Efficiency
    • Thea reduces study time by offering precise, ready-to-use materials.
  2. Stress Reduction
    • Simulated test environments and organized study guides help alleviate anxiety.
  3. Personalized Learning
    • Adaptive features cater to individual learning styles and needs.
  4. Accessibility
    • Completely free until 2025, making it accessible to all learners globally.
  5. Versatility
    • Suitable for various subjects, including math, history, biology, and more.
  6. Global Reach
    • Supports multiple languages and educational systems worldwide.

Pricing

Thea is currently free to use with no paywalls, ensuring accessibility to students worldwide. This free access is guaranteed until at least April 15, 2025. Pricing details for future plans are yet to be finalized, but the platformโ€™s affordability will remain a priority.

Thea Review

Students and educators worldwide highly praise Thea for its innovative and effective approach to studying. Testimonials highlight its ability to improve grades, reduce stress, and make learning engaging. Users appreciate features like the instant flashcards, test simulation, and comprehensive summaries, which set Thea apart from other study platforms. The platform is often described as a game-changer that combines advanced AI with simplicity and usability.

Conclusion

Thea Study is redefining how students approach learning by offering a comprehensive, AI-powered study solution. From personalized content to real exam simulations, Thea ensures that every student can achieve their academic goals with ease. Whether youโ€™re preparing for AP exams, IB tests, or regular coursework, Theaโ€™s innovative tools will save you time and enhance your understanding. With free access until 2025, thereโ€™s no better time to explore Thea as your ultimate study companion.

The post Thea appeared first on AI Parabellum.

by: Lee Meyer
Wed, 15 Jan 2025 15:03:25 +0000


My previous article warned that horizontal motion on Tinder has irreversible consequences. Iโ€™ll save venting on that topic for a different blog, but at first glance, swipe-based navigation seems like it could be a job for Web-Slinger.css, your friendly neighborhood experimental pure CSS Wow.js replacement for one-way scroll-triggered animations. I havenโ€™t managed to fit that description into a theme song yet, but Iโ€™m working on it.

In the meantime, can Web-Slinger.css swing a pure CSS Tinder-style swiping interaction to indicate liking or disliking an element? More importantly, will this experiment give me an excuse to use an image of Spider Pig, in response to popular demand in the bustling comments section of my previous article? Behold the Spider Pig swiper, which I propose as a replacement for captchas because every human with a pulse loves Spider Pig. With that unbiased statement in mind, swipe left or right below (only Chrome and Edge for now) to reveal a counter showing how many people share your stance on Spider Pig.

Broaden your horizons

The crackpot who invented Web-Slinger.css seems not to have considered horizontal scrolling, but we can patch that maniacโ€™s monstrous creation like so:

[class^="scroll-trigger-"] {
  view-timeline-axis: x;
}

This overrides the default behavior for marker elements with class names using the Web-Slinger convention of scroll-trigger-n, which activates one-way, scroll-triggered animations. By setting the timeline axis to x, the scroll triggers only run when they are revealed by scrolling horizontally rather than vertically (which is the default). Otherwise, the triggers would run straightaway because although they are out of view due to the containerโ€™s width, they will all be above the fold vertically when we implement our swiper.

My steps in laying the foundation for the above demo were to fork this awesome JavaScript demo of Tinder-style swiping by Nikolay Talanov, strip out the JavaScript and all the cards except for one, then import Web-Slinger.css and introduce the horizontal patch explained above. Next, I changed the cardโ€™s container to position: fixed, and introduced three scroll-snapping boxes side-by-side, each the height and width of the viewport. I set the middle slide to scroll-align: center so that the user starts in the middle of the page and has the option to scroll backwards or forwards.

Sidenote: When unconventionally using scroll-driven animations like this, a good mindset is that the scrollable element neednโ€™t be responsible for conventionally scrolling anything visible on the page. This approach is reminiscent of how the first thing you do when using checkbox hacks is hide the checkbox and make the label look like something else. We leverage the CSS-driven behaviors of a scrollable element, but we donโ€™t need the default UI behavior.

I put a div marked with scroll-trigger-1 on the third slide and used it to activate a rejection animation on the card like this:

<div class="demo__card on-scroll-trigger-1 reject">
  <!-- HTML for the card -->
</div>

<main>
  <div class="slide">
  </div>
  <div id="middle" class="slide">
  </div>
  <div class="slide">
      <div class="scroll-trigger-1"></div>
  </div>
</main>

It worked the way I expected! I knew this would be easy! (Narrator: it isnโ€™t, youโ€™ll see why next.)

<div class="on-scroll-trigger-2 accept">
  <div class="demo__card on-scroll-trigger-2 reject">
  <!-- HTML for the card -->
  </div>
</div>

<main>
  <div class="slide">
      <div class="scroll-trigger-2"></div>
  </div>
  <div id="middle" class="slide">
  </div>
  <div class="slide">
      <div class="scroll-trigger-1"></div>
  </div>
</main>

After adding this, Spider Pig is automatically โ€likedโ€ when the page loads. That would be appropriate for a card that shows a person like myself who everybody automatically likes โ€” after all, a middle-aged guy who spends his days and nights hacking CSS is quite a catch. By contrast, it is possible Spider Pig isnโ€™t everyoneโ€™s cup of tea. So, letโ€™s understand why the swipe right implementation would behave differently than the swipe left implementation when we thought we applied the same principles to both implementations.

Take a step back

This bug drove home to me what view-timeline does and doesnโ€™t do. The lunatic creator of Web-Slinger.css relied on tech that wasnโ€™t made for animations which run only when the user scrolls backwards.

This visualizer shows that no matter what options you choose for animation-range, the subject wants to complete its animation after it has crossed the viewport in the scrolling direction โ€” which is exactly what we do not want to happen in this particular case.

Fortunately, our friendly neighborhood Bramus from the Chrome Developer Team has a cool demo showing how to detect scroll direction in CSS. Using the clever --scroll-direction CSS custom property Bramus made, we can ensure Spider Pig animates at the right time rather than on load. The trick is to control the appearance of .scroll-trigger-2 using a style query like this:

:root {
  animation: adjust-slide-index 3s steps(3, end), adjust-pos 1s;
  animation-timeline: scroll(root x);
}
@property --slide-index {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@keyframes adjust-slide-index {
  to {
    --slide-index: 3;
  }
}

.scroll-trigger-2  {
  display: none;
}

@container style(--scroll-direction: -1) and style(--slide-index: 0) {
  .scroll-trigger-2 {
    display: block;
  }
}

That style query means that the marker with the .scroll-trigger-2 class will not be rendered until we are on the previous slide and reach it by scrolling backward. Notice that we also introduced another variable named --slide-index, which is controlled by a three-second scroll-driven animation with three steps. It counts the slide we are on, and it is used because we want the user to swipe decisively to activate the dislike animation. We donโ€™t want just any slight breeze to trigger a dislike.

When the swipe has been concluded, one more like (Iโ€™m superhuman)

As mentioned at the outset, measuring how many CSS-Tricks readers dislike Spider Pig versus how many have a soul is important. To capture this crucial stat, Iโ€™m using a third-party counter image as a background for the card underneath the Spider Pig card. It is third-party, but hopefully, it will always work because the website looks like it has survived since the dawn of the internet. I shouldnโ€™t complain because the price is right. I chose the least 1990s-looking counter and used it like this:

@container style(--scroll-trigger-1: 1) {
  .result {
    background-image: url('https://counter6.optistats.ovh/private/freecounterstat.php?c=qbgw71kxx1stgsf5shmwrb2aflk5wecz');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
  }

  .counter-description::after {
    content: 'who like spider pig';
  }

  .scroll-trigger-2 {
    display: none;
  }
}

@container style(--scroll-trigger-2: 1) {
  .result {
    background-image: url('https://counter6.optistats.ovh/private/freecounterstat.php?c=abtwsn99snah6wq42nhnsmbp6pxbrwtj');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
  }

  .counter-description::after {
    content: 'who dislike spider pig';
  }

  .scroll-trigger-1 {
    display: none;
  }
}

Scrolls of wisdom: Lessons learned

This hack turned out more complex than I expected, mostly because of the complexity of using scroll-triggered animations that only run when you meet an element by scrolling backward which goes against assumptions made by the current API. Thatโ€™s a good thing to know and understand. Still, itโ€™s amazing how much power is hidden in the current spec. We can style things based on extremely specific scrolling behaviors if we believe in ourselves. The current API had to be hacked to unlock that power, but I wish we could do something like:

[class^="scroll-trigger-"] {
  view-timeline-axis: x;
  view-timeline-direction: backwards; /* <-- this is speculative. do not use! */
}

With an API like that allowing the swipe-right scroll trigger to behave the way I originally imagined, the Spider Pig swiper would not require hacking.

I dream of wider browser support for scroll-driven animations. But I hope to see the spec evolve to give us more flexibility to encourage designers to build nonlinear storytelling into the experiences they create. If not, once animation timelines land in more browsers, it might be time to make Web-Slinger.css more complete and production-ready, to make the more advanced scrolling use cases accessible to the average CSS user.


Web-Slinger.css: Across the Swiper-Verse originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Geoff Graham
Tue, 14 Jan 2025 14:49:10 +0000


(This is a sponsored post.)

It’s probably no surprise to you that CSS-Tricks is (proudly) hosted on Cloudways. DigitalOcean bought us back in 2021 then turned right around around and did the same with Cloudways shortly after. It was just a matter of time before we’d come together this way. And here we are!

We were previously hosted on Flywheel which was a fairly boutique WordPress hosting provider until WP Engine purchased it years back. And, to be very honest and up-front, Flywheel served us extremely well. There reached a point when it became pretty clear that CSS-Tricks was simply too big for Flywheel to scale along. That might’ve led us to try out WP Engine in the absence of Cloudways… but it’s probably good that never came to fruition considering recent events.

Anyway, moving hosts always means at least a smidge of contest-switching. Different server names with different configurations with different user accounts with different controls.

We’re a pretty low-maintenance operation around here, so being on a fully managed host is a benefit because I see very little of the day-to-day nuance that happens on our server. The Cloudways team took care of all the heavy lifting of migrating us and making sure we were set up with everything we needed, from SFTP accounts and database access to a staging environment and deployment points.

Our development flow used to go something like this:

  • Fire up Local (Flywheel’s local development app)
  • Futz around with local development
  • Push to main
  • Let a CI/CD pipeline publish the changes

I know, ridiculously simple. But it was also riddled with errors because we didn’t always want to publish changes on push. There was a real human margin of error in there, especially when handling WordPress updates. We could have (and should have) had some sort of staging environment rather than blindly trusting what was working locally. But again, we’re kinduva a ragtag team despite the big corporate backing.

The flow now looks like this:

  • Fire up Local (we still use it!)
  • Futz around with local development
  • Push to main
  • Publish to staging
  • Publish to production

This is something we could have set up in Flywheel but was trivial with Cloudways. I gave up some automation for quality assurance’s sake. Switching environments in Cloudways is a single click and I like a little manual friction to feel like I have some control in the process. That might not scale well for large teams on an enterprise project, but that’s not really what Cloudways is all about โ€” that’s why we have DigitalOcean!

See that baseline-status-widget branch in the dropdown? That’s a little feature I’m playing with (and will post about later). I like that GitHub is integrated directly into the Cloudways UI so I can experiment with it in whatever environment I want, even before merging it with either the staging or master branches. It makes testing a whole lot easier and way less error-prone than triggering auto-deployments in every which way.

Here’s another nicety: I get a good snapshot of the differences between my environments through Cloudways monitoring. For example, I was attempting to update our copy of the Gravity Forms plugin just this morning. It worked locally but triggered a fatal in staging. I went in and tried to sniff out what was up with the staging environment, so I headed to the Vulnerability Scanner and saw that staging was running an older version of WordPress compared to what was running locally and in production. (We don’t version control WordPress core, so that was an easy miss.)

I hypothesized that the newer version of Gravity Forms had a conflict with the older version of WordPress, and this made it ridiculously easy to test my assertion. Turns out that was correct and I was confident that pushing to production was safe and sound โ€” which it was.

That little incident inspired me to share a little about what I’ve liked about Cloudways so far. You’ll notice that we don’t push our products too hard around here. Anytime you experience something delightful โ€” whatever it is โ€” is a good time to blog about it and this was clearly one of those times.

I’d be remiss if I didn’t mention that Cloudways is ideal for any size or type of WordPress site. It’s one of the few hosts that will let you BOYO cloud, so to speak, where you can hold your work on a cloud server (like a DigitalOcean droplet, for instance) and let Cloudways manage the hosting, giving you all the freedom to scale when needed on top of the benefits of having a managed host. So, if you need a fully managed, autoscaling hosting solution for WordPress like we do here at CSS-Tricks, Cloudways has you covered.


A Few Ways That Cloudways Makes Running This Site a Little Easier originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Neeraj Mishra
Mon, 13 Jan 2025 15:38:00 +0000


This article will guide you to choose the best laptop for coding and programming and some of my top laptop picks for developers and students in India. I have also given the best picks based on prices under 1 Lakh, 70000, 60000, 50000, 40000, etc.

As a programmer or developer, it becomes really confusing to pick the best laptop from thousands of laptops available in the market. It becomes even more difficult for a person who is just starting programming.

Below I have shared some key points that will definitely help you to pick the perfect laptop for working on any programming technologies, C, C++, C#, Java, Python, SQL, Android, etc.

Also Read: 8 Best Keyboards for Programming in India

How to Choose Best Laptop for Programming in 2017?

Image Source

How to Choose the Best Laptop for Programming?

RAM

It is the first and most important thing that you should look for. A laptop with 8GB RAM is an ideal choice but 16GB RAM would be the best choice. If your budget is too low then you can go with 4GB RAM also.

Believe me, it really sucks working on a low-performance machine. Earlier I used to do Android app development on a laptop with 4GB RAM. It was so annoying because everything works really slowly.

So I would highly recommend you a 16GB RAM laptop if you are an app developer.

  • Best Choice: 16GB RAM or High
  • Ideal Choice: 8GB RAM

Processor

Good processor and RAM should be your highest priority when choosing a laptop for programming. As a programmer or developer, we have to do multitasking. When I do programming or development I have to open a few IDEs along with a browser with several tabs opened. For such a purpose, a good processor is required.

A laptop with an i5 processor is an ideal choice. You can go with i7 processor if you have a good budget and for a low budget, you can go with i3 processor.

  • Best Choice: i7 Processor or High
  • Ideal Choice: i5 Processor

Note: Now Apple laptops are powered by M1 & M2 Chips. It is also a good choice for programming.

Graphics Card

An external graphics card is not necessary until you are not doing game development or some high graphics-related work. But if you are a game developer then you must go with a laptop with an external graphic card.

Best Choice (Especially For Game Developers): External Graphic Card (4GB or High)

Ideal and Low Budget Choice (For Other Developers): Integrated Graphic Card

Storage

SSD and HDD are two storage types that laptops have. SSD gives faster performance but is costlier than HDD. It’s great if you can afford an SSD storage-type laptop. But if you can’t then go with HDD and later on you can use some external SSD storage or upgrade.

Battery Life

If you mostly work at places where the power supply is not available then you must choose a laptop with huge battery life. Otherwise these days almost all laptops come with moderate battery backup.

You can get custom programmer laptop stickers at www.stickeryou.com.

Below I have shared some laptops that I believe are good for programmers in India. Even if you donโ€™t like any of them you can consider the above points to pick the best laptop according to your usage.

Laptops Under 1 Lakh

Apple MacBook Air with M2 Chip

Apple 2022 MacBook Air Laptop with M2 chip

The Apple MacBook Air 2022 edition defines innovation, bringing together Apple’s renowned M2 chip with a lightweight design, perfect for programmers who appreciate both power and portability.

FeaturesDetails
ProcessorNext-gen 8-core CPU, up to 10-core GPU, 24GB unified memory
Display13.6-inch Liquid Retina, 500+ nits brightness
Memory & StorageUnified 24GB Memory (not specified storage)
GraphicsIntegrated with M2 Chip
DesignStrikingly thin, weighs 1.24 kg
BatteryUp to 18 hours
Camera & Audio1080p FaceTime HD, three-mic array, four-speaker system with Spatial Audio
Ports & ConnectivityMagSafe charging, two Thunderbolt ports, headphone jack

Lenovo IdeaPad Slim 5

Lenovo IdeaPad Slim 5 Intel Core i7 12th Gen

Offering the power of Intel’s 12th Gen processors, the Lenovo IdeaPad Slim 5 promises dependable performance in a sleek package, making it a developer’s reliable sidekick.

FeaturesDetails
Processor12th Gen Intel Core i7-1255U, 10 Cores, 12 Threads, 12MB Cache
Display15.6″ FHD, 300 nits brightness, Anti-Glare, IPS
Memory & Storage16GB RAM DDR4-3200, 512 GB SSD
GraphicsIntegrated Intel Iris Xe
Design1.69 cm thin, 1.85 kg weight, Aluminium top
Battery8 Hours, 76Wh
Camera & AudioFHD 1080p, Fixed Focus, Privacy Shutter, Dual Array Microphone, 2 x 2W Stereo Speakers, Dolby Audio
Ports & ConnectivityUSB-A, USB-C, HDMI 1.4b, 4-in-1 media reader

HP Pavilion 14

HP Pavilion 14 12th Gen Intel Core i7

Fusing HP’s commitment to sustainability with Intel’s 12th Gen might, the HP Pavilion 14 offers an eco-conscious choice without sacrificing performance, making it a top pick for developers.

FeaturesDetails
ProcessorIntel Core i7-1255U (up to 4.7 GHz), 10 cores, 12 threads
Display14″ FHD, IPS, micro-edge, BrightView, 250 nits
Memory & Storage16 GB DDR4-3200 SDRAM, 1 TB PCIe NVMe M.2 SSD
GraphicsIntel UHD Graphics
DesignCompact form with backlit keyboard
Battery3-cell, 43 Wh Li-ion
Camera & AudioHP Wide Vision 720p HD camera, Audio by B&O, Dual Speakers
Ports & ConnectivityUSB Type-C, USB Type-A, HDMI 2.1

Laptops Under 70000

ASUS Vivobook Pro 15

ASUS Vivobook Pro 15

The ASUS Vivobook Pro 15 offers impressive hardware specifications encapsulated within an ultra-portable design. With the power of AMD’s Ryzen 5 and NVIDIA’s RTX 3060, it promises to be a powerhouse for programmers and multitaskers alike.

FeatureDetails
ProcessorAMD Ryzen 5 5600H (4.2 GHz, 6 cores)
RAM16 GB DDR4
Storage512 GB SSD
GraphicsNVIDIA GeForce RTX 3060 (4 GB GDDR6)
Display15.6-inch FHD LED (1920 x 1080) with 144Hz refresh rate
Operating SystemWindows 11 Home
Special FeaturesFingerprint Reader, HD Audio, Backlit Keyboard, Memory Card Slot
ConnectivityUSB Type C, Micro USB Type A, 3.5mm Audio, Bluetooth 5
Battery Life6 Hours

HP Pavilion 14

HP Pavilion 14, 12th Gen Intel Core i5-1235U

HP Pavilion 14 pairs the latest 12th Gen Intel Core i5 with robust memory and storage options. It is engineered for performance and designed with elegance, boasting a slim profile and long-lasting battery.

FeatureDetails
Processor10-core 12th Gen Intel Core i5-1235U with Intel Iris Xแต‰ graphics
RAM16 GB DDR4
Storage512GB PCle NVMe M.2 SSD
Display14-inch FHD Micro-edge display (250-nit)
Operating SystemWindows 11 (MS Office 2019 pre-loaded)
ConnectivityWi-Fi 6 (2×2), Bluetooth 5.2, USB Type-C, 2x USB Type-A, HDMI 2.1
Battery LifeFast charging (up to 50% in 30 mins)
Additional FeaturesHP Wide Vision 720p HD camera, Audio by B&O, Fingerprint reader

Lenovo ThinkPad E14

Lenovo ThinkPad E14 Intel Core i5 12th Gen

Renowned for its rugged build and reliability, the Lenovo ThinkPad E14 offers a solid combination of performance and durability. Featuring a 12th Gen Intel Core i5, it is perfect for professionals on the go.

FeatureDetails
Processor12th Gen Intel Core i5-1235UG4 (up to 4.4 GHz, 10 cores)
RAM16GB DDR4 3200 MHz (Upgradable up to 40GB)
Storage512GB SSD M.2 (Upgradable up to 2 TB)
Display14-inch FHD Anti-glare display (250 Nits)
GraphicsIntegrated Intel Iris Xe Graphics
Operating SystemWindows 11 Home SL (MS Office Home & Student 2021 pre-installed)
PortsUSB 2.0, USB 3.2 Gen 1, Thunderbolt 4, HDMI, Ethernet (RJ-45)
Battery LifeUp to 9.4 hours (Rapid Charge up to 80% in 1hr)

HP Laptop 15

HP Laptop 15, 13th Gen Intel Core i5-1335U

HP’s Laptop 15 elevates the user experience with its 13th Gen Intel Core i5 processor, ensuring a smooth multitasking environment. The spacious 15.6-inch display paired with an efficient battery life ensures productivity throughout the day.

FeatureDetails
Processor13th Gen Intel Core i5-1335U, 10-core
RAM16 GB DDR4
Storage512 GB PCIe NVMe M.2 SSD
GraphicsIntegrated Intel Iris Xแต‰ graphics
Display15.6-inch FHD, 250-nit, Micro-edge
ConnectivityWi-Fi 6 (1×1), Bluetooth 5.3, USB Type-C/A, HDMI 1.4b
Operating SystemWindows 11 with MS Office 2021
BatteryFast Charge (50% in 45 mins)

Acer Nitro 5

Acer Nitro 5 12th Gen Intel Core i5

The Acer Nitro 5 stands as a gaming powerhouse, fueled by the 12th Gen Intel Core i5. Aided by NVIDIA’s RTX 3050 graphics, the 144 Hz vibrant display promises an immersive experience, making it an excellent choice for developers and gamers alike.

FeatureDetails
ProcessorIntel Core i5 12th Gen
RAM16 GB DDR4 (upgradable to 32 GB)
Display15.6″ Full HD, Acer ComfyView LED-backlit TFT LCD, 144 Hz
GraphicsNVIDIA GeForce RTX 3050, 4 GB GDDR6
Storage512 GB PCIe Gen4 SSD
Operating SystemWindows 11 Home 64-bit
Weight2.5 Kg
Special FeaturesRGB Backlit Keyboard, Thunderbolt 4
PortsUSB 3.2 Gen 2 (with power-off charging), USB 3.2 Gen 2, USB Type-C (Thunderbolt 4), USB 3.2 Gen 1

ASUS Vivobook 16

ASUS Vivobook 16

Crafted for modern professionals, the ASUS Vivobook 16 blends a sleek design with robust performance. Its 16-inch FHD+ display and integrated graphics ensure clarity, while the Core i5-1335U processor offers smooth multitasking, making it ideal for coders and content creators.

FeatureDetails
ProcessorIntel Core i5-1335U (1.3 GHz base, up to 4.6 GHz)
RAM & Storage16GB 3200MHz (8GB onboard + 8GB SO-DIMM) & 512GB M.2 NVMe PCIe 4.0 SSD
Display16.0-inch FHD+ (1920 x 1200), 60Hz, 45% NTSC Anti-glare
GraphicsIntegrated Intel Iris Xแต‰
Operating System & SoftwareWindows 11 Home with Pre-Installed Office Home and Student 2021 & 1-Year McAfee Anti-Virus
DesignThin (1.99 cm) & Light (1.88 kg), 42WHrs Battery (Up to 6 hours)
KeyboardBacklit Chiclet with Num-key
PortsUSB 2.0 Type-A, USB 3.2 Gen 1 Type-C (supporting power delivery), USB 3.2 Gen 1 Type-A, HDMI 1.4, 3.5mm Combo Audio Jack, DC-in
Other Features720p HD camera (with privacy shutter), Wi-Fi 6E, Bluetooth 5, US MIL-STD 810H military-grade standard, SonicMaster audio with Cortana support

Dell 14 Metal Body Laptop

Dell 14 Metal Body Laptop

Boasting a sturdy metal body, Dell’s 14-inch laptop strikes a balance between style and function. Powered by the 12th Gen Intel i5-1235U and integrated graphics, this machine promises efficiency and versatility for programmers, complemented by enhanced security features.

FeatureDetails
ProcessorIntel Core i5-1235U 12th Generation (up to 4.40 GHz)
RAM & Storage16GB DDR4 3200MHz (2 DIMM Slots, Expandable up to 16GB) & 512GB SSD
Display14.0″ FHD WVA AG Narrow Border 250 nits
GraphicsIntegrated Onboard Graphics
Operating System & SoftwareWin 11 Home + Office H&S 2021 with 15 Months McAfee antivirus subscription
KeyboardBacklit + Fingerprint Reader
PortsUSB 3.2 Gen 1 Type-C (with DisplayPort 1.4), USB 3.2 Gen 1, USB 2.0, Headset jack, HDMI 1.4, Flip-Down RJ-45 (10/100/1000 Mbps), SD 3.0 card slot
FeaturesTรœV Rheinland certified Dell ComfortView, Waves Maxx Audio, Hardware-based TPM 2.0 security chip

Laptops Under 60000

Lenovo IdeaPad Slim 3

Lenovo IdeaPad Slim 3

The Lenovo IdeaPad Slim 3, with its latest 12th Gen Intel i5 processor, ensures optimal performance for programmers. Its slim design and advanced features, such as the Lenovo Aware and Whisper Voice, prioritize user convenience and eye safety. The Xbox GamePass Ultimate subscription further enhances its appeal to gamers and developers alike.

FeaturesDetails
Processor12th Gen Intel i5-1235U, 10 Cores, 1.3 / 4.4GHz (P-core)
Display15.6″ FHD (1920×1080) TN, 250nits Anti-glare
Memory & Storage16GB DDR4-3200 (Max), 512GB SSD
GraphicsIntegrated Intel Iris Xe Graphics
OS & SoftwareWindows 11 Home 64, Office Home and Student 2021
Design & Weight4 Side Narrow Bezel, 1.99 cm Thin, 1.63 kg
Battery LifeUp to 6 Hours, Rapid Charge
Audio & Camera2x 1.5W Stereo Speakers, HD Audio, Dolby Audio, HD 720p with Privacy Shutter
PortsUSB-A, USB-C, HDMI, 4-in-1 media reader
Additional Features & WarrantyLenovo Aware, Whisper Voice, Eye Care, 2 Years onsite manufacturer warranty

HP Laptop 14s

HP Laptop 14s, 12th Gen Intel Core i5-1240P

HP Laptop 14s, a blend of reliability and efficiency, boasts a 12th Gen Intel Core processor and micro-edge display for enhanced visuals. Its long battery life, coupled with HP Fast Charge, is ideal for developers on the go. Integrated with the HP True Vision camera and dual speakers, it’s perfect for seamless conferencing.

FeaturesDetails
Processor12-core 12th Gen Intel Core i5-1240P, 16 threads, 12MB L3 cache
Display14-inch, FHD, 250-nit, micro-edge
Memory & Storage8GB DDR4 RAM, 512GB PCIe NVMe M.2 SSD
GraphicsIntel Iris Xe graphics
ConnectivityWi-Fi 5 (2×2), Bluetooth 5.0
Battery Life & Charging41Wh, HP Fast Charge
Camera & AudioHP True Vision 720p HD camera, Dual speakers
PortsUSB Type-C, USB Type-A, HDMI 1.4b
Software & CertificationWin 11, MS Office 2021, EPEAT Silver registered, ENERGY STAR certified
Warranty & Design1-year on-site standard warranty, Made of recycled plastics

HONOR MagicBook X14

HONOR MagicBook X14

HONOR MagicBook X14, encapsulating speed with style, delivers an exceptional experience with its 12th Gen Intel Core processor and lightweight body. A standout feature is its 2-in-1 Fingerprint Power Button, ensuring utmost privacy. The TรœV Rheinland Low Blue Light Certification affirms that it’s eye-friendly, suitable for prolonged usage.

FeaturesDetails
Processor12th Gen Intel Core i5-12450H, 8 Cores, 2.0 GHz base speed, 4.4 GHz Max Speed
Display14โ€ Full HD IPS Anti-Glare
Memory & Storage8GB LPDDR4x RAM, 512GB PCIe NVMe SSD
GraphicsIntel UHD Graphics
Charging & Battery65W Type-C Fast Charging, 60Wh Battery, Up to 12 hours
Security & Webcam2-in-1 Fingerprint Power Button, 720P HD Webcam
KeyboardBacklit Keyboard
PortsMulti-Purpose Type-C Connector, Supports Charging & Data Transfer, Reverse Charging & Display
Design & WeightPremium Aluminium Metal Body, 16.5MM Thickness, 1.4kg
Operating SystemPre-Loaded Windows 11 Home 64-bit

Comment below if I have any tips for choosing the best laptop for programming and development. You can also ask your queries related to buying a good coding and programming laptop.

The post 10 Best Laptops for Coding and Programming in India 2025 appeared first on The Crazy Programmer.

by: Juan Diego Rodrรญguez
Mon, 13 Jan 2025 15:08:01 +0000

New features donโ€™t just pop up in CSS (but I wish they did). Rather, they go through an extensive process of discussions and considerations, defining, writing, prototyping, testing, shipping handling support, and many more verbs that I canโ€™t even begin to imagine. That process is long, and despite how much I want to get my hands on a new feature, as an everyday developer, I can only wait.

I can, however, control how I wait: do I avoid all possible interfaces or demos that are possible with that one feature? Or do I push the boundaries of CSS and try to do them anyway?

As ambitious and curious developers, many of us choose the latter option. CSS would grow stagnant without that mentality. Thatโ€™s why, today, I want to look at two upcoming functions: sibling-count() and sibling-index(). Weโ€™re waiting for them โ€” and have been for several years โ€” so Iโ€™m letting my natural curiosity get the best of me so I can get a feel for what to be excited about. Join me!

The tree-counting functions

At some point, youโ€™ve probably wanted to know the position of an element amongst its siblings or how many children an element has to calculate something in CSS, maybe for some staggering animation in which each element has a longer delay, or perhaps for changing an elementโ€™s background-color depending on its number of siblings. This has been a long-awaited deal on my CSS wishlists. Take this CSSWG GitHub Issue from 2017:

Feature request. It would be nice to be able to use the counter() function inside of calc() function. That would enable new possibilities on layouts.

However, counters work using strings, rendering them useless inside a calc() function that deals with numbers. We need a set of similar functions that return as integers the index of an element and the count of siblings. This doesnโ€™t seem too much to ask. We can currently query an element by its tree position using the :nth-child() pseudo-selector (and its variants), not to mention query an element based on how many items it has using the :has() pseudo-selector.

Luckily, this year the CSSWG approved implementing the sibling-count() and sibling-index() functions! And we already have something in the spec written down:

The sibling-count() functional notation represents, as an <integer>, the total number of child elements in the parent of the element on which the notation is used.

The sibling-index() functional notation represents, as an <integer>, the index of the element on which the notation is used among the children of its parent. Like :nth-child(), sibling-index() is 1-indexed.

How much time do we have to wait to use them? Earlier this year Adam Argyle said that โ€œa Chromium engineer mentioned wanting to do it, but we donโ€™t have a flag to try it out with yet. Iโ€™ll share when we do!โ€ So, while I am hopeful to get more news in 2025, we probably wonโ€™t see them shipped soon. In the meantime, letโ€™s get to what we can do right now!

Rubbing two sticks together

The closest we can get to tree counting functions in terms of syntax and usage is with custom properties. However, the biggest problem is populating them with the correct index and count. The simplest and longest method is hardcoding each using only CSS: we can use the nth-child() selector to give each element its corresponding index:

li:nth-child(1) {
  --sibling-index: 1;
}

li:nth-child(2) {
  --sibling-index: 2;
}

li:nth-child(3) {
  --sibling-index: 3;
}

/* and so on... */

Setting the sibling-count() equivalent has a bit more nuance since we will need to use quantity queries with the :has() selector. A quantity query has the following syntax:

.container:has(> :last-child:nth-child(m)) { }

โ€ฆwhere m is the number of elements we want to target. It works by checking if the last element of a container is also the nth element we are targeting; thus it has only that number of elements. You can create your custom quantity queries using this tool by Temani Afif. In this case, our quantity queries would look like the following:

ol:has(> :nth-child(1)) {
  --sibling-count: 1;
}

ol:has(> :last-child:nth-child(2)) {
  --sibling-count: 2;
}

ol:has(> :last-child:nth-child(3)) {
  --sibling-count: 3;
}

/* and so on... */

This example is intentionally light on the number of elements for brevity, but as the list grows it will become unmanageable. Maybe we could use a preprocessor like Sass to write them for us, but we want to focus on a vanilla CSS solution here. For example, the following demo can support up to 12 elements, and you can already see how ugly it gets in the code.

Thatโ€™s 24 rules to know the index and count of 12 elements for those of you keeping score. It surely feels like we could get that number down to something more manageable, but if we hardcode each index we are bound increase the amount of code we write. The best we can do is rewrite our CSS so we can nest the --sibling-index and --sibling-count properties together. Instead of writing each property by itself:

li:nth-child(2) {
  --sibling-index: 2;
}

ol:has(> :last-child:nth-child(2)) {
  --sibling-count: 2;
}

We could instead nest the --sibling-count rule inside the --sibling-index rule.

li:nth-child(2) {
  --sibling-index: 2;

  ol:has(> &:last-child) {
    --sibling-count: 2;
  }
}

While it may seem wacky to nest a parent inside its children, the following CSS code is completely valid; we are selecting the second li element, and inside, we are selecting an ol element if its second li element is also the last, so the list only has two elements. Which syntax is easier to manage? Itโ€™s up to you.

But thatโ€™s just a slight improvement. If we had, say, 100 elements we would still need to hardcode the --sibling-index and --sibling-count properties 100 times. Luckily, the following method will increase rules in a logarithmic way, specifically base-2. So instead of writing 100 rules for 100 elements, we will be writing closer to 10 rules for around 100 elements.

Flint and steel

This method was first described by Roman Komarov in October last year, in which he prototypes both tree counting functions and the future random() function. Itโ€™s an amazing post, so I strongly encourage you to read it.

This method also uses custom properties, but instead of hardcoding each one, we will be using two custom properties that will build up the --sibling-index property for each element. Just to be consistent with Romanโ€™s post, we will call them --si1 and --si2, both starting at 0:

li {
  --si1: 0;
  --si2: 0;
}

The real --sibling-index will be constructed using both properties and a factor (F) that represents an integer greater or equal to 2 that tells us how many elements we can select according to the formula sqrt(F) - 1. Soโ€ฆ

  • For a factor of 2, we can select 3 elements.

  • For a factor of 3, we can select 8 elements.

  • For a factor of 5, we can select 24 elements.

  • For a factor of 10, we can select 99 elements.

  • For a factor of 25, we can select 624 elements.

As you can see, increasing the factor by one will give us exponential gains on how many elements we can select. But how does all this translate to CSS?

The first thing to know is that the formula for calculating the --sibling-index property is calc(F * var(--si2) + var(--si1)). If we take a factor of 3, it would look like the following:

li {
  --si1: 0;
  --si2: 0;

  /* factor of 3; it's a harcoded number */
  --sibling-index: calc(3 * var(--si2) + var(--si1));
}

The following selectors may be random but stay with me here. For the --si1 property, we will write rules selecting elements that are multiples of the factor and offset them by one 1 until we reach F - 1, then set --si1 to the offset. This translates to the following CSS:

li:nth-child(Fn + 1) { --si1: 1; }
li:nth-child(Fn + 2) { --si1: 2; }
/* ... */
li:nth-child(Fn+(F-1)) { --si1: (F-1) }

So if our factor is 3, we will write the following rules until we reach F-1, so 2 rules:

li:nth-child(3n + 1) { --si1: 1; }
li:nth-child(3n + 2) { --si1: 2; }

For the --si2 property, we will write rules selecting elements in batches of the factor (so if our factor is 3, we will select 3 elements per rule), going from the last possible index (in this case 8) backward until we simply are unable to select more elements in batches. This is a little more convoluted to write in CSS:

li:nth-child(n + F*1):nth-child(-n + F*1-1){--si2: 1;}
li:nth-child(n + F*2):nth-child(-n + F*2-1){--si2: 2;}
/* ... */
li:nth-child(n+(F*(F-1))):nth-child(-n+(F*F-1)) { --si2: (F-1) }

Again, if our factor is 3, we will write the following two rules:

li:nth-child(n + 3):nth-child(-n + 5) {
  --si2: 1;
}
li:nth-child(n + 6):nth-child(-n + 8) {
  --si2: 2;
}

And thatโ€™s it! By only setting those two values for --si1 and --si2 we can count up to 8 total elements. The math behind how it works seems wacky at first, but once you visually get it, it all clicks. I made this interactive demo in which you can see how all elements can be reached using this formula. Hover over the code snippets to see which elements can be selected, and click on each snippet to combine them into a possible index.

If you crank the elements and factor to the max, you can see that we can select 49 elements using only 14 snippets!

Wait, one thing is missing: the sibling-count() function. Luckily, we will be reusing all we have learned from prototyping --sibling-index. We will start with two custom properties: --sc1 and --sc1 at the container, both starting at 0 as well. The formula for calculating --sibling-count is the same.

ol {
  --sc1: 0;
  --sc2: 0;

  /* factor of 3; also a harcoded number */
  --sibling-count: calc(3 * var(--sc2) + var(--sc1));
}

Romanโ€™s post also explains how to write selectors for the --sibling-count property by themselves, but we will use the :has() selection method from our first technique so we donโ€™t have to write extra selectors. We can cram those --sc1 and --sc2 properties into the rules where we defined the sibling-index() properties:

/* --si1 and --sc1 */
li:nth-child(3n + 1) {
  --si1: 1;

  ol:has(> &:last-child) {
    --sc1: 1;
  }
}

li:nth-child(3n + 2) {
  --si1: 2;

  ol:has(> &:last-child) {
    --sc1: 2;
  }
}

/* --si2 and --sc2 */
li:nth-child(n + 3):nth-child(-n + 5) {
  --si2: 1;

  ol:has(> &:last-child) {
    --sc2: 1;
  }
}

li:nth-child(n + 6):nth-child(-n + 8) {
  --si2: 2;

  ol:has(> &:last-child) {
    --sc2: 2;
  }
}

This is using a factor of 3, so we can count up to eight elements with only four rules. The following example has a factor of 7, so we can count up to 48 elements with only 14 rules.

This method is great, but may not be the best fit for everyone due to the almost magical way of how it works, or simply because you donโ€™t find it aesthetically pleasing. While for avid hands lighting a fire with flint and steel is a breeze, many wonโ€™t get their fire started.

Using a flamethrower

For this method, we will use once again custom properties to mimic the tree counting functions, and whatโ€™s best, we will write less than 20 lines of code to count up to infinityโ€”or I guess to 1.7976931348623157e+308, which is the double precision floating point limit!

We will be using the Mutation Observer API, so of course it takes JavaScript. I know thatโ€™s like admitting defeat for many, but I disagree. If the JavaScript method is simpler (which it is, by far, in this case), then itโ€™s the most appropriate choice. Just as a side note, if performance is your main worry, stick to hard-coding each index in CSS or HTML.

First, we will grab our container from the DOM:

const elements = document.querySelector("ol");

Then weโ€™ll create a function that sets the --sibling-index property in each element and the --sibling-count in the container (it will be available to its children due to the cascade). For the --sibling-index, we have to loop through the elements.children, and we can get the --sibling-count from elements.children.length.

const updateCustomProperties = () => {
  let index = 1;

  for (element of elements.children) {
    element.style.setProperty("--sibling-index", index);
    index++;
  }

  elements.style.setProperty("--sibling-count", elements.children.length);
};

Once we have our function, remember to call it once so we have our initial tree counting properties:

updateCustomProperties();

Lastly, the Mutation Observer. We need to initiate a new observer using the MutationObserver constructor. It takes a callback that gets invoked each time the elements change, so we write our updateCustomProperties function. With the resulting observer object, we can call its observe() method which takes two parameters:

  1. the element we want to observe, and

  2. a config object that defines what we want to observe through three boolean properties: attributes, childList, and subtree. In this case, we just want to check for changes in the child list, so we set that one to true:

const observer = new MutationObserver(updateCustomProperties);
const config = {attributes: false, childList: true, subtree: false};
observer.observe(elements, config);

That would be all we need! Using this method we can count many elements, in the following demo I set the max to 100, but it can easily reach tenfold:

So yeah, thatโ€™s our flamethrower right there. It definitely gets the fire started, but itโ€™s plenty overkill for the vast majority of use cases. But thatโ€™s what we have while we wait for the perfect lighter.

More information and tutorials

Related Issues


How to Wait for the sibling-count() and sibling-index() Functions originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

RepublicLabs

by: aiparabellum.com
Mon, 13 Jan 2025 05:36:03 +0000


https://republiclabs.ai/gen-ai-tools

RepublicLabs.ai is a cutting-edge platform designed to revolutionize the way we create visual content. By leveraging advanced AI generative models, this tool allows users to create stunning images and videos effortlessly. Whether you’re looking to generate professional headshots, artistic visuals, or even fantasy animations, RepublicLabs.ai offers a wide range of tools to cater to your creative needs. It empowers individuals, professionals, and businesses to bring their ideas to life without requiring complex technical skills.

Features of RepublicLabs.ai

RepublicLabs.ai boasts an extensive suite of features tailored to meet diverse creative demands. Here are some of its standout features:

  1. AI Face Generator: Create realistic human faces with ease.
  2. AI Art Generator: Craft artistic visuals and paintings with AI assistance.
  3. Cartoon AI Generator: Turn photos into cartoon-style images.
  4. Fantasy AI: Design imaginative and surreal visuals effortlessly.
  5. Unrestricted AI Image Generator: Generate any image without limitations.
  6. Professional Headshot Generator: Create high-quality headshots for professional use.
  7. AI LinkedIn Photo Generator: Perfect LinkedIn profile pictures created by AI.
  8. Ecommerce Photography Tool: Generate product images optimized for online stores.
  9. Pyramid Flow Video Generator: Produce visually appealing videos with AI technology.
  10. Anime Image Generator: Create anime-style images with ease.
  11. Text-to-Art Generator: Transform text into stunning artwork.
  12. AI Product Advertisement Generator: Create compelling product ads for business needs.
  13. Deep AI Image Generator: Produce high-quality, AI-driven images.
  14. Minimax AI Video Generator: Generate videos with minimal effort.
  15. Uncensored and Unfiltered AI Generators: Produce unrestricted creative content.

How RepublicLabs.ai Works

Creating images and videos with RepublicLabs.ai is simple and user-friendly. Here’s how it works:

  1. Choose a Tool: Select the desired AI tool from the variety of options available on the platform.
  2. Input Your Ideas: Provide a prompt, text, or upload an image to guide the AI in generating content.
  3. Customize Outputs: Adjust styles, colors, and other parameters to personalize the results.
  4. Preview and Download: Review the generated content and download it for use.

The platform is designed with a seamless workflow, ensuring efficiency and quality in every output.

Benefits of RepublicLabs.ai

RepublicLabs.ai offers numerous advantages that make it an invaluable tool for creators:

  • Ease of Use: No technical expertise required; the platform is beginner-friendly.
  • Versatility: Supports a wide range of creative needs, from professional to personal projects.
  • Time-Saving: Generates high-quality visuals and videos in just a few minutes.
  • Cost-Effective: Eliminates the need for expensive photography or design services.
  • Unrestricted Creativity: Enables users to explore limitless possibilities without boundaries.
  • Professional Results: Produces content that meets high-quality standards suitable for business use.

Pricing of RepublicLabs.ai

RepublicLabs.ai offers flexible pricing plans to cater to various user needs. Users can explore free tools like the AI Headshot Generator and other trial options. For advanced features and unrestricted access, premium plans are available. Pricing details can be found on the platform to suit individual and organizational budgets.

Review of RepublicLabs.ai

RepublicLabs.ai has garnered positive reviews from users across different industries. Creators appreciate its user-friendly interface, diverse features, and the quality of its outputs. Professionals have highlighted its efficiency in generating marketing materials, while artists commend its ability to bring imaginative concepts to life. The platform is widely regarded as a game-changer in the field of AI-driven content creation.

Conclusion

RepublicLabs.ai is a versatile and powerful platform that bridges the gap between creativity and technology. With its vast array of AI tools, it empowers users to transform their ideas into captivating images and videos effortlessly. Whether you’re an artist, a marketer, or someone looking to enhance their personal portfolio, RepublicLabs.ai provides the tools you need to succeed. Explore the endless possibilities and let your creativity shine with this innovative AI-powered platform.

The post RepublicLabs appeared first on AI Parabellum.

by: Neeraj Mishra
Sat, 11 Jan 2025 10:39:00 +0000


One of the fastest-growing domains in the recent years is data science. For those who donโ€™t know, data science revolves around different subjects that ultimately lead to one goal. Subjects include math, statistics, specialized programming, advanced analytics, machine learning, and AI.

Working with these subjects, a data scientist uses his expertise to help generate useful insights for guiding an organization with respect to the data they have. Organizing and explaining this data for strategic planning is what a data scientist does and should be skilled at.

Itโ€™s an exciting field, and if youโ€™re an expert or someone who wants to excel as a data scientist, then you must be adept at what you do. When thatโ€™s done, make sure to apply for as many postings in reputed organizations as possible since the jobโ€™s quite in demand.

How to Prepare for Data Scientist Interview

As for the interview process, it can be tough and hectic since you need to demonstrate a good insight into the domain to ensure that youโ€™re an expert. Companies donโ€™t tend to hire people who arenโ€™t insightful or canโ€™t contribute more than theyโ€™re already achieving.

Therefore, letโ€™s get into how you can prepare for a data science interview and excel at getting a job at the company of your liking:

1. Preparing for Coding Interviews

One of the hardest phases of any data science interview is the coding phase. Since the position requires skilled expertise in coding, itโ€™s imperative that you prepare yourself for it. Coding interviews consist of various coding challenges comprising data structures, learning algorithms, statistics, and other related subjects.

In order to prepare for these, you should focus on the foundational concepts for each subject. In addition, you should practice various problems, scaling from easy to professional to emergency levels, so that you can prepare for any real-time situation provided in the interview.

If you want you can find various online courses that you can view and even enroll in to get a certification. Having a certification with your experience will surely do you good in interviews.

2. Preparing for Virtual Interviews

Most companies that are hiring data scientists donโ€™t directly call candidates for physical interviews. They scrutinize available candidates and narrow them down to the optimal ones via virtual interviews.

This usually involves pre-assessment coding tests as well as a short virtual interview that gives the recruiters a better idea of whether the candidate should appear for a second interview or not. Thatโ€™s why you should take good measures and prepare for your virtual interviews as well.

Itโ€™s likely that youโ€™ll be interviewed live and will have to complete an online assessment while being live on your cam. For that, ensure that you have a professional workspace, room, and dressing.

Also, ensure youโ€™re using a stable internet so that you donโ€™t get buffering or any botherations during the time youโ€™re on call. Amongst recommendations, we suggest checking out plans from Xfinity or contacting Xfinity customer services to choose from available reliable options.

Apart from this, ensure your equipment is working properly including your microphone, camera, keyboard, etc. so that any interruptions wonโ€™t undermine your value during the interview.

3. Brushing Up for Technical Interview

In addition to the coding interview, you also need to prepare yourself for a technical interview. This usually happens within the coding interview; however, there can be multiple rounds for it. That is why you need to polish your technical knowledge in order to prepare for it. Here are different steps that you can deploy for it:

Programming Languages

To begin, you need to go through programming languages including Python, R, SQL, etc. necessary for the purpose. This also includes creating code for different pertaining problems as well as utilizing inventiveness for the given situation.

Data Structures & Algorithms

Since the technical round will comprise various algorithms, youโ€™ll need to go through data structures and algorithms too. This will prepare you for any given situation dealing with the algorithms on different difficulty levels.

Data Manipulation & Analysis

Data manipulation is quite important when it comes to being a data scientist since itโ€™s everything. From retrieving to analyzing the information to data cleaning and applying statistics, you should be versed in the technicalities of data manipulation.

Also, you need to be versed in techniques needed for comprehending statistical elements via various techniques such as regression analysis, probabilistic distributions, etc. For that, youโ€™ll need to go through these practices to ensure that you know how real-time problems will be solved.

4. Familiarizing with Business & Financial Concepts

Youโ€™ll also need to familiarize yourself with the companyโ€™s web pages as well as networking sites so that you can adapt your responses accordingly. This will also require you to study in-depth about the job position youโ€™re applying for so that you can orient your answers to whatโ€™s required by the company.

Closing Thoughts

With these pointers, you should be able to prepare yourself for a data science interview. Ensure to keep these handy while youโ€™re preparing for one, and excel at your next interview.

The post How to Prepare for Data Scientist Interview in 2025? appeared first on The Crazy Programmer.

by: Geoff Graham
Thu, 09 Jan 2025 16:16:15 +0000


I wrote a post for Smashing Magazine that was published today about this thing that Chrome and Safari have called “Tight Mode” and how it impacts page performance. I’d never heard the term until DebugBear’s Matt Zeunert mentioned it in a passing conversation, but it’s a not-so-new deal and yet there’s precious little documentation about it anywhere.

So, Matt shared a couple of resources with me and I used those to put some notes together that wound up becoming the article that was published. In short:

Tight Mode discriminates resources, taking anything and everything marked as High and Medium priority. Everything else is constrained and left on the outside, looking in until the body is firmly attached to the document, signaling that blocking scripts have been executed. Itโ€™s at that point that resources marked with Low priority are allowed in the door during the second phase of loading.

The implications are huge, as it means resources are not treated equally at face value. And yet the way Chrome and Safari approach it is wildly different, meaning the implications are wildly different depending on which browser is being evaluated. Firefox doesn’t enforce it, so we’re effectively looking at three distinct flavors of how resources are fetched and rendered on the page.

It’s no wonder web performance is a hard discipline when we have these moving targets. Sure, it’s great that we now have a consistent set of metrics for evaluating, diagnosing, and discussing performance in the form of Core Web Vitals โ€” but those metrics will never be consistent from browser to browser when the way resources are accessed and prioritized varies.


Tight Mode: Why Browsers Produce Different Performance Results originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

by: Zainab Sutarwala
Thu, 09 Jan 2025 10:46:00 +0000


Are you looking for the best free Nodejs hosting platforms? You are at the right place. Node.js is a highly popular JavaScript open-source server environment used by many developers across the world.

Right from its commencement in 2009, the server has grown in huge popularity and is used by a lot of businesses. The industry and business sectors primarily make use of Node.js.

At present, Node.js is a most loved and well-known open-source server environment. Besides this, it provides the most convenient structure, which supports JavaScript as well as resolves various obstacles. Furthermore, it has made JavaScript easily understandable for programmers on the devices. In this article, we will check out the best free Nodejs hosting platforms that will prove very helpful.

By the end, you will have a strong understanding of various options available for the free Node.js hosting solutions accessible for your Node JavaScript projects and can make an informed choice on which service suits your requirements.

Render

Render.com

Render is a new company that offers free static hosting. It offers a wide range of free services that include Node.js & Docker hosting. Its pricing page static site, Redis, PostgreSQL, and services for free. Though thereโ€™s a little catch for PostgreSQL it runs only for 90 days free. Render has the smoothest and easiest developer experience as well and deploying the Node app was easy to use.

It has comprehensive docs that will help you deploy Node.js apps for free and also host various other languages as well as frameworks. There are a few other things that you may deploy on the Render app and they are Go, Python, Docker, and PHP (Laravel). You can host various other Node.js choices on Render such as Bun.js and Deno.

Features:

  • Simple deployment with just one click.
  • Get 1 GB of free storage.
  • Auto Scaling for traffic surges.
  • Constant deployment that will keep applications updated.
  • SSL Certificates for safe communication with the users for free.

Vercel

Vercel.com

Earlier known as Zeit, the Vercel app acts as the top layer of AWS Lambda which will make running your applications easy. Itโ€™s the serverless platform that will run a range of things with stronger attention on the front end.

Vercel hosting platform is a popular hosting service with a lot of cutting-edge functions as well as amazing developer experience. Even though Vercel mainly focuses on front-end applications, it has built-in support that will host serverless Node.js features in a free tier. Vercel will be configured for retaining server experience with the help of the Legacy Serverful Behavior.

Thus, Vercel is the best hosting platform, which is loved by a lot of developers, and hosting Node APIs on this platform will be a great benefit.

Features:

  • Integrate Git hosting solutions like GitLab, GitHub, and BitBucket
  • Vercel provides a generous free plan and does not need a credit card 
  • It supports some popular front-end structures such as Next, React, Vue, and Gatsby
  • Deploy & execute server-less features 
  • Various project themes to bootstrap the new app
  • Vercel analytics will monitor the performance 

Glitch

glitch.com

If you are looking for the best and most free Node.js hosting API for some fun projects, Glitchโ€™s free feature plan is a perfect application for you. It is the best for fun prototyping or apps. For some serious projects, you have to check out their Pro program which runs for over $8 monthly (paid on an annual basis).

Their free plan allows you to create the app anonymously, although you will have to log in through Facebook or GitHub if you want this project to be live (any anonymous applications will expire within 5 days).

Fastly acquired Glitch in 2022, and started offering their Pro plan as the best way to expand on limits. It was made by Stack Exchange, Stack Overflow, and Trello.

Features:

  • Limitless project uptime
  • Custom domains offered 
  • Additional disk space
  • Friendly UI 
  • Tutorials to get you running
  • Integrate with APIs & other tech

Cyclic

Cyclic

Cyclic offers full-stack Node.js services for free. This is the serverless wrapper made on top of AWS. As mentioned on their pricing page it has the self-claimed free tier to deploy one app and can easily be invoked ten thousand times in one month. It has some soft and hard limits stated on its limits page.

As mentioned on its pricing page it has a self-claimed free tier to deploy one app which can be invoked ten thousand times in one month. It has some soft and hard limits on its page.

Features:

  • 1GB runtime memory
  • 10,000 API requests
  • 1GB Object Storage 
  • 512MB storage
  • 3 Cron tasks

Google Cloud

Google Cloud

Now developers can experience low latency networks & host your apps for your Google products with Google Cloud. With the Google App Engine, developers can focus more on writing down code without worrying about managing its underlying infrastructure. Also, you will pay only for the resources you are going to use.

This service provides a vast choice of products or services that you can select from. It is simple to start with the App Engine guide. All customers and developers can take benefits of more than 25 free products on its monthly usage limits.

Besides, Google Cloud service is the best selection for webmasters looking to compare their features as well as select a good web hosting service for their websites. It offers the most intuitive user interface & scalability choices. Whatโ€™s more, the pricing is competitive and straightforward.

Features:

  • Friendly UI and scalability options
  • More than 25 free products 
  • Affordable, simple to use, and flexible
  • Range of products 
  • Simple to start with user manual

Amazon AWS

Amazon AWS

Amazon Web Services or AWS powers the whole internet. It might be a little exaggerating but would be incorrect to not talk about its popularity. The platform integrates many services that make them the top options as the Node.js free hosting app.

AWS is a cloud-based server that doesnโ€™t offer hosting with the physical server but uses the virtual server. The majority of users prefer cloud hosting since it wonโ€™t ask you to pay for any additional resources when buying. Instead, it just charges you for used-up space.

The company offers a free hosting plan that will give you a very good start. For its paid plans you need to pay for every hour for the service category that will be for one to three years period. Separate costing for storage, computing, migration, database, and transfer, networking and content delivery, media service, developer tools, analytics, and more are present.

To start with AWS hosting is very simple. All you have to do is just upload the code and allow AWS to provision & deploy everything for you. Thereโ€™s no cost of using its Elastic Beanstalk service and you are charged for services provided by AWS.

Features:

  • Pay only for used storage space 
  • Simple integration of plugins
  • Monitoring included
  • Load balancing and auto-scaling to scale an application
  • Free plans will expire after a year
  • You need to couple the paid services and free services to launch the fully functional website
  • AWS paid services are costly 
  • Good for web apps & SaSS platforms

Microsoft Azure

Microsoft Azure

Microsoft Azure is a robust cloud computing server that makes it simple to host & deploy Node.js apps. It provides an App Service that includes fully managed service for Node.js web hosting applications without any upfront commitment & cancel option.

Their service provides the most sophisticated vision, language, speech, and AI models, hence you will be able to create your machine-learning system. You can create applications that can detect & classify various concepts and objects

Many web developers find their service to be highly reliable and powerful, especially for cloud computing. It helps to create various web apps. With Azure you can find some amazing functions that you can start quickly, their AI models have advanced options. The platform offers free core services and you also get a credit of $200 as an incentive for trying out this platform.

Features:

  • Applications can detect and classify objects
  • Fully managed Node.js app hosting 
  • High-class vision, speech, language, and decision-making AI models
  • Cloud computing platform to create online apps 
  • Scale web apps 
  • Sophisticated AI models provide advanced options

Netlify

Netlify

Netlify is yet another popular platform to deploy web projects and apps. The platform provides a free hosting program that has an integrated system to deploy various projects and software from GitHub and GitLab. You just need the project URL to create features, and you are all set to start.

Netlify has a friendly user interface with free SSL, it gives you fast CDN access. Besides, Netlify has Serverless support, so you can use their Functions Playground and create the Serverless features and deploy The Gatsby with WordPress API immediately.

Netlify maintains a very active project GitHub page. Till now, they have published over 240 packages for open-source collaboration. Their web hosting function is created by the developers for developers.

Features:

  • Create history so you may roll back when any issue presents itself.
  • Deploy project is done automatically with Git. private or personal repos.
  • Access to Edge network – distributed CDN globally.
  • Host a wide range of websites.
  • 100GB bandwidth and 6 hours of build time.

Qovery

Qovery

If you do not have any prior experience in managing cloud infrastructure, Qovery is the best choice for you. This platform was made from scratch to help startups improve their operations. At present, Qover is accessible for DigitalOcean, AWS, and Scaleway users.

To make it clear and use Qovery solutions, you will require an account on those cloud solutions. With AWS free plans and a combination of Qovery – it will create a most powerful combo for use. At least for the small-scale projects, that you are not yet ready to commit to complete.

If that is not a big trouble, you may take complete benefit of Qovery’s core functions. Build from Git, and deploy in different stages, and utilize Kubernetes to scale while demand exceeds.

Features:

  • Over 1 cluster
  • Unlimited Developers
  • One-click Preview Environment
  • Over 5 Environments

Conclusion 

So here you have the complete list of different platforms where you may host the Node.js projects. All the hosts in this guide provide excellent web services & generous free tiers. Besides, they will help you to build a strong website. Finally, it comes down to what type of experience that you want. We hope this blog post on the best free Nodejs hosting platform has helped you find the right hosting service!

The post 9 Best Free Node.js Hosting 2025 appeared first on The Crazy Programmer.

by: Zainab Sutarwala
Tue, 07 Jan 2025 11:33:00 +0000


LambdaTest has today emerged as a popular name especially in the field of cross-browser testing, helping businesses and developers to ensure the functionality and compatibility of their web applications over a wide variety of devices and browsers.

With the quick evolution of web technologies and the diverse landscape of devices and browsers, cross-browsing testing today has become an indispensable feature of web development.

LambdaTest mainly addresses this challenge by offering a strong and user-friendly platform that enables developers to test their web applications and websites on real browsers and operating systems, allowing them to deliver a smooth user experience to their audience.

What is LambdaTest?

LambdaTest Review

The dynamic digital age necessitates high-performance and innovative web tools. In this massive world of website testing and software development, LambdaTest holds a desirable reputation as a cloud-based, cross-browser testing software.

LambdaTest is one of the most intuitive platforms developed to make web testing simple and trouble-free. It allows you to smoothly test your web application and website compatibility over more than 3000 different web browser environments, offering comprehensive and detailed testing at your fingertips.

No matter whether it is about debugging problems or tracking the layout, this application covers everything with grace. The software makes it very simple to make your websites responsive, future-proof, and adaptive over a wide range of devices and operating systems.

Features of LambdaTest

Given the list of some amazing features that LambdaTest offers, letโ€™s check them out:

  1. Live Interactive Testing: The live browser testing of LambdaTest allows users to interactively test websites in real-time in various browsers, resolutions, operating systems, and versions.
  2. Automated Screenshot Testing: This particular feature helps the users to carry out screenshot testing on a wide range of desktop and mobile browsers concurrently, thus reducing the testing time.
  3. Responsive Testing: Check how your website pages look on different devices including tablets, desktops, and mobile and screen resolutions to ensure proper compatibility over the board.
  4. Smart Testing Feature: Another amazing feature of LambdaTest is it allows users to locally or privately test hosted pages. Additionally, it offers the newest versions of different developer tools like Chrome DevTools for nuanced testing and bug detection.
  5. Integration: The software allows integration with popular project management and communication tools such as Jira, Trello, Slack, Bitbucket, etc.

Pricing of LambdaTest

The costing structure of LambdaTest is designed keeping in mind their range of customers.

  1. Lite Plan: It begins with the โ€˜Liteโ€™ package which is totally free but has limited capabilities. It is perfect for individual developers and small startups just starting their testing journey.
  2. Live Plan: The โ€˜Liveโ€™ package starts at $15 monthly when billed yearly. The โ€˜Mobile $ Web Browser Automationโ€™ package begins from $79 monthly and is made for automated browser testing requirements.
  3. All-In-One Plan: If you are looking for full functionality and accessibility, thereโ€™s an All-In-One package priced at $99 monthly. It enables unlimited real-testing, responsive testing, screenshot testing, and more.

All these three plans come with a 14-day free trial so that the potential users will experience firsthand what LambdaTest will do for them before they commit to any particular plan.

Key Benefits of Using LambdaTest

The cornerstone of LambdaTestโ€™s value proposition lies in its exclusive set of benefits and these include:

  • Rapid Testing: It supports parallel testing that considerably reduces the execution time of the test.
  • Wide-Ranging Browser Support: It covers the widest range of mobile and desktop browsers.
  • Local Testing: This function makes sure safe testing of your locally hosted pages before deploying live.
  • Smart Visual UI Testing: Now users can automatically company and identify visual deviations that offer pixel-perfect layouts.
  • Debugging Tools: This testing platform comes fully loaded with pre-installed developer tools that will make bug detection a breeze.
  • Scalable Cloud Grid: Offers you a scalable selenium grid for much faster automation tests and parallel execution of the test.

How Will LambdaTest Help You Test Multiple Browsers?

Being the cloud-based testing platform, LambdaTest allows you to eliminate the need for virtual machine or device labs. You just have to select the platform and browser and start your testing process.

From the latest Chrome version to the oldest Internet Explorer version, LambdaTest keeps it well-covered. This ability to stimulate and emulate a broad range of devices, web browsers, and screen resolutions allows you to test over a wide range of browser environments without any need for massive hardware investments.

Pros and Consย of LambdaTest

Just like any other tool, LambdaTest isnโ€™t without its benefits and drawbacks

Pros:

  • Broad Spectrum Compatibility โ€“ Allows you to test on a wide range of browsers and OS combinations.
  • Collaborative Tool: LambdaTest geographically supports dispersed teams in tracking, sharing, and managing bugs from one place.
  • Constant Support: Provides robust and 24/7 support for troubleshooting or queries.

Cons:

  • Features appear overwhelming: It may be overwhelming for beginners because of the wealth of features accessible.
  • Sluggish: Some users have reported experiencing slowness during peak hours.
  • Requires Frequent Updating: The latest browser versions sometimes arenโ€™t available instantly on this platform.

Conclusion

In the world of digital presence, ensuring your web apps and websites perform perfectly on each browser and platform is very important. With a lot of amazing features and compatibility, LamdaTest appears to be a powerful tool that is perfect for meeting the demanding cross-browser testing requirements of today.

ย LambdaTest is the browser compatibility tool that punches over its weight, delivering strong performance just to ensure your websiteโ€™s smooth and optimum operation over a wide range of browser environments.

The post LambdaTest Review 2025 – Features, Pricing, Pros & Cons appeared first on The Crazy Programmer.

by: Chris Coyier
Mon, 06 Jan 2025 20:47:37 +0000


Like Miriam Suzanne says:

Youโ€™re allowed to have preferences. Set your preferences.

I like the idea of controlling my own experience when browsing and using the web. Bump up that default font size, you’re worth it.

Here’s another version of control. If you publish a truncated RSS feed on your site, but the site itself has more content, I reserve the right to go fetch that content and read it through a custom RSS feed. I feel like that’s essentially the same thing as if I had an elaborate user stylesheet that I applied just to that website that made it look how I wanted it to look. It would be weird to be anti user-stylesheet.

I probably don’t take enough control over my own experience on sites, really. Sometimes it’s just a time constraint where I don’t have the spoons to do a bunch of customization. But the spoon math changes when it has to do with doing my job better.

I was thinking about this when someone poked me that an article I published had a wrong link in it. As I was writing it in WordPress, somehow I linked the link to some internal admin screen URL instead of where I was trying to link to. Worse, I bet I’ve made that same mistake 10 times this year. I don’t know what the heck the problem is (some kinda fat finger issue, probably) but the same problem is happening too much.

What can help? User stylesheets can help! I love it when CSS helps me do my job in weird subtle ways better. I’ve applied this CSS now:

.editor-visual-editor a[href*="/wp-admin/"]::after {
  content: " DERP!";
  color: red;
}

That first class is just something to scope down the editor area in WordPress, then I select any links that have “wp-admin” in them, which I almost certainly do not want to be linking to, and show a visual warning. It’s a little silly, but it will literally work to stop this mistake I keep making.

I find it surprising that only Safari has entirely native support for a linking up your own user CSS, but there are ways to do it via extension or other features in all browsers.


Welp now that we’re talking about CSS I can’t help but share some of my favorite links in that area now.

Dave put his finger on an idea I’m wildly jealous of: CSS wants to be a system. Yes! It so does! CSS wants to be a system! Alone, it’s just selectors, key/value pairs, and a smattering of other features. It doesn’t tell you how to do it, it is lumber and hardware saying build me into a tower! And also: do it your way! And the people do. Some people’s personality is: I have made this system, follow me, disciples, and embrace me. Other people’s personality is: I have also made a system, it is mine, my own, my prec… please step back behind the rope.

Annnnnnd more.

  • CSS Surprise Manga Lines from Alvaro are fun and weird and clever.
  • Whirl: “CSS loading animations with minimal effort!” Jhey’s got 108 of them open sourced so far (like, 5 years ago, but I’m just seeing it.)
  • Next-level frosted glass withย backdrop-filter. Josh covers ideas (with credit all the way back to Jamie Gray) related to the “blur the stuff behind it” look. Yes, backdrop-filter does the heavy lifting, but there are SO MANY DETAILS to juice it up.
  • Custom Top and Bottom CSS Container Masks from Andrew is a nice technique. I like the idea of a “safe” way to build non-rectangular containers where the content you put inside is actually placed safely.

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.