x

Muhurat trading: Sensex, Nifty advance to start Samvat 2081 on a high

Muhurat trading is a one-hour, symbolic trading session conducted by stock exchanges on the occasion of Diwali, marking the start of the new Samvat year.




x

Sensex, Nifty plunge in early trade dragged by Reliance Industries

Relentless selling by foreign investors also dampened the sentiments in the equity market




x

Sensex tanks 942 points; Nifty plunges below 24K on heavy selling in Reliance, banking shares

The 30-share BSE Sensex tumbled 941.88 points or 1.18% to settle at 78,782.24, the lowest closing level since August 6




x

Stock markets rebound on value buying in banking, steel shares; Sensex jumps 694 points

Bouncing back from Monday's (November 4) sharp fall, the BSE Sensex jumped 694.39 points or 0.88% to settle at 79,476.63




x

Sensex, Nifty climb in early trade on buying in IT stocks

Equity indices rise on IT stocks, U.S. market rally as Sensex up 338.1 points and Nifty up 101.5 points




x

Sensex, Nifty surge over 1% on heavy buying in IT stocks as Donald Trump wins U.S. polls

Stock markets surge over 1% as Sensex gains 901 points on Trump’s U.S. election win, boosting IT and pharma shares




x

Sensex, Nifty fall over 1 %, snap two-day rally ahead of U.S. Fed interest rate decision

Stock markets tumble over 1% as investors await U.S. Fed decision, with Sensex and Nifty dropping significantly




x

Tamil Nadu airport infrastructure: Excitement in the air — preparing the ground for take off

Air travel in Tamil Nadu could see a boom over the next few years as significant infrastructure development is in the offing at airports in tier 2 cities across the State. With the State government keen on ensuring distributed growth, strengthening the aviation infrastructure could be a stimulus to the regional economic development as enhanced air connectivity is expected to help attract investment, trade, and tourism




x

Powerloom weavers urge Tamil Nadu CM to take up the issue of QCOs on textiles with the Central government




x

Panchayat, aided schools in Tiruchi district bag awards for excellence in teaching, better enrolment

The schools are assessed based on including basic infrastructure, quality of education and teaching practices, technology-enabled teaching, development of the school, and activities done by students




x

T.N. stretch of Bengaluru-Chennai Expressway may be completed by August 2025

While the 24.50-km package from Walajapet to Arakkonam has the most progress, with over 84% of the work being carried out, the Arakkonam to Kancheepuram package has the least progress with about 52%




x

How free bus ride shapes women’s experience of public spaces

In Chennai, Bangalore, and Delhi that offer access to free transport, there is a visible change in the public space. The pink slip is not a cure-all for the deep-rooted patriarchy, but they are important steps towards reshaping urban spaces into more inclusive environments




x

U.S.-based Shearwater Health expands to Chennai

This expansion will create 1,000 jobs for local clinicians by the end of 2025, who will deliver remote clinical services to Shearwater’s U.S. healthcare clients




x

Absence of bund around deepened pond worries residents of Morais Garden Extension in Tiruchi

The pond at Runway Nagar, Kottapattu, which was deepened a few months ago, is now filled with water after recent rain. Residents are worried that it may overflow and the stagnant water might become a haven for snakes and insects.




x

Chain stretching in brushes favors sequence recognition for nucleobase-functionalized flexible precise oligomers

Soft Matter, 2024, 20,8303-8311
DOI: 10.1039/D4SM00866A, Paper
Kseniia Grafskaia, Qian Qin, Jie Li, Delphine Magnin, David Dellemme, Mathieu Surin, Karine Glinel, Alain M. Jonas
Flexible oligomers having precise sequences of nucleobases do not specifically recognize surface-grafted target chains at low grafting density. Moderately higher grafting densities promote sequence-specific recognition thanks to chain stretching.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Co-encapsulation of organic polymers and inorganic superparamagnetic iron oxide colloidal crystals requires matched diffusion time scales

Soft Matter, 2024, 20,8312-8325
DOI: 10.1039/D4SM00935E, Paper
Open Access
Brian K. Wilson, Robert K. Prud’homme
Composite nanoparticles co-encapsulate organic materials with inorganic primary colloids. Producing “stoichiometric NPs”, where all NPs contain organic and inorganic species at similar ratios, requires matched diffusion-aggregation time scale.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Stress amplification and relaxation imaging around cracks in nanocomposite gels using ultrasound elastography

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM00909F, Paper
H. Le Blay, T. Deffieux, L. Laiarinandrasana, M. Tanter, A. Marcellan
Stress visualization around cracks in NC gels was performed using ultrasonic elastography. Temporal and spatial mapping are performed non-invasively. Over time, the stress gradient is erased by large-scale reorganization of the polymer network.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Carboxymethyl cellulose-stabilized calcium phosphate particles for injectable hydrogel-based bone tissue engineering

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM00670D, Paper
Piyaporn Srisura, Yuwaporn Pinyakit, Umphan Ngoensawat, Pongsakorn Yuntasiri, Khoiria Nur Atika Putri, Theerapat Chanamuangkon, Waranyoo Phoolcharoen, Varol Intasanta, Voravee P. Hoven
Carboxymethyl cellulose-stabilized calcium phosphate particles well-dispersed in aqueous solution can be integrated into an injectable hydrogel made of methacrylated hyaluronic acid which is a promising material for bone regeneration applications.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Development of a coarse-grained molecular dynamics model for poly(dimethyl-co-diphenyl)siloxane

