s

Today’s Stock Recommendation: November 5, 2024

The stock idea that we have for you today is Angel One




s

Stock to buy today: Angel One (₹2,886.35): BUY

Angel One share price can rise to ₹3,400 after some more fall from here




s

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

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




s

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

Bank Nifty November futures areis likely to see a decline




s

Day trading guide for November 5, 2024: Intraday supports, resistances for Nifty50 stocks

Here are the intraday supports and resistances for widely traded stocks such as Reliance Industries, ITC, ONGC, Infosys, HDFC Bank, TCS, and SBI



  • Day trading guide

s

Aluminium futures: Potential rally ahead

The November futures can rise to ₹255




s

F&O Query: Should you hold call options on Infosys and Voltas?




s

Weekly Rupee View: Rupee set to witness higher volatility

US election and the Fed policy announcement are the key events




s

Day trading guide for November 6, 2024: Intraday supports, resistances for Nifty50 stocks

Here are the intraday supports and resistances for widely traded stocks such as Reliance Industries, ITC, ONGC, Infosys, HDFC Bank, TCS, and SBI



  • Day trading guide

s

Stock to buy today: Tata Steel (₹152.30)

For the short term, traders can buy shares of Tata Steel at ₹152 and on a dip to ₹148




s

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

Nifty futures can rise to 24,750




s

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




s

Zinc futures remain above key support

Traders can consider longs on dips




s

Day trading guide for November 7, 2024: Intraday supports, resistances for Nifty50 stocks

Here are the intraday supports and resistances for widely traded stocks such as Reliance Industries, ITC, ONGC, Infosys, HDFC Bank, TCS, and SBI



  • Day trading guide

s

Stock to buy today: PNB Housing Finance (₹999.2)

The price action over the past couple of weeks indicates good buying interest




s

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 




s

ACME Solar Holdings: Should you subscribe to the IPO?

Amongst the top 10 IPPs in the renewable segment, the company is in the process of diversifying from solar to wind, hybrid and FDRE projects




s

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 




s

Post mixed Q2, India Inc may face tailwinds in second half of FY25

It needs to be seen if fortunes for the consumer segments will reverse




s

Natural gas futures: Uncertainty prevails

Traders need to wait for strong cues about next leg of trend




s

Day trading guide for November 8, 2024: Intraday supports, resistances for Nifty50 stocks

Here are the intraday supports and resistances for widely traded stocks such as Reliance Industries, ITC, ONGC, Infosys, HDFC Bank, TCS, and SBI



  • Day trading guide

s

Stock to buy today: Deepak Nitrite (₹2,815.65)

Although there was a price drop on Thursday, the scrip retains its bullishness




s

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




s

Ayushman Bharat senior citizen health insurance: Benefits and enrolment details

The Ayushman Bharat scheme offers ₹5 lakh health coverage for seniors 70+, free and with easy Aadhaar-based enrollment




s

Why you should home in on this premium realty player

Robust traction in the upmarket residential segment, healthy occupancies in its commercial rental business and healthy financials are positives for Oberoi Realty




s

Mastering Derivatives: Does futures price decay?

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




s

Insurance Query: Stay updated on changes in health insurance norms

IRDAI’s changes to health insurance landscape provide enhanced protection, security and a more user-friendly experience




s

When the taxman comes knocking

Here’s a lowdown on notices/ intimations from the I-T department and what they mean for taxpayers




s

Currency Outlook: Trump’s victory fuels dollar rally

Rupee makes the much-awaited bearish breakout




s

F&O Tracker: Index futures seek direction

Participants need to wait for a confirmatory move




s

Bullion Cues: Rally likely post dip

Traders can buy at lower levels




s

Bandu’s Blockbusters for Nov 10, 2024

Guess the stock that will give the best return by next Friday




s

F&O Strategy: Short Torrent Pharma

Derivatives traders can either go short on futures contract or buy a put option, depending on the risk appetite




s

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




s

Index Outlook: Vulnerable Sensex, Nifty 50 struggle

Strong resistance coming up to halt the rally in the Dow Jones




s

Movers & Shakers: Stocks that will see action this week

Here is what the charts say about IGL, JSW Energy and Max Financial Services




s

Niva Bupa Health Insurance IPO: Should you subscribe?

The company’s ability to reign in claims in the next three years is key monitorable




s

Trump, tariffs and tax cuts – Can they power the US stock markets ahead?

As Trump 2.0 gets set to take control, the US markets are a play of opposing factors




s

Market correction broad-based with 7 of 10 stocks of BSE AllCap seeing a fall

FPI outflows overlapping with earnings slowdown and the return of the dragon weigh in




s

Coming soon, a new asset class to consider

India’s securities regulator is looking to open up a fresh vehicle for investments for people in the mass affluent segment that will be different from existing mutual fund alternatives




