ic

Mount Fuji gets its trademark snowcap after longest delay in 130 years, but still not official

Late snowfall on iconic Mt. Fuji sparks climate change concerns, breaking records and delaying official confirmation




ic

Gennova Biopharmaceuticals launches a paediatric pack of pegaspargase, to treat rare blood cancer

The drug, marketed as Hamsyl – Junior will now be available in a 1500 IU pack, and is priced at ₹Rs 20,970, a company official told businessline




ic

ISRO reaches new milestone, successfully lands Pushpak reusable launch vehicle

ISRO conducted successful RLV-LEX-02 experiment demonstrating autonomous landing capabilities from high altitudes, marking progress in space technology




ic

Your hair-stylist, tattoo artist, tailor can help monitor metabolic health, says Dr Sarin

In his book “Own Your Body,” Dr Shiv Sarin advocates for educating these professionals to look for signs like black lines, skin tags, and waist-to-hip ratios, which could indicate underlying health issues




ic

TASL’s first ‘sub-metre optical’ satellite launched

The SpaceX’s Falcon 9 rocket catapulted the TASL’s satellite from Launch Complex 39A at Kennedy Space Center on April 7, says TASL




ic

Global recognition to Gagandeep Kang for research on enteric diseases in children

This was part of the Gairdner Foundation’s announcement of its 2024 Canada Gairdner Award winners




ic

Ananth Technologies founder Pavuluri Subba Rao gets Aryabhatta award for contribution to astronautics

Ananth Technologies designs avionics for ISRO and Defence, supplying components to 98 satellites and 78 launch vehicles




ic

Veddas of Sri Lanka have close genetic link with India: Study

The finding challenges the conventional isolation-by-distance model in genetic studies




ic

ICMR releases revised 'Dietary Guidelines for Indians', urges avoiding protein supplements

Low intake of essential nutrients can disrupt metabolism and increase the risk of insulin resistance




ic

IIT Madras partners with SilTerra Malaysia for silicon photonic processor chips

These chips will be utilised for quantum computing and high-speed secured communication systems




ic

Krishna Ella awarded Dean’s Medal by Johns Hopkins Bloomberg School of Public Health

Under Ella’s guidance, Bharat Biotech created several groundbreaking vaccines, including Covaxin, India’s first indigenous Covid-19 vaccine




ic

NASA will soon train Indian astronauts for joint mission to International Space Station: US Envoy Eric Garcetti

NASA to provide advanced training to Indian astronauts for joint mission to International Space Station, US envoy Eric Garcetti says




ic

Combating superbugs: How Indian drugmakers can address the global shortfall in antibiotic development

Emphasising the importance of expanding access to high-burden regions, the report calls for strategic initiatives to enable the production and distribution of life-saving antibiotics and antifungals




ic

Non-toxic ionic liquids for silk processing 

A team at IASST Guwahati has identified 4 different Ionic Liquids that can be effective in extracting silk proteins from raw fibres 




ic

Indian astrophysicist Prahlad Chandra Agrawal honoured with COSPAR Harrie Massey Award 2024

Prahlad Chandra Agrawal is the first Indian recipient of this award, which recognizes outstanding contributions to the development of space research, particularly those in a leadership role.




ic

Bharat Small Reactors being readied, modification of 220 MW reactors under way, says Atomic Energy Commission’s Grover

Modification minimal, change incremental, says RB Grover




ic

Mpox outbreaks in Africa could be ended in 6 months, WHO chief says

First shipment of vaccines expected to arrive in Congo within days: WHO Director-General Tedros Adhanom Ghebreyesus




ic

ICMR inks industry collaborations for first in-human trials

Collaborations on four molecules, a fillip for research in the country




ic

AI pioneers John Hopfield and Geoffrey Hinton awarded Nobel Prize in Physics

Hinton, often referred to as the “Godfather of artificial intelligence,” alongside Hopfield, an American scientist working at Princeton, have utilised principles from physics to create algorithms and neural networks that underpin today’s AI technologies




ic

Stock to buy today: ICICI Securities (₹882.30): BUY

ICICI Securities share price can rise to ₹930-₹950 initially and then to ₹980 eventually




ic