Soft Matter, 2024, 20,8480-8492
DOI: 10.1039/D4SM00875H, Paper
Weikang Xian, Amitesh Maiti, Andrew P. Saab, Ying Li
Polydimethylsiloxane and its copolymer systems have a wide range of application. We systematically develop a coarse-grained MD model for PDMS-co-PDPS system. The model preserves the structural and dynamic properties of the material quantitatively.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Effective patchiness from critical points of a coarse-grained protein model with explicit shape and charge anisotropy

Soft Matter, 2024, 20,8455-8467
DOI: 10.1039/D4SM00867G, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Jens Weimar, Frank Hirschmann, Martin Oettel
Critical points of an anisotropic, coarse-grained protein model are used to detemine an “effective patchiness” by comparison to the Kern–Frenkel patchy model.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Segregative phase separation of strong polyelectrolyte complexes at high salt and high polymer concentrations

Soft Matter, 2024, 20,8505-8514
DOI: 10.1039/D4SM00994K, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Conner H. Chee, Rotem Benharush, Lexi R. Knight, Jennifer E. Laaser
Complexes of strong polyelectrolytes prepared well above the binodal are shown to undergo hydrophobicity-driven segregative phase separation.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Coupled dynamics in binary mixtures of model colloidal Yukawa systems

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM01123F, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Daniel Weidig, Joachim Wagner
Self- and collective dynamics in mixtures of highly charged binary colloidal particles is analyzed by Brownian dynamics simulations. For equally charged, but differently sized particles coupling effects in their long-time dynamics are observed.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Aging iridium oxide catalyst inks: a formulation strategy to enhance ink processability for polymer electrolyte membrane water electrolyzers

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM00987H, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Sunilkumar Khandavalli, Jae Hyung Park, Robin Rice, Diana Y. Zhang, Sarah A. Berlinger, Guido Bender, Deborah J. Myers, Michael Ulsh, Scott A. Mauger
Steady-shear rheology showing evolution of the microstructure of iridium oxide catalyst inks of PEM water electrolyzers with aging time.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Enhanced chemotaxis efficiency of Escherichia coli in viscoelastic solutions

Soft Matter, 2024, 20,8675-8683
DOI: 10.1039/D4SM01094A, Paper
Shaoying Zhu, Rui He, Caijuan Yue, Rongjing Zhang, Junhua Yuan
E. coli shows enhanced chemotaxis in viscoelastic media, with faster migration and higher accumulation in attractant-rich areas compared to Newtonian conditions.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Extended kinetic theory applied to pressure-controlled shear flows of frictionless spheres between rigid, bumpy planes

Soft Matter, 2024, 20,8702-8715
DOI: 10.1039/D4SM00831F, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Dalila Vescovi, Astrid S. de Wijn, Graham L. W. Cross, Diego Berzi
We perform discrete simulations of steady, pressure-imposed, heterogeneous flows of frictionless spheres sheared between parallel bumpy planes, and use the results to test the predictions of the extended kinetic theory of granular gases.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Structure affinity of the Langmuir monolayer and the corresponding Langmuir–Blodgett film revealed by X-ray techniques

Soft Matter, 2024, 20,8601-8609
DOI: 10.1039/D4SM01050G, Paper
Alvina V. Alexandrova, Maxim A. Shcherbina, Yuriy L. Repchenko, Yuriy M. Selivantiev, Alexander V. Shokurov, Vladimir V. Arslanov, Sofiya L. Selektor
Using X-ray techniques, crown-substituted chromoionophore Langmuir–Blodgett films were proved to preserve the fine structure and functional features of pre-organized monolayers.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Influence of counterion type on the scattering of a semiflexible polyelectrolyte

Soft Matter, 2024, 20,8610-8620
DOI: 10.1039/D4SM00874J, Paper
Open Access
Anish Gulati, Jack F. Douglas, Olga Matsarskaia, Carlos G. Lopez
Understanding the influence of counterion and backbone solvation on the conformational and thermodynamic properties of polyelectrolytes in solution is one of the main open challenges in polyelectrolyte science.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Interfacial viscoelasticity in oscillating drops of cyclodextrin-surfactant aqueous solution: experiments and theory

Soft Matter, 2024, Accepted Manuscript
DOI: 10.1039/D4SM01007H, Paper
José Roberto Romero-Arias, Alberto S. Luviano, Miguel Costas, Aurora Hernandez-Machado, Rafael A Barrio
We present experiments involving oscillating droplets in aqueous cyclodextrin-surfactant solutions. In these experiments, α-cyclodextrin (αCD) and anionic surfactants exhibit remarkable viscoelasticity at the liquid/air interface, with dilatational modulus varying across...
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Fibrotaxis: gradient-free, spontaneous and controllable droplet motion on soft solids