s

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.




s

The right asset mix

You should reduce equity investments and increase bond investments starting five years from the end of the time horizon for a goal. You should, however, save more during this period.




s

Stock to buy today: Mahindra & Mahindra (₹2,979.25): BUY

Mahindra & Mahindra share price can rise to ₹3,200




s

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

Nifty 50 November Futures contract can fall to 23,900




s

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




s

Copper: Can oscillate in a range

MCX Copper Futures contract can trade in a range of ₹820-₹865




s

Day trading guide for November 12, 2024: Intraday supports, resistances for Nifty50 stocks

Here are the intraday supports and resistances for widely traded stocks such as Reliance Industries, ITC, ONGC, Infosys, HDFC Bank, TCS, and SBI



  • Day trading guide

s

Stock to buy today: HCL Technologies (₹1,867): BUY

HCL Technologies share price can rise to ₹1,935




s

Two options for using custom properties

Recently I interviewed Stefan Judis for my upcoming book. We discussed CSS custom properties, and something interesting happened.

We had a period of a few minutes where we were talking past one another, because, as it turns out, we have completely opposite ideas about the use of CSS custom properties. I had never considered his approach, and I found it interesting enough to write this quick post.

Option 1

Take several site components, each with their own link and hover/focus colours. We want to use custom properties for those colours. Exactly how do we do that?

Before my discussion with Stefan that wasn’t even a question for me. I would do this:

.component1 {
	--linkcolor: red;
	--hovercolor: blue;
}

.component2 {
	--linkcolor: purple;
	--hovercolor: cyan;
}

a {
	color: var(--linkcolor);
}

a:hover,a:focus {
	color: var(--hovercolor)
}

I set the normal and hover/focus colour as a custom property, and leave the definition of those properties to the component the link appears in. The first and second component each define different colours, which are deployed in the correct syntax. Everything works and all’s well with the world.

As far as I can see now this is the default way of using CSS custom properties. I wasn’t even aware that another possibility existed.

Option 2

Stefan surprised me by doing almost the complete opposite. He uses only a single variable and changes its value where necessary:

.component1 {
	--componentcolor: red;
}

.component1 :is(a:hover,a:focus) {
	--componentcolor: blue;
}
	
.component2 {
	--componentcolor: purple;
}

.component2 :is(a:hover,a:focus) {
	--componentcolor: cyan;
}
	
a {
	color: var(--componentcolor)		
}

At first I was confused. Why would you do this? What’s the added value of the custom property? Couldn’t you just have entered the colour values in the component styles without using custom properties at all?

Well, yes, you could. But that’s not Stefan’s point.

The point

In practice, component definitions have way more styles than just colours. There’s a bunch of box-model properties, maybe a display, and possibly text styling instructions. In any case, a lot of lines of CSS.

If you use custom properties only for those CSS properties that will change you give future CSS developers a much better and quicker insight in how your component works. If the definition uses a custom property that means the property may change in some circumstances. If it uses a fixed definition you know it’s a constant.

Suppose you encounter this component definition in a codebase you just inherited:

.component {
	--color: red;
	--background: blue
	--layout: flex;
	--padding: 1em;
	--borderWidth: 0.3em;
	display: var(--layout);
	color: var(--color);
	background: var(--background);
	padding: var(--padding);
	border: var(--borderWidth) solid black;
	margin: 10px;
	border-radius: 2em;
	grid-template-columns: repeat(3,1fr);
	flex-wrap: wrap;
}

Now you essentially found a definition file. Not only do you see the component’s default styles, you also see what might change and what will not. For instance, because the margin and border-radius are hard-coded you know they are never changed. In the case of the border, only the width changes, not the style or the colour. Most other properties can change.

The use of display: var(--layout) is particularly revealing. Apparently something somewhere changes the component’s layout from grid to flexbox. Also, if it’s a grid it has three equal columns, while if it’s a flexbox it allows wrapping. This suggests that the flexbox layout is used on narrower screens, switching to a grid layout on wider screens.

Where does the flexbox change to a grid? As a newbie to this codebase you don’t know, but you can simply search for --layout: grid and you’ll find it, probably neatly tucked away in a media query somewhere. Maybe there is a basic layout as well, which uses neither flexbox nor grid? Search for --layout: block and you’ll know.

Thus, this way of using custom properties is excellently suited for making readable code bases that you can turn over to other CSS developers. They immediately know what changes and what doesn’t.

Teaching aid?

There’s another potential benefit as well: this way of using custom properties, which are essentially variables, aligns much more with JavaScript’s use of variables. You set an important variable at the start of your code, and change it later on if necessary. This is what you do in JavaScript all the time.