Nifty Prediction Today – October 30, 2024: Can be range bound. Stay out of the market

Nifty 50 October Futures contract can oscillate in a range of 24,300-24,600




ic

Bank Nifty prediction today – Oct 30, 2024: Intraday trend uncertain at the moment

The key levels for Bank Nifty futures are 51,200 and 52,700




ic

Diwali Muhurat Trading 2024: Samvat 2081 stock pick: Sun TV Network - BUY

Sun TV Network share price has potential to target ₹1,200 and ₹1,500 from a long-term perspective




ic

Domestic healthcare in focus with new fund offer

Branded pharma, andhealthcare services penetration are long-term drivers offset by recent rally




ic

Will Samvat 2081 complete the hat-trick?

3 out every 4 stocks gained since last Diwali; power stocks and mid-caps led Samvat 2080 surge




ic

Stock to buy today: J.B. Chemicals and Pharmaceuticals (₹1,961.80): BUY

J.B. Chemicals and Pharmaceuticals share price can rise to ₹2,100




ic

Nifty Prediction Today – November 04, 2024: Bearish. Go short now and on a rise

Nifty 50 November Futures contract can fall to 23,950 and 23,800




ic

Bank Nifty prediction today – November 4, 2024: Bears gaining momentum

Bank Nifty futures might see a fall to 50,800




ic

F&O Query: Should you hold call options on Reliance Industries and ICICI Bank?




ic

Nifty Prediction today – Nov 5, 2024: Downtrend might resume, go short

Nifty futures can decline to 23,500 in the near term




ic

Bank Nifty Prediction today – Nov 5, 2024: Might fall off a barrier, initiate short

Bank Nifty November futures areis likely to see a decline




ic

Nifty Prediction today – Nov 6, 2024: Momentum favours bulls, go long

Nifty futures can rise to 24,750




ic

Bank Nifty Prediction today – Nov 6, 2024: Intraday trend uncertain, stay out

Bank Nifty futures is trading between key levels at 52,000 and 52,800




ic

Bank Nifty Prediction today – Nov 7, 2024: Hovering around a support, short if this base is broken

Bank Nifty futures can fall to 51,300 if it slips below 52,000 




ic

Nifty Prediction today – Nov 7, 2024: Bears gain momentum; go short if the support is breached

Nifty futures has a support at 24,250; a breach of this can lead to a fall to 24,000 




ic

Nifty prediction today – Nov 8, 2024: Intraday outlook is unclear. Stay out of the market

Nifty 50 November futures contract can oscillate in a range of 24,150-24,400




ic

Bank Nifty prediction today – Nov 8, 2024: Trading within a range

Bank Nifty futures is currently stuck between 52,000 and 52,500




ic

Mastering Derivatives: Does futures price decay?

Here’s a low down on the key components in future contracts’ pricing




ic

Currency Outlook: Trump’s victory fuels dollar rally

Rupee makes the much-awaited bearish breakout




ic

Tech Query: What is the outlook for TVS Holdings, Gujarat State Fertilizers & Chemicals (GSFC), Ideaforge Technology and Niyogin Fintech?

We zoom in on the prospects of TVS Holdings, as also the prospects of three other stocks — Gujarat State Fertilizers & Chemicals (GSFC), Ideaforge Technology and Niyogin Fintech




ic

New vs Old: I-T regime choice can alter your net salary

Each regime has its own tax rates, deductions and benefits that can significantly impact take-home pay. This overview help you determine which option might be the best fit for your financial situation.




ic

Nifty Prediction Today – November 11, 2024: Resistance ahead. Go short on a rise

Nifty 50 November Futures contract can fall to 23,900




ic

Bank Nifty Prediction Today – November 11, 2024: Wait for dips to go long

Bank Nifty November Futures can rise to 52,500 if the bounce sustains




ic

position: sticky, draft 1

I’m writing the position: sticky part of my book, and since I never worked with sticky before I’m not totally sure if what I’m saying is correct.

This is made worse by the fact that there are no very clear tutorials on sticky. That’s partly because it works pretty intuitively in most cases, and partly because the details can be complicated.

So here’s my draft 1 of position: sticky. There will be something wrong with it; please correct me where needed.