Soft Matter, 2024, Accepted Manuscript
DOI: 10.1039/D4SM01022A, Paper
Open Access
Sthavishtha Bhopalam, Jesus Bueno, Hector Gomez
Most passive droplet transport strategies rely on spatial variations of material properties to drive droplet motion, leading to gradient-based mechanisms with intrinsic length scales that limit the droplet velocity or...
The content of this RSS Feed (c) The Royal Society of Chemistry




x

A dynamical system approach to relaxation in glass-forming liquids

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM00976B, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Jack F. Douglas, Qi-Lu Yuan, Jiarui Zhang, Hao Zhang, Wen-Sheng Xu
We adapt a dynamical system approach to the practical matter of estimating relaxation times in both cooled liquids and crystals at elevated temperatures, which we identify as weakly non-integrable dynamical systems.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

A multi-scale framework for predicting α-cyclodextrin assembly on polyethylene glycol axles

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM01048E, Paper
Open Access
Cameron D. Smith, Chenfeng Ke, Wenlin Zhang
We predict the assembly and time-dependent distribution of cyclodextrin along PEG axles by combining atomistic molecular dynamics with an analytical treatment of bulk diffusion. Our kinetic Monte Carlo can aid in the design of polypseudorotaxanes.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Percolation transitions in a binary mixture of active Brownian particles with different softness

Soft Matter, 2024, Advance Article
DOI: 10.1039/D4SM00981A, Paper
Monika Sanoria, Raghunath Chelakkot, Amitabha Nandi
Homogeneous active Brownian particle (ABP) systems with purely repulsive interactions are considered to exhibit a simple phase behavior, but various physical attributes of active entities can lead to variation in the collective dynamics.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




x

Magnetic colloidal single particles and dumbbells on a tilted washboard moir'e pattern in a precessing external field

Soft Matter, 2024, Accepted Manuscript
DOI: 10.1039/D4SM01183J, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Farzaneh Farrokhzad, Nico C. X. Stuhlmüller, Piotr Kuswik, Maciej Urbaniak, Feliks Stobiecki, Sapida Akhundzada, Arno Ehresmann, Daniel de las Heras, Thomas M. Fischer
We measure the dynamical behavior of colloidal singlets and dumbbells on an inclined magnetic moir'e pattern, subject to a precessing external homogeneous magnetic field. At low external field strength single...
The content of this RSS Feed (c) The Royal Society of Chemistry




x

These Pix Will Cheer You Up!!!

Check out the shortlisted photographs in this year's Comedy Pet Photo Awards.




x

How to Create a CSS Text Embossing Effect

Embossing is a graphical effect used to give the impression that the surface of an image has been raised or pressed in. In web design, an embossed text effect can give your typography a three-dimensional look and feel, often lending …




x

How to Animate Gradient Text Using CSS

Web design takes a captivating turn when CSS comes into play. It enables a world of transformations, such as taking static text elements and infusing them with life. Our focus today is one such engaging transformation – animate gradient text …




x

Making an Underwater CSS Text Effect

Web design can serve as a playful exploration ground for learning new techniques. In today’s guide, we’ll dive into the creation of an underwater CSS text effect, not just for the visual outcome, but to deepen our understanding of how …




x

Retro CSS Text Effect: A Step-by-Step Tutorial

CSS offers an array of tools that, when used correctly, can improve the visual experience on your website. In this tutorial, we’ll explore a straightforward way to design a retro text effect with pure CSS. The approach, while not overly …




x

Beautiful Scrolling Experiences – Without Libraries

Michelle Barker appears as one of a heavenly host, coming forth with scroll in hand to pronounce an end to janky scrolljacking! Unto us a new specification is born, in the city of TimBL, and its name shall be called Scroll Snap.


Sponsor: Order any Standard paperback(s) and get a surprise gift card in the box for YOU. While supplies last, from your pals at A Book Apart!


One area where the web has traditionally lagged behind native platforms is the perceived “slickness” of the app experience. In part, this perception comes from the way the UI responds to user interactions – including the act of scrolling through content.

Faced with the limitations of the web platform, developers frequently reach for JavaScript libraries and frameworks to alter the experience of scrolling a web page – sometimes called “scroll-jacking” – not always a good thing if implemented without due consideration of the user experience. More libraries can also lead to page bloat, and drag down a site’s performance. But with the relatively new CSS Scroll Snap specification, we have the ability to control the scrolling behaviour of a web page (to a degree) using web standards – without resorting to heavy libraries. Let’s take a look at how.

Scroll Snap

A user can control the scroll position of a web page in a number of ways, such as using a mouse, touch gesture or arrow keys. In contrast to a linear scrolling experience, where the rate of scroll reflects the rate of the controller, the Scroll Snap specification enables a web page to snap to specific points as the user scrolls. For this, we need a fixed-height element to act as the scroll container, and the direct children of that element will determine the snap points. To demonstrate this, here is some example HTML, which consists of a <div> containing four <section> elements:

<div class="scroll-container">
  <section>
    <h2>Section 1</h2>
  </section>
  <section>
    <h2>Section 2</h2>
  </section>
  <section>
    <h2>Section 3</h2>
  </section>
  <section>
    <h2>Section 4</h2>
  </section>
</div>

Scroll snapping requires the presence of two main CSS properties: scroll-snap-type and scroll-snap-align. scroll-snap-type applies to the scroll container element, and takes two keyword values. It tells the browser:

  • The direction to snap
  • Whether snapping is mandatory

scroll-snap-align is applied to the child elements – in this case our <section>s.

We also need to set a fixed height on the scroll container, and set the relevant overflow property to scroll.

.scroll-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}

section {
  height: 100vh;
  scroll-snap-align: center;
}

In the above example, I’m setting the direction in the scroll-snap-type property to y to specify vertical snapping. The second value specifies that snapping is mandatory. This means that when the user stops scrolling their scroll position will always snap to the nearest snap point. The alternative value is proximity, which determines that the user’s scroll position will be snapped only if they stop scrolling in the proximity of a snap point. (It’s down to the browser to determine what it considers to be the proximity threshold.)

If you have content of indeterminate length, which might feasibly be larger than the height of the scroll container (in this case 100vh), then using a value of mandatory can cause some content to be hidden above or below the visible area, so is not recommended. But if you know that your content will always fit within the viewport, then mandatory can produce a more consistent user experience.

See the Pen Simple scroll-snap example by Michelle Barker (@michellebarker) on CodePen.

In this example I’m setting both the scroll container and each of the sections to a height of 100vh, which affects the scroll experience of the entire web page. But scroll snapping can also be implemented on smaller components too. Setting scroll snapping on the x-axis (or inline axis) can produce something like a carousel effect.

In this demo, you can scroll horizontally scroll through the sections:

See the Pen Carousel-style scroll-snap example by Michelle Barker (@michellebarker) on CodePen.

The Intersection Observer API

By implementing the CSS above, our web page already has a more native-like feel to it. To improve upon this further we could add some scroll-based transitions and animations. We’ll need to employ a bit of Javascript for this, using the Intersection Observer API. This allows us to create an observer that watches for elements intersecting with the viewport, triggering a callback function when this occurs. It is more efficient than libraries that rely on continuously listening for scroll events.

We can create an observer that watches for each of our scroll sections coming in and out of view:

const sections = [...document.querySelectorAll('section')]

const options = {
  rootMargin: '0px',
  threshold: 0.25
}

const callback = (entries) => {
  entries.forEach((entry) => {
    if (entry.intersectionRatio >= 0.25) {
      target.classList.add("is-visible");
    } else {
      target.classList.remove("is-visible");
    }
  })
}

const observer = new IntersectionObserver(callback, options)

sections.forEach((section, index) => {
  observer.observe(section)
})

In this example, a callback function is triggered whenever one of our sections intersects the container by 25% (using the threshold option). The callback adds a class of is-visible to the section if it is at least 25% in view when the intersection occurs (which will take effect when the element is coming into view), and removes it otherwise (when the element is moving out of view). Then we can add some CSS to transition in the content for each of those sections:

section .content {
  opacity: 0:
}

section.is-visible .content {
  opacity: 1;
  transition: opacity 1000ms:
}

This demo shows it in action:

See the Pen Scrolling with Intersection Observer by Michelle Barker (@michellebarker) on CodePen.

You could, of course, implement some much more fancy transition and animation effects in CSS or JS!

As an aside, it’s worth pointing out that, in practice, we shouldn’t be setting opacity: 0 as the default without considering the experience if JavaScript fails to load. In this case, the user would see no content at all! There are different ways to handle this: We could add a .no-js class to the body (which we remove on load with JS), and set default styles on it, or we could set the initial style (before transition) with JS instead of CSS.

Position: sticky

There’s one more CSS property that I think has the potential to aid the scroll experience, and that’s the position property. Unlike position: fixed, which locks the position of an element relative to the nearest relative ancestor and doesn’t change, position: sticky is more like a temporary lock. An element with a position value of sticky will become fixed only until it reaches the threshold of its parent, at which point it resumes relative positioning.

By “sticking” some elements within scroll sections we can give the impression of them being tied to the action of scrolling between sections. It’s pretty cool that we can instruct an element to respond to it’s position within a container with CSS alone!

Browser support and fallbacks

The scroll-snap-type and scroll-snap-align properties are fairly well-supported. The former requires a prefix for Edge and IE, and older versions of Safari do not support axis values. In newer versions of Safari it works quite well. Intersection Observer similarly has a good level of support, with the exception of IE.

By wrapping our scroll-related code in a feature query we can provide a regular scrolling experience as a fallback for users of older browsers, where accessing the content is most important. Browsers that do not support scroll-snap-type with an axis value would simply scroll as normal.

@supports (scroll-snap-type: y mandatory) {
  .scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
  }

  section {
    height: 100vh;
    scroll-snap-align: center;
  }
}

The above code would exclude MS Edge and IE, as they don’t support axis values. If you wanted to support them you could do so using a vendor prefix, and using @supports (scroll-snap-type: mandatory) instead.