Thus this option may be better suited to teaching CSS to JavaScripters, which remains one of my preoccupations due to the upcoming book.

Picking an option

Which option should you pick? That’s partly a matter of personal preference. Since the second option is still fairly new to me, and I rarely work on large projects, I am still feeling my way around it. Right at this moment I prefer the first way because I’m used to it. But that might change, given some extra time.

Still, I think Stefan is on to something. I think that his option is very useful in large codebases that can be inherited by other developers. I think it deserves careful consideration.



  • CSS for JavaScripters

s

aspect-ratio and grid

I’m currently investigating the new aspect-ratio declaration and plan to write an article about it. However, I got stuck on aspect ratios in a grid context. Chrome/Safari and Firefox do something different here, and I understand neither approach. So I hope I can get some help.

aspect-ratio is currently supported by Chrome 90, by Firefox 88 with the correct flag enabled, and by Safari Technology Preview. I tested mostly in the first two — for complicated reasons I cannot install STP right now, but a kind Twitter follower sent me a few screenshots. It behaves as Chrome.

First, a general remark. aspect-ratio is intentionally a fairly weak declaration. It gives way if other constraints on boxes make the requested aspect ratio impossible. Take this example:

.my-box {
	width: 100px;
	height: 50px;
	aspect-ratio: 16/9;
}

The box has a fixed width and height, and they overrule the aspect-ratio. The box will thus have a 2/1 aspect ratio, as dictated by its width and height, and not a 16/9 one.

Flexbox

With that in mind, let’s first look at aspect-ratio in a flexbox environment. I think I understand what’s going on here, and the browsers all do the same, so this is a good reference point for the grid problems we’ll encounter later.

Flex items take their width from the flexbox environment. In my example they have a flex-basis: 30%, but they could also have a width or even no width/flex-basis definition at all. In all cases the flexbox algorithm decides on the width of each item.

Once the width has been determined, it’s time for the height. Let’s assume it’s not set. In flexbox, height: auto means not “as high as you need to be for your content” but “as high as the highest box in your row.”

That is, naturally flexbox would give the boxes an equal width (because that’s what my flex declarations say) and an equal height (because that always happens in flexbox). Apparently, this counts as a set height for the aspect-ratio algorithm.

As a result the 16/9 value is ignored because the 4/3 results in a larger height, and this value is therefore the one that determines the height of the entire row.

As you see, the third box in this example does have the correct aspect ratio. That’s because it has an explicit height: min-content: set your height to whatever your content needs, and, more importantly, ignore the row height of the flex box. This, apparently, gives the aspect ratio algorithm the opening it needs to set the height to the one requested by the aspect-ratio: 16/9.

I’m not sure if my reasoning is right. I am very certain that this works in all browsers, though, so you can use height: min-content in production straight away. (max-content also works. There’s no real difference between the two in height declarations.)

flex aspect-ratio and min-content

The problem: grid

Now we get to the problem: grid. To follow along, please look at the example below in Firefox 88 with the aspect-ratio flag on, and in either Chrome or Safari Technology Preview.

I expected grid to more or less behave the same as flexbox: the widths are set by the grid, the heights by the row height, and getting the proper aspect ratio would require height: min-content. That last clause is correct: the min-content trick works as it does in flexbox. It’s the behaviour of th 16/9 box without min-content that surprises me.

Here, again, the third box has height: min-content and takes the correct aspect ratio, which means not obeying the row height, in all browsers.

grid aspect-ratio and min-content

Firefox first. All boxes get their correct aspect ratio and they all have the same width, as the repeat: (3,1fr) grid template dictates. That means their height differs. More importantly, the grid container box now becomes only as high as is necessary to contain the items as they would have been without their aspect ratio.

I am 99% certain that the grid container behaviour is a bug. I am less certain whether the aspect-ratio being obeyed is also a bug.

In Chrome, the second and third box behave as expected: the last box becomes less high than the row height because of height: min-content, and the second box dictates the row height with its 4/3 aspect ratio.

But what’s up with the first box? It appears that it takes the row height as a given, but then sets the width to the value dictated by the 16/9 aspect ratio, ignoring the fact that this box now overflows its proper grid placement. Is this a bug? Or does height count for more than width in a grid context? I don’t know.

In the second example all grid items have min-height: 100px. In all browsers they they calculate their width from their aspect ratio. Thus they break the grid-defined widths. This is understandable, given that the explicit height declaration is “stronger” than the implied widths from the grid definition. (Or rather: I devoutly hope I’m right here and not talking nonsense.)

grid aspect-ratio and min-height: 100px;

Thus maybe Firefox on the one hand and Chrome/Safari on the other are not as far apart as one would think from the first grid example. Still, something is buggy in that example. I just can’t figure out what it is.

Stumped. Please help.



  • CSS for JavaScripters