The inset properties are top, right, bottom and left. (I already introduced this terminology earlier in the chapter.)

Introduction

position: sticky is a mix of relative and fixed. A sticky box takes its normal position in the flow, as if it had position: relative, but if that position scrolls out of view the sticky box remains in a position defined by its inset properties, as if it has position: fixed. A sticky box never escapes its container, though. If the container start or end scrolls past the sticky box abandons its fixed position and sticks to the top or the bottom of its container.

It is typically used to make sure that headers remain in view no matter how the user scrolls. It is also useful for tables on narrow screens: you can keep headers or the leftmost table cells in view while the user scrolls.

Scroll box and container

A sticky box needs a scroll box: a box that is able to scroll. By default this is the browser window — or, more correctly, the layout viewport — but you can define another scroll box by setting overflow on the desired element. The sticky box takes the first ancestor that could scroll as its scroll box and calculates all its coordinates relative to it.

A sticky box needs at least one inset property. These properties contain vital instructions, and if the sticky box doesn’t receive them it doesn’t know what to do.

A sticky box may also have a container: a regular HTML element that contains the sticky box. The sticky box will never be positioned outside this container, which thus serves as a constraint.

The first example shows this set-up. The sticky <h2> is in a perfectly normal <div>, its container, and that container is in a <section> that is the scroll box because it has overflow: auto. The sticky box has an inset property to provide instructions. The relevant styles are:

section.scroll-container {
	border: 1px solid black;
	width: 300px;
	height: 300px;
	overflow: auto;
	padding: 1em;
}

div.container {
	border: 1px solid black;
	padding: 1em;
}

section.scroll-container h2 {
	position: sticky;
	top: 0;
}

The rules

Sticky header

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Now let’s see exactly what’s going on.

A sticky box never escapes its containing box. If it cannot obey the rules that follow without escaping from its container, it instead remains at the edge. Scroll down until the container disappears to see this in action.

A sticky box starts in its natural position in the flow, as if it has position: relative. It thus participates in the default flow: if it becomes higher it pushes the paragraphs below it downwards, just like any other regular HTML element. Also, the space it takes in the normal flow is kept open, even if it is currently in fixed position. Scroll down a little bit to see this in action: an empty space is kept open for the header.

A sticky box compares two positions: its natural position in the flow and its fixed position according to its inset properties. It does so in the coordinate frame of its scroll box. That is, any given coordinate such as top: 20px, as well as its default coordinates, is resolved against the content box of the scroll box. (In other words, the scroll box’s padding also constrains the sticky box; it will never move up into that padding.)

A sticky box with top takes the higher value of its top and its natural position in the flow, and positions its top border at that value. Scroll down slowly to see this in action: the sticky box starts at its natural position (let’s call it 20px), which is higher than its defined top (0). Thus it rests at its position in the natural flow. Scrolling up a few pixels doesn’t change this, but once its natural position becomes less than 0, the sticky box switches to a fixed layout and stays at that position.

The sticky box has bottom: 0

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Sticky header

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

It does the same for bottom, but remember that a bottom is calculated relative to the scroll box’s bottom, and not its top. Thus, a larger bottom coordinate means the box is positioned more to the top. Now the sticky box compares its default bottom with the defined bottom and uses the higher value to position its bottom border, just as before.

With left, it uses the higher value of its natural position and to position its left border; with right, it does the same for its right border, bearing in mind once more that a higher right value positions the box more to the left.

If any of these steps would position the sticky box outside its containing box it takes the position that just barely keeps it within its containing box.

Details

Sticky header

Very, very long line of content to stretch up the container quite a bit

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

The four inset properties act independently of one another. For instance the following box will calculate the position of its top and left edge independently. They can be relative or fixed, depending on how the user scrolls.

p.testbox {
	position: sticky;
	top: 0;
	left: 0;
}

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

The sticky box has top: 0; bottom: 0

Regular content

Regular content

Regular content

Regular content

Sticky header

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Setting both a top and a bottom, or both a left and a right, gives the sticky box a bandwidth to move in. It will always attempt to obey all the rules described above. So the following box will vary between 0 from the top of the screen to 0 from the bottom, taking its default position in the flow between these two positions.