Putting it all together

This demo combines all three of the effects discussed in this article.

Summary

Spending time on scroll-based styling might seem silly or frivolous to some. But I believe it’s an important part of positioning the web as a viable alternative to native applications, keeping it open and accessible. While these new CSS features don’t offer all of the control we might expect with a fully featured JS library, they have a major advantage: simplicity and reliability. By utilising web standards where possible, we can have the best of both worlds: Slick and eye-catching sites that satisfy clients’ expectations, with the added benefit of better performance for users.


About the author

Michelle is a Lead Front End Developer at Bristol web agency Atomic Smash, author of front-end blog CSS { In Real Life }, and a Mozilla Tech Speaker. She has written articles for CSS Tricks, Smashing Magazine, and Web Designer Magazine, to name a few. She enjoys experimenting with new CSS features and helping others learn about them.

More articles by Michelle




x

It All Starts with a Humble <textarea>

Andy Bell rings out a fresh call in support of the timeless concept of progressive enhancement. What does it mean to build a modern JavaScript-focussed web experience that still works well if part of the stack isn’t supported or fails? Andy shows us how that might be done.


Those that know me well know that I make a lot of side projects. I most definitely make too many, but there’s one really useful thing about making lots of side projects: it allows me to experiment in a low-risk setting.

Side projects also allow me to accidentally create a context where I can demonstrate a really affective, long-running methodology for building on the web: progressive enhancement. That context is a little Progressive Web App that I’m tinkering with called Jotter. It’s incredibly simple, but under the hood, there’s a really solid experience built on top of a minimum viable experience which after reading this article, you’ll hopefully apply this methodology to your own work.

What is a minimum viable experience?

The key to progressive enhancement is distilling the user experience to its lowest possible technical solution and then building on it to improve the user experience. In the context of Jotter, that is a humble <textarea> element. That humble <textarea> is our minimum viable experience.

Let me show you how it’s built up, progressively real quick. If you disable CSS and JavaScript, you get this:

This result is great because I know that regardless of what happens, the user can do what they needed to do when the loaded Jotter in their browser: take some notes. That’s our minimum viable experience, completed with a few lines of code that work in every single browser—even very old browsers. Don’t you just love good ol’ HTML?

Now it’s time to enhance that minimum viable experience, progressively. It’s a good idea to do that in smaller steps rather than just provide a 0% experience or a 100% experience, which is the approach that’s often favoured by JavaScript framework enthusiasts. I think that process is counter-intuitive to the web, though, so building up from a minimum viable experience is the optimal way to go, in my opinion.

Understanding how a minimum viable experience works can be a bit tough, admittedly, so I like to use a the following diagram to explain the process:

Let me break down this diagram for both folks who can and can’t see it. On the top row, there’s four stages of a broken-up car, starting with just a wheel, all the way up to a fully functioning car. The car enhances only in a way that it is still mostly useless until it gets to its final form when the person is finally happy.

On the second row, instead of building a car, we start with a skateboard which immediately does the job of getting the person from point A to point B. This enhances to a Micro Scooter and then to a Push Bike. Its final form is a fancy looking Motor Scooter. I choose that instead of a car deliberately because generally, when you progressively enhance a project, it turns out to be way simpler and lighter than a project that was built without progressive enhancement in mind.

Now that we know what a minimum viable experience is and how it works, let’s apply this methodology to Jotter!

Add some CSS

The first enhancement is CSS. Jotter has a very simple design, which is mostly a full height <textarea> with a little sidebar. A flexbox-based, auto-stacking layout, inspired by a layout called The Sidebar is used and we’re good to go.

Based on the diagram from earlier, we can comfortably say we’re in Skateboard territory now.

Add some JavaScript

We’ve got styles now, so let’s enhance the experience again. A user can currently load up the site and take notes. If the CSS loads, it’ll be a more pleasant experience, but if they refresh their browser, they’re going to lose all of their work.

We can fix that by adding some local storage into the mix.

The functionality flow is pretty straightforward. As a user inputs content, the JavaScript listens to an input event and pushes the content of the <textarea> into localStorage. If we then set that localStorage data to populate the <textarea> on load, that user’s experience is suddenly enhanced because they can’t lose their work by accidentally refreshing.

The JavaScript is incredibly light, too:

const textArea = document.querySelector('textarea');
const storageKey = 'text';

const init = () => {

  textArea.value = localStorage.getItem(storageKey);

  textArea.addEventListener('input', () => {
    localStorage.setItem(storageKey, textArea.value);
  });
}

init();

In around 13 lines of code (which you can see a working demo here), we’ve been able to enhance the user’s experience considerably, and if we think back to our diagram from earlier, we are very much in Micro Scooter territory now.

Making it a PWA

We’re in really good shape now, so let’s turn Jotter into a Motor Scooter and make this thing work offline as an installable Progressive Web App (PWA).

Making a PWA is really achievable and Google have even produced a handy checklist to help you get going. You can also get guidance from a Lighthouse audit.

For this little app, all we need is a manifest and a Service Worker to cache assets and serve them offline for us if needed.

The Service Worker is actually pretty slim, so here it is in its entirety:

const VERSION = '0.1.3';
const CACHE_KEYS = {
  MAIN: `main-${VERSION}`
};

// URLS that we want to be cached when the worker is installed
const PRE_CACHE_URLS = ['/', '/css/global.css', '/js/app.js', '/js/components/content.js'];

/**
 * Takes an array of strings and puts them in a named cache store
 *
 * @param {String} cacheName
 * @param {Array} items=[]
 */
const addItemsToCache = function(cacheName, items = []) {
  caches.open(cacheName).then(cache => cache.addAll(items));
};

self.addEventListener('install', evt => {
  self.skipWaiting();

  addItemsToCache(CACHE_KEYS.MAIN, PRE_CACHE_URLS);
});

self.addEventListener('activate', evt => {
  // Look for any old caches that don't match our set and clear them out
  evt.waitUntil(
    caches
      .keys()
      .then(cacheNames => {
        return cacheNames.filter(item => !Object.values(CACHE_KEYS).includes(item));
      })
      .then(itemsToDelete => {
        return Promise.all(
          itemsToDelete.map(item => {
            return caches.delete(item);
          })
        );
      })
      .then(() => self.clients.claim())
  );
});

self.addEventListener('fetch', evt => {
  evt.respondWith(
    caches.match(evt.request).then(cachedResponse => {
      // Item found in cache so return
      if (cachedResponse) {
        return cachedResponse;
      }

      // Nothing found so load up the request from the network
      return caches.open(CACHE_KEYS.MAIN).then(cache => {
        return fetch(evt.request)
          .then(response => {
            // Put the new response in cache and return it
            return cache.put(evt.request, response.clone()).then(() => {
              return response;
            });
          })
          .catch(ex => {
            return;
          });
      });
    })
  );
});

What the Service Worker does here is pre-cache our core assets that we define in PRE_CACHE_URLS. Then, for each fetch event which is called per request, it’ll try to fulfil the request from cache first. If it can’t do that, it’ll load the remote request for us. With this setup, we achieve two things:

  1. We get offline support because we stick our critical assets in cache immediately so they will be accessible offline
  2. Once those critical assets and any other requested assets are cached, the app will run faster by default

Importantly now, because we have a manifest, some shortcut icons and a Service Worker that gives us offline support, we have a fully installable PWA!

Wrapping up

I hope with this simplified example you can see how approaching web design and development with a progressive enhancement approach, everyone gets an acceptable experience instead of those who are lucky enough to get every aspect of the page at the right time.

Jotter is very much live and in the process of being enhanced further, which you can see on its little in-app roadmap, so go ahead and play around with it.

Before you know it, it’ll be a car itself, but remember: it’ll always start as a humble little <textarea>.


About the author

Andy Bell is an independent designer and front-end developer who’s trying to make everyone’s experience on the web better with a focus on progressive enhancement and accessibility.

More articles by Andy




x

Flexible Captioned Slanted Images

Eric Meyer gift wraps the most awkwardly shaped of boxes using nothing but CSS, HTML and a little curl of ribbon. No matter how well you plan and how much paper you have at your disposal, sometimes you just need to slant the gift to the side.


We have a lot of new layout tools at our disposal these days—flexbox is finally stable and interoperable, and Grid very much the same, with both technologies having well over 90% support coverage. In that light, we might think there’s no place for old tricks like negative margins, but I recently discovered otherwise.

Over at An Event Apart, we’ve been updating some of our landing pages, and our designer thought it would be interesting to have slanted images of speakers at the tops of pages. The end result looks like this.

The interesting part is the images. I wanted to set up a structure like the following, so that it will be easy to change speakers from time to time while preserving accessible content structures:

<div id="page-top">
  <ul class="monoliths">
    <li>
      <a href="https://aneventapart.com/speakers/rachel-andrew"> 
        <img src="/img/rachel-andrew.jpg" alt=""> 
        <div> 
          <strong>Rachel Andrew</strong> CSS Grid 
        </div> 
      </a>
    </li>
    <li>
      <a href="https://aneventapart.com/speakers/derek-featherstone"> 
        <img src="/img/derek-featherstone.jpg" alt=""> 
        <div> 
          <strong>Derek Featherstone</strong> Accessibility 
        </div> 
      </a>
    </li>
    <li>
      …
    </li>
    <li>
      …
    </li>
  </ul>
</div>

The id value for the div is straightforward enough, and I called the ul element monoliths because it reminded me of the memorial monoliths at the entrance to EPCOT in Florida. I’m also taking advantage of the now-ubiquitous ability to wrap multiple elements, including block elements, in a hyperlink. That way I can shove the image and text structures in there, and make the entire image and text below it one link.

Structure is easy, though. Can we make that layout fully responsive? I wondered. Yes we can. Here’s the target layout, stripped of the navbar and promo copy.

So let’s start from the beginning. The div gets some color and text styling, and the monoliths list is set to flex. The images are in a single line, after all, and I want them to be flexible for responsive reasons, so flexbox is 100% the right tool for this particular job.