p.testbox {
	position: sticky;
	top: 0;
	bottom: 0;
}

No container

Regular content

Regular content

Sticky header

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

So far we put the sticky box in a container separate from the scroll box. But that’s not necessary. You can also make the scroll box itself the container if you wish. The sticky element is still positioned with respect to the scroll box (which is now also its container) and everything works fine.

Several containers

Sticky header

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside outer container

Content outside outer container

Or the sticky item can be several containers removed from its scroll box. That’s fine as well; the positions are still calculated relative to the scroll box, and the sticky box will never leave its innermost container.

Changing the scroll box

Sticky header

The container has overflow: auto.

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside container

One feature that catches many people (including me) unaware is giving the container an overflow: auto or hidden. All of a sudden it seems the sticky header doesn’t work any more.

What’s going on here? An overflow value of auto, hidden, or scroll makes an element into a scroll box. So now the sticky box’s scroll box is no longer the outer element, but the inner one, since that is now the closest ancestor that is able to scroll.

The sticky box appears to be static, but it isn’t. The crux here is that the scroll box could scroll, thanks to its overflow value, but doesn’t actually do so because we didn’t give it a height, and therefore it stretches up to accomodate all of its contents.

Thus we have a non-scrolling scroll box, and that is the root cause of our problems.

As before, the sticky box calculates its position by comparing its natural position relative to its scroll box with the one given by its inset properties. Point is: the sticky box doesn’t scroll relative to its scroll box, so its position always remains the same. Where in earlier examples the position of the sticky element relative to the scroll box changed when we scrolled, it no longer does so, because the scroll box doesn’t scroll. Thus there is no reason for it to switch to fixed positioning, and it stays where it is relative to its scroll box.

The fact that the scroll box itself scrolls upward is irrelevant; this doesn’t influence the sticky box in the slightest.

Sticky header

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Regular content

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

Content outside container

One solution is to give the new scroll box a height that is too little for its contents. Now the scroll box generates a scrollbar and becomes a scrolling scroll box. When we scroll it the position of the sticky box relative to its scroll box changes once more, and it switches from fixed to relative or vice versa as required.

Minor items

Finally a few minor items:

  • It is no longer necessary to use position: -webkit-sticky. All modern browsers support regular position: sticky. (But if you need to cater to a few older browsers, retaining the double syntax doesn’t hurt.)
  • Chrome (Mac) does weird things to the borders of the sticky items in these examples. I don’t know what’s going on and am not going to investigate.



  • CSS for JavaScripters

ic

Endemic birds of the Western Ghats in art

Artist Ragavan Suresh creates scientific watercolour drawings of endemic birds of the Western Ghats, endangered animals, and orchids to draw attention towards conservation



  • Life &amp; Style

ic

IISc study reveals that picolinic acid can block viruses causing SARS-CoV-2 and influenza A

The study describes the compound’s remarkable ability to disrupt the entry of enveloped viruses into the host’s cell and prevent infection




ic

Ruhani Sharma: I play a close-to-reality cop in ‘HER’; there is no scope for ‘Singham’ style of histrionics

Ruhani Sharma talks about headlining the Telugu cop drama franchise ‘HER’, says she never imagined herself as a sharpshooter 




ic

Rana Daggubati’s Spirit Media to launch ‘Hiranyakashyap’ movie, ‘Minnal Murali’ comic and more at San Diego Comic-Con 2023

Actor-producer Rana Daggubati’s Spirit Media debuts at San Diego Comic-Con 2023 by announcing the mythological film ‘Hiranyakashyap’ and comic based on the superhero film ‘Minnal Murali’ 




ic

A newly-opened pizzeria brings Kundapuri ghee roast paneer and Kerala chicken roast flavours in pizzas

Dollops of sherry leek or fresh arugula? Choose your pick from artisanal pizzas and sauces made from scratch at the newly-opened pizzeria




ic

A curriculum shove at ISB focuses on a leadership model based on ancient Indian wisdom

Sharing an insight into the concept of ‘Beingful leadership’, Ram Nidumolu holds forth on how ancient wisdom models inform this futuristic concept and are relevant to modern managers



  • Life &amp; Style