#page-top { 
  background: #000; 
  color: #FFF; 
  line-height: 1; 
} 
#page-top .monoliths { 
  display: flex; 
  padding-bottom: 1em; 
  overflow: hidden; 
}

I also figured, let’s give the images a simple basis for sizing, and set up the hyperlink while we’re at it.

#page-top .monoliths li { 
  width: 25%; 
} 
#page-top .monoliths a { 
  color: inherit; 
  text-decoration: inherit; 
  display: block; 
  padding: 1px; 
}

So now the list items are 25% wide—I can say that because I know there will be four of them—and the links pick up the foreground color from their parent element. They’re also set to generate a block box.

At this point, I could concentrate on the images. They need to be as wide as their parent element, but no wider, and also match height. While I was at it, I figured I’d create a little bit of space above and below the captioning text, and make the strong elements containing speakers’ names generate a block box.

#page-top .monoliths img { 
  display: block; 
  height: 33rem; 
  width: 100%; 
} 
#page-top .monoliths div { 
  padding: 0.5em 0; 
} 
#page-top .monoliths strong { 
  display: block; 
  font-weight: 900; 
}

It looks like the speakers were all cast into the Phantom Zone or something, so that needs to be fixed. I can’t physically crop the images to be the “correct” size, because there is no correct size: this needs to work across all screen widths. So rather than try to swap carefully-sized images in and out at various breakpoints, or complicate the structure with a wrapper element set to suppress overflow of resized images, I turned to object-fit.

#page-top .monoliths img { 
  display: block; 
  height: 33rem; 
  width: 100%; 
  object-fit: cover; 
  object-position: 50% 20%; 
}

If you’ve never used object-fit, it’s a bit like background-size. You can use it to resize image content within the image’s element box without creating distortions. Here, I set the fit sizing to cover, which means all of the img element’s element box will be covered by image content. In this case, it’s like zooming in on the image content. I also set a zooming origin with object-position, figuring that 50% across and 20% down would be in the vicinity of a speaker’s face, given the way pictures of people are usually taken.

This is fairly presentable as-is—a little basic, perhaps, but it would be fine to layer the navbar and promo copy back over it with Grid or whatever, and call it a day. But it’s too square and boxy. We must go further!

To make that happen, I’m going to take out the third and fourth images temporarily, so we can see more clearly how the next part works. That will leave us with Rachel and Derek.

The idea here is to clip the images to be slanted, and then pull them close to each other so they have just a little space between them. The first part is managed with clip-path, but we don’t want to pull the images together unless their shapes are being clipped. So we set up a feature query.

@supports (clip-path: polygon(0 0)) or (-webkit-clip-path: polygon(0 0)) { 
  #page-top .monoliths li { 
    width: 37.5%; 
  } 
}

I decided to test for both the un-prefixed and WebKit-prefixed versions of clip-path because Safari still requires the prefix, and I couldn’t think of a good reason to penalize Safari’s users for the slowness of its standards advancement. Then I made the images wider, taking them from 25% to 37.5%, which makes them half again as wide.

Thanks to object fitting, the images don’t distort when I change their parent’s width; they just get wider and scale up the contents to fit. And now, it is time for clipping!

@supports (clip-path: polygon(0 0)) or (-webkit-clip-path: polygon(0 0)) { 
  #page-top .monoliths li { 
    width: 37.5%; 
    -webkit-clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
    clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
  } 
}

Each coordinate pair in the polygon() is like the position pairs in background-position or object-position: the horizontal distance first, followed by the vertical distance. So the first point in the polygon is 25% 0, which is 25% of the way across the element box, and no distance down, so right at the top edge. 100% 0 is the top right corner. 75% 100% is on the bottom edge, three-quarters of the way across the element, and 0 100% is the bottom left corner. That creates a polygon that’s a strip three-quarters the full width of the element box, and runs from bottom left to top right.

Now we just have to pull them together, and this is where old tricks come back into play: all we need is a negative right margin to bring them closer together.

#page-top .monoliths li { 
  width: 37.5%; 
  margin-right: -7.5%; 
  -webkit-clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
  clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
}

The separation between them is a little wider than we were originally aiming for, but let’s see what happens when we add the other two images back in and let flexbox do its resizing magic.

Notice how the slants actually change shape as the screen gets narrower or wider. This is because they’re still three-quarters the width of the image element’s box, but the width of that box is changing as the screen width changes. That means at narrow widths, the slant is much steeper, whereas at wide widths, the slant is more shallow. But since the clipping path’s coordinates were all set with percentage distances, they all stay parallel to each other while being completely responsive to changes in screen size. An absolute measure like pixels would have failed.

But how did the images get closer together just by adding in two more? Because the list items’ basic sizing added up to more than 100%, and they’re all set to flex-shrink: 1. No, you didn’t miss a line in the CSS: 1 is the default value for flex-shrink. Flex items will shrink by default, which after all is what we should expect from a flexible element. If you want to know how much they shrunk, and why, here’s what Firefox’s flex inspector reports.

When there were only two list items, there was space enough for both to be at their base size, with no shrinkage. Once we went to four list items, there wasn’t enough space, so they all shrank down. At that point, having a negative right margin of -7.5% was just right to pull them together to act as a unit.

So, now they’re all nicely nestled together, and fully responsive! The captions need a little work, though. Notice how they’re clipped off a bit on the left edge, and can be very much clipped off on the right side at narrower screen widths? This happens because the li elements are being clipped, and that clipping applies to all their contents, images and text alike. And we can’t use overflow to alter this: clipped is clipped, not overflowed.

Fortunately, all we really need to do is push the text over a small amount. Inside the feature query, I added:

#page-top .monoliths div { 
  padding-left: 2%;
  padding-right: 26%; 
}

This shifts the text just a bit rightward, enough to clear the clip path. On the right side, I padded the div boxes so their contents wouldn’t fall outside the clipped area and appear to slide under the next caption. We could also use margins here, but I didn’t for reasons I’ll make clear at the end.

At the last minute, I decided to make the text at least appear to follow the slants of the images. For that, I just needed to shift the first line over a bit, which I did with a bit more padding.

#page-top .monoliths strong { 
  padding-left: 1%; 
}

That’s all to the good, but you may have noticed the captions still overlap at really narrow screen widths. There are a lot of options here, from stacking the images atop one another to reverting to normal flow, but I decided to just hide the captions if things got too narrow. It reduces clutter without sacrificing too much in the way of content, and by leaving them still technically visible, they seem to remain accessible.

@media (max-width: 35rem) { 
  #page-top .monoliths div { 
    opacity: 0.01 
  } 
}

And that, as they say, is that! Fully responsive slanted images with text, in an accessible markup structure. I dig it.

I did fiddle around with the separations a bit, and found that a nice thin separator occurred around margin-right: -8%, whereas beefier ones could be found above -7%. And if you crank the negative margin value to something beyond -8%, you’ll make the images overlap entirely, no visible separation—which can be a useful effect in its own right.

I promised to say why I used padding for the caption text div rather than margins. Here’s why.

#page-top .monoliths div { 
  padding-left: 3%; 
  padding-right: 26%; 
  border-top: 2px solid transparent; 
  background: linear-gradient(100deg,hsl(292deg,50%,50%) 50%, transparent 85%); 
  background-clip: padding-box; 
}

It required a wee bit more padding on the left to look decent, and an alteration to the background clipping box in order to keep the purple from filling the transparent border area, but the end result is pretty nifty, if I do say so myself. Alternatively, we could drop the background gradient on the captions and put one in the background, with a result like this.

I have no doubt this technique could be extended, made more powerful, and generally improved upon. I really wished for subgrid support in Chrome, so that I could put everything on a grid without having to tear the markup structure apart, and there are doubtless even more interesting clipping paths and layout patterns to try out.

I hope these few ideas spark some much better ideas in you, and that you’ll share them with us!


About the author

Eric A. Meyer (@meyerweb) has been a burger flipper, a college webmaster, an early blogger, one of the original CSS Samurai, a member of the CSS Working Group, a consultant and trainer, and a Standards Evangelist for Netscape. Among other things, Eric co-wrote Design For Real Life with Sara Wachter-Boettcher for A Book Apart and CSS: The Definitive Guide with Estelle Weyl for O’Reilly, created the first official W3C test suite, assisted in the creation of microformats, and co-founded An Event Apart with Jeffrey Zeldman. Eric lives with his family in Cleveland, Ohio, which is a much nicer city than you’ve probably heard. He enjoys a good meal whenever he can and considers almost every form of music to be worthwhile.

More articles by Eric




x

Something old, something luxe

Want to own a pair of Jimmy Choos but the price tag deters you? Sites selling pre-loved, pre-owned luxury items might be your answer, writes PRIYADARSHINI PAITANDY




x

Max factor, minimum fuss

SRIYA NARAYANAN embraces the minimalism trend and tells you how to master it




x

What’s in your box?

This festive season, give the staid old gift box a miss and opt for curated ones instead, writes PRIYADARSHINI PAITANDY




x

Uniqlo turns three in the India market; launches second edition of its collaboration with Italian luxury fashion house Marni

Headquartered in Tokyo, the Japanese apparel brand focusses on technology and sustainability, and its latest collection of fleece jackets is made of recycled PET bottles



  • Life &amp; Style

x

Sahodaran’s 2023 calendar highlights India’s textile heritage

It was the effort of four photographers, 14 models, and three stylists, and was shot at four locations



  • Life &amp; Style

x

Designer Ranna Gill brings the essence of Lake Como to the runway at the Lakme Fashion Week X FDCI

Twenty-five years of Ranna Gill, and she still lets the flowers do the talking in her garments. Ahead of her show at Lakme Fashion Week X FDCI, the designer gives us a sneak peek into her collection



  • Life &amp; Style

x

Health in a box

With longer work hours, little exercise time and crazy schedules, staying fit can be a challenge. But with these healthy food deliveries, it’s a challenge you can tackle, writes RANJANI RAJENDRA




x

A plan of exercise

No matter what your schedule may be, if you make a little time for a workout a day, it keeps all the aches away




x

‘Never trust the front of a food box’