io Bullion Cues: Rally likely post dip By www.thehindubusinessline.com Published On :: Sat, 09 Nov 2024 18:40:49 +0530 Traders can buy at lower levels Full Article Derivatives
io Movers & Shakers: Stocks that will see action this week By www.thehindubusinessline.com Published On :: Sat, 09 Nov 2024 18:43:41 +0530 Here is what the charts say about IGL, JSW Energy and Max Financial Services Full Article Technical Analysis
io Market correction broad-based with 7 of 10 stocks of BSE AllCap seeing a fall By www.thehindubusinessline.com Published On :: Sat, 09 Nov 2024 22:02:55 +0530 FPI outflows overlapping with earnings slowdown and the return of the dragon weigh in Full Article Portfolio
io Nifty Prediction Today – November 11, 2024: Resistance ahead. Go short on a rise By www.thehindubusinessline.com Published On :: Mon, 11 Nov 2024 10:34:37 +0530 Nifty 50 November Futures contract can fall to 23,900 Full Article Technical Analysis
io Bank Nifty Prediction Today – November 11, 2024: Wait for dips to go long By www.thehindubusinessline.com Published On :: Mon, 11 Nov 2024 11:17:11 +0530 Bank Nifty November Futures can rise to 52,500 if the bounce sustains Full Article Technical Analysis
io Two options for using custom properties By www.quirksmode.org Published On :: Tue, 04 May 2021 15:16:56 +0100 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. Full Article CSS for JavaScripters
io aspect-ratio and grid By www.quirksmode.org Published On :: Tue, 11 May 2021 13:42:23 +0100 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. Full Article CSS for JavaScripters io aspect-ratio By www.quirksmode.org Published On :: Wed, 19 May 2021 11:35:27 +0100 This week we’ll take a look at the new aspect-ratio declaration and its use. Una Kravets wrote the introductory article, but there are some additional technical points to be made. I also wrote a little fallback that you might use if you need aspect-ratio right now. At the time of writing aspect-ratio is supported by Chrome 90, by Safari Technology Preview, and by Firefox 88 if you set the aspect-ratio flag in about:config. You need one of these browsers to see the examples below — except for the fallback, which should work in all browsers that support custom properties. Weak declaration aspect-ratio defines the ratio between the width and height of a box, but it is a weak declaration. If the box has a specified width and height the browser uses those values and ignores the aspect ratio. Width and height might be specified by explicit width and height declarations or by other means, as we’ll see below. aspect-ratio In this example all three boxes have aspect-ratio: 16/9. The first box has width: auto; height: auto; i.e. as much width as you can take, and as little height as you need. aspect-ratio takes the width, converts it to pixels, and applies the defined aspect ratio to calculate the height. The second box has a height: 50px; width: auto. The height is strong, but the auto width is weak and allows aspect-ratio to override it. Thus the box’s width is calculated by taking the height and applying the aspect ratio. The third box has a fixed width: 150px; height: 100px as well as an aspect-ratio: 16/9. Now both width and height are strong and the aspect ratio is ignored. Rounding Even if aspect-ratio works fine the browser must find an integer number of device pixels for the box’s width and height. Fractions are discarded somewhere along the way. That’s why the calculated aspect ratio of a box is rarely 100% exact. In the examples you’ll often see a narrow stripe of red poking from underneath the background image. That image has the same aspect ratio as the box it appears in, but apparently uses a different calculation. In normal circumstances these tiny differences are not visible to the naked eye, so you can safely ignore them. Fat red stripes, such as in the last box in the first example, are a sign of trouble, though. min- and max-width and -height grid aspect-ratio and min- and max-height You can set a min/max-width/height on the boxes. These are obeyed as normal, and aspect-ratio is obeyed as well. In this example the first box has a min-height: 100px, the second a max-height: 50px, and the third min-width: 100px. As you see they stretch up or down to their defined maximum and minimum and retain their aspect-ratio. box-sizing: border-box! Now we come to a trickier topic unearthed originally by Ana Tudor — and this entire article is a good read that I recommend. If it works, aspect-ratio sets either the width or the height of a box to match the other side and the defined aspect ratio. However, the exact effect depends on how width and height are defined; on box-sizing, in other words. width may mean either the content width, without padding and border (box-sizing: content-box; the default), or the width of content + padding + border (box-sizing: border-box). In general, the latter is what we want. aspect-ratio and box-sizing In the next example the boxes have padding: 10%. Percentual padding is always calculated relative to the width of the parent element. Thus this box has a padding of 10% of its parent element’s width, even at the top and the bottom. Since the padding is equal on all four sides, it may break the box’s aspect ratio. This depends on box-sizing. If you use the default box-sizing: content-box the width and height have the correct aspect ratio, but they define only the content area. An equal amoung of padding is added on all sides, and the aspect ratio is destroyed. This problem is easy to solve: set box-sizing: border-box. Now width and height define the content, padding, and border combined, and this entire area is given the correct aspect ratio. Thus the padding is seamlessly integrated with the proper aspect ratio. In fact, you should always set box-sizing: border-box in all your sites. content-box was a mistake, as W3C itself admitted (and as I said back in 2002). The fact that it fixes aspect-ratio merely gives us an extra reason to do so. aapect-ratio in flexbox In a flex or grid context, aspect-ratio can appear not to work. In fact, running into these problems was what caused me to write this article in the first place. Look at the example below. It doesn’t work! Oh noesies! What’s going on? flex aspect-ratio What happens here is default flexbox behaviour. First the widths of the items are calculated (here from flex-basis: 30%; grow: 1), and once that’s done the height of all items is set. These heights are calculated by applying their aspect ratio, but the tallest box is used to set the height of all items in the row. In our example that is the 1/1 box, so the 16/9 and 4/3 boxes also have an aspect ratio of 1/1. This default behaviour is ruled by align-items: stretch, which is part of the flexbox default. If you use any other value the boxes’ height is set to auto and they take their proper aspect ratio. flex-start is the most obvious choice, but see CSS Tricks’ great flexbox guide for more options. flex aspect-ratio and align-items If for some reason you want to overrule the height stretch on only a single item you can give that item either align-self: flex-start or any other value, or height: min-content. Both work fine. The third box in the next example has height: min-content. flex aspect-ratio and height: min-content aspect-ratio and grid In a grid context aspect-ratio encounters the same problems as in a flexbox environment, only with added browser bugs that I wrote about last week. I expected the same behaviour as in a flexbox context, but that’s not entirely what’s happening. The good news is that align-items, align-self, and height: min-content all work exactly as with flexbox. They negate the default grid behaviour of stretching the height of all elements in a row to the height of the highest element. grid aspect-ratio and align-items The problems are in the default rendering of aspect-ratio. Chrome and Safari implement this in one incorrect way, and Firefox is a quite different, equally incorrect way. If all boxes in the example below have the same width and height the bugs have been solved. They get the same height for the reasons I explained under flexbox — grid works the same in this respect (I hope). grid aspect-ratio with browser bugs Firefox obeys the aspect-ratio while I think it shouldn’t. Instead, like in the flexbox example, it should stretch the boxes to the height of the highest in the row. In addition it calculates the height of the entire grid by assuming its items have the minimum height needed for their content — and since my example boxes do not have any content that height is 0. Thus the grid container is way too small. Both are clearly bugs that will probably be fixed soon. Chrome and Safari TP size the grid container correctly, but seem to take the height as reference and size the width accordingly instead of taking the width as reference and sizing the height. Thus the 16/9 and 4/3 items become way too wide. I think this is also a bug — if it isn’t someone will have to carefully explain to me what’s going on. Fortunately this bug goes away if you use align-items — which you’re going to want to do in any case. A fallback (After writing this fallback I found that Ana Tudor wrote pretty much the same one in her article. I mean, why do I even bother competing with scarily smart people like her? But I came by it independently, honest.) 5/1 3/1 16/9 4/3 9/16 Since browser support isn’t quite there yet we need to continue to use the old padding-top trick as a fallback, as I do in this paragraph. It is supposed to have an aspect ratio even in browsers that do not support aspect-ratio. The core of the fallback is the following CSS. Fair warning: this solution is only lightly tested; I went from conception to successful execution in about 30 minutes — though I spent 90 more minutes on a custom property issue. The extra <span> is ugly, but I don’t see a way around it. If your aspect-ratioed boxes do not contain text you can leave it out. <p class="test"><span>The text</span></p> p.test { --aspectRatio: 16/9; --padding: 0.5em; border: 1px solid; padding: var(--padding); aspect-ratio: var(--aspectRatio); box-sizing: border-box; } @supports not (aspect-ratio: 16/9) { p.test { padding: 0; padding-top: calc((1 / (var(--aspectRatio)))*100%); position: relative; } p.test > span { display: block; position: absolute; top: var(--padding); left: var(--padding); } } Store the desired aspect ratio in --aspectRatio. Set aspect-ratio to that value. If the browser doesn’t support aspect-ratio, set the padding-top to 1 / the aspect ratio as a percentage. The script that runs in this page changes the value of --aspectRatio. The trick here is that percentual padding is calculated relative to the parent element’s width. If the box spans its parent’s entire width, you can take that width, multiply it by 1 divided by the aspect ratio (so for instance 9/16th when the aspect ratio is 16/9) and convert the result to a percentage. Now the padding stretches the box to the desired aspect ratio. If the box has any real content we have to wrap it in an extra HTML element and give that element position: absolute so that it does not influence the box’s height. Then we place it in the box, with a top and left coordinate equal to the box’s padding. Now the text appears to flow naturally. You don’t need this trick if the box only has a background image or gradient; those ignore padding anyway. Or you can wait a few months until all browsers support aspect-ratio. It won’t be long now. I may write a separate article about the incredible number of brackets we need in the padding-top line. Full Article CSS for JavaScripters io position: sticky, draft 1 By www.quirksmode.org Published On :: Wed, 08 Sep 2021 18:44:23 +0100 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. Full Article CSS for JavaScripters io Nirdiganta: A first-of-its-kind incubation centre for theatre By www.thehindu.com Published On :: Fri, 14 Jul 2023 11:42:03 +0530 Actor Prakash Raj’s innovative incubator for theatre and arts offers a comprehensive production process, stipends for actors/techs, lodging, kitchen and tech support. It also plans to promote fine arts and film in the future. Full Article Metroplus io Prakash Raj on creating ‘Nirdiganta’, an incubation centre for theatre, and getting back on stage By www.thehindu.com Published On :: Fri, 14 Jul 2023 11:55:55 +0530 Actor Prakash Raj says fans will soon get to see him perform live on stage Full Article Metroplus io Ruhani Sharma: I play a close-to-reality cop in ‘HER’; there is no scope for ‘Singham’ style of histrionics By www.thehindu.com Published On :: Tue, 18 Jul 2023 19:06:24 +0530 Ruhani Sharma talks about headlining the Telugu cop drama franchise ‘HER’, says she never imagined herself as a sharpshooter Full Article Movies io Director Sai Rajesh: ‘Baby’ has been a learning experience; henceforth I will be more cautious in my writing By www.thehindu.com Published On :: Wed, 19 Jul 2023 16:16:44 +0530 Sai Rajesh, the writer-director of the Telugu romantic drama ‘Baby’ that has been eliciting extreme responses, says he did not intend to make a toxic film Full Article Movies io NIA arrests man from Hyderabad in connection with terror module By www.thehindu.com Published On :: Wed, 02 Aug 2023 05:58:00 +0530 Full Article Telangana io Parental behaviour closely associated with adolescents’ excessive Internet use, finds NIMHANS study By www.thehindu.com Published On :: Sat, 12 Aug 2023 12:59:15 +0530 The study showed that decreased care and increased control from the mother, high autonomy from father and increased rejection from both parents as risk factors associated with adolescent internet excessive use Full Article Health io Chandrayaan-3 gets closer to Moon after fourth orbit reduction manoeuvre By www.thehindu.com Published On :: Mon, 14 Aug 2023 16:04:41 +0530 The manoeuvre was performed from ISRO Telemetry, Tracking and Command Network (ISTRAC) in Bengaluru. The spacecraft is now just 177 km away from the moon. Full Article Science io Govt to constitute high-level committee to monitor implementation of crop loan waiver, says Harish Rao By www.thehindu.com Published On :: Tue, 22 Aug 2023 07:44:04 +0530 CM announced unconditional crop loan waiver twice unlike other States, he said Full Article Telangana io Vennela Kishore to headline ‘Chaari 111’, a spy action comedy By www.thehindu.com Published On :: Wed, 23 Aug 2023 14:55:41 +0530 Telugu comedy actor Vennela Kishore to play the hero in director T.G. Keerthi Kumar’s spy action comedy ‘Chaari 111’ Full Article Movies io 69th National Film Awards: ‘RRR’, ‘Pushpa - The Rise’ lead as Telugu films grab 10 awards; Allu Arjun is best actor By www.thehindu.com Published On :: Thu, 24 Aug 2023 19:04:45 +0530 S.S. Rajamouli’s ‘RRR’ bagged six awards, followed by ‘Pushpa - The Rise’, ‘Uppena’ and ‘Konda Polam’ at the 69th National Film Awards. Allu Arjun won the award for best actor, while ‘RRR’ was declared the best popular film for providing wholesome entertainment Full Article Movies io How to serve a sadya in the traditional way By www.thehindu.com Published On :: Sat, 26 Aug 2023 14:59:06 +0530 Here is a quick guide to serving a traditional sadya for Onam. The sadya has several regional variations in Kerala. There are also differences in the way it is served and cooked Full Article Features io Pawan Kalyan’s ‘They call him OG’ promises to be a stylish action extravaganza By www.thehindu.com Published On :: Sat, 02 Sep 2023 11:59:30 +0530 The teaser of director Sujeeth and Pawan Kalyan’s ‘They call him OG’ reveals an action entertainer set in Mumbai Full Article Movies io An ongoing trunk show in Coimbatore showcases luxury fashion brands By www.thehindu.com Published On :: Tue, 05 Sep 2023 15:29:24 +0530 Leading design houses from across the country showcase their collections at an ongoing trunk show Full Article Metroplus io Venkatesh Maha: After three years, crowdfunding seemed the best option for ‘Marmaanuvu’ By www.thehindu.com Published On :: Thu, 07 Sep 2023 16:45:41 +0530 Director Venkatesh Maha talks about taking the crowdfunding route for his new Telugu film ‘Marmaanuvu’ asserting he will not let down the film-loving audience Full Article Movies io Decomposed body of woman found at construction site near Hyderabad By www.thehindu.com Published On :: Mon, 11 Sep 2023 06:52:56 +0530 Full Article Hyderabad io School Education Department issues safety directives ahead of monsoon By www.thehindu.com Published On :: Tue, 12 Sep 2023 21:44:40 +0530 School authorities told to stay alert and ensure that children do not go near the ponds or tanks in the area to play; electrical connections to be checked Full Article Chennai io Zonal misclassification: Government waives ₹240 crore property tax penalty levied by BBMP By www.thehindu.com Published On :: Fri, 15 Sep 2023 22:35:48 +0530 Penalty was levied for zonal misclassification while paying property tax online Full Article Bangalore io Elaborate arrangements made for Ganesh idol immersion in Hyderabad: KCR By www.thehindu.com Published On :: Thu, 28 Sep 2023 06:32:10 +0530 Full Article Telangana io First International Calligraphy Festival of Kerala under way in Kochi is a hit with enthusiasts and fine arts students By www.thehindu.com Published On :: Tue, 03 Oct 2023 19:56:15 +0530 Exhibition serves as an introduction to the potential of the art form which is gaining popularity among young artists in State Full Article Kochi io ‘Our goal was to bring intelligent conversations to Hyderabad’ By www.thehindu.com Published On :: Wed, 04 Oct 2023 08:18:45 +0530 Since 2005 Manthan as a platform succeeded in hosting 450 speakers in their monthly events, and about 65 speakers at the annual Samvaad Full Article Telangana io Why a cruise would be the best option for a memorable vacation? By www.thehindu.com Published On :: Sat, 14 Oct 2023 14:47:38 +0530 Post the pandemic, it is smooth sailing for cruising as an increasing number of Indians pack their bags to enjoy vacations on luxury liners Full Article Travel io How Bloom In Green festival is attempting to spread the message of community and conscious living By www.thehindu.com Published On :: Tue, 12 Dec 2023 14:47:14 +0530 Krishnagiri is set to host the fourth edition Bloom In Green festival from December 15 to 18 Full Article Music io Ministry of Tourism promotes lesser-known tourist attractions By www.thehindu.com Published On :: Sat, 13 Jan 2024 20:42:10 +0530 They include wetlands such as Sultanpur in Haryana, places of mythological significance such as Kurukshetra in Haryana, and cultural heritage sites such as Vijayawada in Andhra Pradesh Full Article India io Airports to ensure Digi Yatra registration is voluntary and consensual: Scindia By www.thehindu.com Published On :: Sat, 27 Jan 2024 13:29:20 +0530 The Aviation Minister’s comments followed complaints from passengers about forceful collection of personal data at airports Full Article India io Spanish woman gang rape case: Crimes against foreigners in India rarely result in convictions | Data By www.thehindu.com Published On :: Sat, 09 Mar 2024 09:30:00 +0530 Approximately, one in twenty rape cases in which victims are foreigners results in convictions Full Article Data io Destination Maldives: tourism undeterred amid diplomatic tussles By www.thehindu.com Published On :: Mon, 11 Mar 2024 17:30:01 +0530 With Manta Air launching a direct flight from Bengaluru to Dhaalu airport, and visa-free entry, it has become easier and cheaper to holiday in the Maldives. We find out how Indian travellers are responding Full Article Travel io Powered by powdery snow, Gulmarg is vying to become an international winter sports venue By www.thehindu.com Published On :: Sat, 16 Mar 2024 22:01:15 +0530 Indian Olympic Association is working on an international certification for the Gulmarg slopes, which are covered by the powdery snow needed for professional skiing Full Article India io Holiday bookings up this summer vacation, with some impact from upcoming Lok Sabha elections By www.thehindu.com Published On :: Thu, 28 Mar 2024 11:44:16 +0530 There is an increase of 30-40% in domestic travel, and 15% in international travel bookings Full Article Bengaluru io Experience diverse themes in photography in an exhibition in Andhra University By www.thehindu.com Published On :: Fri, 29 Mar 2024 13:29:17 +0530 A two-day exhibition by students of Diploma in Photography of Andhra University in Visakhapatnam unfolds diverse themes and creative vision Full Article Life & Style io These 10 new travel books are a wonderful way to immerse yourself in a destination By www.thehindu.com Published On :: Fri, 12 Apr 2024 10:00:02 +0530 From the wildernesses of India to the adventures of an early historical feminist, here’s a selection of recent titles Full Article Books io Chasing a sunrise | When you are on vacation without a moment to relax By www.thehindu.com Published On :: Fri, 12 Apr 2024 13:52:04 +0530 In an age of social media, bombarded by the glossy feed of travel bloggers, the fear of missing out is far more acute Full Article Society io The charm of the 80s school vacation By www.thehindu.com Published On :: Fri, 12 Apr 2024 13:52:40 +0530 Looking back at a childhood without gadgets and the endless triumph of imagination over possession Full Article Society io Summer of 2024 | Travel edition By www.thehindu.com Published On :: Fri, 12 Apr 2024 16:52:09 +0530 The Magazine’s special edition addresses everything from the realities of tourism in the middle of a heatwave and the plight of our once pristine hill stations, to 10 new travel books and unplanned holidays with the kids Full Article Travel io The travel trend for 2024: Destination Dupes By www.thehindu.com Published On :: Fri, 03 May 2024 15:11:53 +0530 Skip popular tourist hotspots for lesser known travel destinations that are unexpected, more affordable and every bit as delightful for an unforgettable holiday minus the crowds Full Article Life & Style io Flight cancellations affected 1.5 lakh people since December 2023: Data By www.thehindu.com Published On :: Fri, 31 May 2024 08:00:00 +0530 After the COVID-19 lockdowns and jet fuel hikes, aviation firms are now grappling with crew troubles Full Article Data io Fancy an AI-powered vacation in Dubai? By www.thehindu.com Published On :: Fri, 07 Jun 2024 15:37:12 +0530 From courteous robots to generative AI art; Dubai’s determinedly futuristic landscape makes for a transformative holiday destination Full Article Travel io Tourism authorities yet to explore ways to promote ecotourism destinations in Kozhikode By www.thehindu.com Published On :: Sun, 09 Jun 2024 23:07:37 +0530 Monsoon tourism packages such as rain walks and guided trips have not been announced for tourists here despite their popularity in ecotourism destinations outside the State. Full Article Kozhikode io Scholars, historians on a mission to illuminate Srikakulam’s forgotten heritage By www.thehindu.com Published On :: Sat, 22 Jun 2024 07:47:25 +0530 While Buddhist structures in Dantapuri near Amadalavalasa have suffered damage, the Salihundam structure near Gara remains largely in good shape, thanks to initiatives taken by the Archaeological Survey of India and Tourism department Full Article Andhra Pradesh io Katra Marriott Resort & Spa: A luxurious escape near Vaishno Devi shrine By www.thehindu.com Published On :: Sat, 22 Jun 2024 11:09:50 +0530 Marriott hotel’s 150th location in India comes with bunk beds in family rooms, a 24×7 wellness centre, a fully equipped spa and scrumptious local delights. Full Article Travel io A Chennai-based medical practitioner’s coffee table book captures the Himalayas across the seasons and terrains over two decades By www.thehindu.com Published On :: Sat, 06 Jul 2024 15:41:14 +0530 How life changing is the Himalayan range? Dr Periyathiruvadi, a Chennai-based medical practitioner and founder of Lister Metropolis, has curated a coffee table book of photos from the mountains to answer this question Full Article Books io Why you should ditch touristy holiday destinations for Sibu — Malaysia’s quaint city on Borneo Island By www.thehindu.com Published On :: Thu, 11 Jul 2024 14:43:48 +0530 Nearly 60 kilometres from the South China Sea, this city in Borneo offers a variety of traditional cuisines Full Article Travel «1..2..339933 934 935..1013..1350..1687..2024..2361..2698..30353364» Recent Trending The Finish Line: EPS Vs. Polyisocyanurate Insulation The Finish Line: EIFS Inspection The Finish Line: Right Solutions for the Right Problems Will Synthetic Biology Save the World? Anti-LEED Legislation The Greenest Low Slope Roofing Solution Only 12 per cent of leading charities publicly recognise a trade union, analysis suggests Next chair of the National Lottery Community Fund revealed SIA Releases New Version of OSDP Standard Panasonic's Security Solutions Start With Energy-Efficient Products Incomplete information can fuel misjudgment: study FHWA rule updates protections for workers and drivers in work zones The First Sealer to Give a Beautiful, Luxurious Appearance Bellingham: A New Wool Collection from Karastan Metallika blends beauty and function Subscribe To Our Newsletter
io aspect-ratio By www.quirksmode.org Published On :: Wed, 19 May 2021 11:35:27 +0100 This week we’ll take a look at the new aspect-ratio declaration and its use. Una Kravets wrote the introductory article, but there are some additional technical points to be made. I also wrote a little fallback that you might use if you need aspect-ratio right now. At the time of writing aspect-ratio is supported by Chrome 90, by Safari Technology Preview, and by Firefox 88 if you set the aspect-ratio flag in about:config. You need one of these browsers to see the examples below — except for the fallback, which should work in all browsers that support custom properties. Weak declaration aspect-ratio defines the ratio between the width and height of a box, but it is a weak declaration. If the box has a specified width and height the browser uses those values and ignores the aspect ratio. Width and height might be specified by explicit width and height declarations or by other means, as we’ll see below. aspect-ratio In this example all three boxes have aspect-ratio: 16/9. The first box has width: auto; height: auto; i.e. as much width as you can take, and as little height as you need. aspect-ratio takes the width, converts it to pixels, and applies the defined aspect ratio to calculate the height. The second box has a height: 50px; width: auto. The height is strong, but the auto width is weak and allows aspect-ratio to override it. Thus the box’s width is calculated by taking the height and applying the aspect ratio. The third box has a fixed width: 150px; height: 100px as well as an aspect-ratio: 16/9. Now both width and height are strong and the aspect ratio is ignored. Rounding Even if aspect-ratio works fine the browser must find an integer number of device pixels for the box’s width and height. Fractions are discarded somewhere along the way. That’s why the calculated aspect ratio of a box is rarely 100% exact. In the examples you’ll often see a narrow stripe of red poking from underneath the background image. That image has the same aspect ratio as the box it appears in, but apparently uses a different calculation. In normal circumstances these tiny differences are not visible to the naked eye, so you can safely ignore them. Fat red stripes, such as in the last box in the first example, are a sign of trouble, though. min- and max-width and -height grid aspect-ratio and min- and max-height You can set a min/max-width/height on the boxes. These are obeyed as normal, and aspect-ratio is obeyed as well. In this example the first box has a min-height: 100px, the second a max-height: 50px, and the third min-width: 100px. As you see they stretch up or down to their defined maximum and minimum and retain their aspect-ratio. box-sizing: border-box! Now we come to a trickier topic unearthed originally by Ana Tudor — and this entire article is a good read that I recommend. If it works, aspect-ratio sets either the width or the height of a box to match the other side and the defined aspect ratio. However, the exact effect depends on how width and height are defined; on box-sizing, in other words. width may mean either the content width, without padding and border (box-sizing: content-box; the default), or the width of content + padding + border (box-sizing: border-box). In general, the latter is what we want. aspect-ratio and box-sizing In the next example the boxes have padding: 10%. Percentual padding is always calculated relative to the width of the parent element. Thus this box has a padding of 10% of its parent element’s width, even at the top and the bottom. Since the padding is equal on all four sides, it may break the box’s aspect ratio. This depends on box-sizing. If you use the default box-sizing: content-box the width and height have the correct aspect ratio, but they define only the content area. An equal amoung of padding is added on all sides, and the aspect ratio is destroyed. This problem is easy to solve: set box-sizing: border-box. Now width and height define the content, padding, and border combined, and this entire area is given the correct aspect ratio. Thus the padding is seamlessly integrated with the proper aspect ratio. In fact, you should always set box-sizing: border-box in all your sites. content-box was a mistake, as W3C itself admitted (and as I said back in 2002). The fact that it fixes aspect-ratio merely gives us an extra reason to do so. aapect-ratio in flexbox In a flex or grid context, aspect-ratio can appear not to work. In fact, running into these problems was what caused me to write this article in the first place. Look at the example below. It doesn’t work! Oh noesies! What’s going on? flex aspect-ratio What happens here is default flexbox behaviour. First the widths of the items are calculated (here from flex-basis: 30%; grow: 1), and once that’s done the height of all items is set. These heights are calculated by applying their aspect ratio, but the tallest box is used to set the height of all items in the row. In our example that is the 1/1 box, so the 16/9 and 4/3 boxes also have an aspect ratio of 1/1. This default behaviour is ruled by align-items: stretch, which is part of the flexbox default. If you use any other value the boxes’ height is set to auto and they take their proper aspect ratio. flex-start is the most obvious choice, but see CSS Tricks’ great flexbox guide for more options. flex aspect-ratio and align-items If for some reason you want to overrule the height stretch on only a single item you can give that item either align-self: flex-start or any other value, or height: min-content. Both work fine. The third box in the next example has height: min-content. flex aspect-ratio and height: min-content aspect-ratio and grid In a grid context aspect-ratio encounters the same problems as in a flexbox environment, only with added browser bugs that I wrote about last week. I expected the same behaviour as in a flexbox context, but that’s not entirely what’s happening. The good news is that align-items, align-self, and height: min-content all work exactly as with flexbox. They negate the default grid behaviour of stretching the height of all elements in a row to the height of the highest element. grid aspect-ratio and align-items The problems are in the default rendering of aspect-ratio. Chrome and Safari implement this in one incorrect way, and Firefox is a quite different, equally incorrect way. If all boxes in the example below have the same width and height the bugs have been solved. They get the same height for the reasons I explained under flexbox — grid works the same in this respect (I hope). grid aspect-ratio with browser bugs Firefox obeys the aspect-ratio while I think it shouldn’t. Instead, like in the flexbox example, it should stretch the boxes to the height of the highest in the row. In addition it calculates the height of the entire grid by assuming its items have the minimum height needed for their content — and since my example boxes do not have any content that height is 0. Thus the grid container is way too small. Both are clearly bugs that will probably be fixed soon. Chrome and Safari TP size the grid container correctly, but seem to take the height as reference and size the width accordingly instead of taking the width as reference and sizing the height. Thus the 16/9 and 4/3 items become way too wide. I think this is also a bug — if it isn’t someone will have to carefully explain to me what’s going on. Fortunately this bug goes away if you use align-items — which you’re going to want to do in any case. A fallback (After writing this fallback I found that Ana Tudor wrote pretty much the same one in her article. I mean, why do I even bother competing with scarily smart people like her? But I came by it independently, honest.) 5/1 3/1 16/9 4/3 9/16 Since browser support isn’t quite there yet we need to continue to use the old padding-top trick as a fallback, as I do in this paragraph. It is supposed to have an aspect ratio even in browsers that do not support aspect-ratio. The core of the fallback is the following CSS. Fair warning: this solution is only lightly tested; I went from conception to successful execution in about 30 minutes — though I spent 90 more minutes on a custom property issue. The extra <span> is ugly, but I don’t see a way around it. If your aspect-ratioed boxes do not contain text you can leave it out. <p class="test"><span>The text</span></p> p.test { --aspectRatio: 16/9; --padding: 0.5em; border: 1px solid; padding: var(--padding); aspect-ratio: var(--aspectRatio); box-sizing: border-box; } @supports not (aspect-ratio: 16/9) { p.test { padding: 0; padding-top: calc((1 / (var(--aspectRatio)))*100%); position: relative; } p.test > span { display: block; position: absolute; top: var(--padding); left: var(--padding); } } Store the desired aspect ratio in --aspectRatio. Set aspect-ratio to that value. If the browser doesn’t support aspect-ratio, set the padding-top to 1 / the aspect ratio as a percentage. The script that runs in this page changes the value of --aspectRatio. The trick here is that percentual padding is calculated relative to the parent element’s width. If the box spans its parent’s entire width, you can take that width, multiply it by 1 divided by the aspect ratio (so for instance 9/16th when the aspect ratio is 16/9) and convert the result to a percentage. Now the padding stretches the box to the desired aspect ratio. If the box has any real content we have to wrap it in an extra HTML element and give that element position: absolute so that it does not influence the box’s height. Then we place it in the box, with a top and left coordinate equal to the box’s padding. Now the text appears to flow naturally. You don’t need this trick if the box only has a background image or gradient; those ignore padding anyway. Or you can wait a few months until all browsers support aspect-ratio. It won’t be long now. I may write a separate article about the incredible number of brackets we need in the padding-top line. Full Article CSS for JavaScripters
io position: sticky, draft 1 By www.quirksmode.org Published On :: Wed, 08 Sep 2021 18:44:23 +0100 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. Full Article CSS for JavaScripters
io Nirdiganta: A first-of-its-kind incubation centre for theatre By www.thehindu.com Published On :: Fri, 14 Jul 2023 11:42:03 +0530 Actor Prakash Raj’s innovative incubator for theatre and arts offers a comprehensive production process, stipends for actors/techs, lodging, kitchen and tech support. It also plans to promote fine arts and film in the future. Full Article Metroplus
io Prakash Raj on creating ‘Nirdiganta’, an incubation centre for theatre, and getting back on stage By www.thehindu.com Published On :: Fri, 14 Jul 2023 11:55:55 +0530 Actor Prakash Raj says fans will soon get to see him perform live on stage Full Article Metroplus
io Ruhani Sharma: I play a close-to-reality cop in ‘HER’; there is no scope for ‘Singham’ style of histrionics By www.thehindu.com Published On :: Tue, 18 Jul 2023 19:06:24 +0530 Ruhani Sharma talks about headlining the Telugu cop drama franchise ‘HER’, says she never imagined herself as a sharpshooter Full Article Movies
io Director Sai Rajesh: ‘Baby’ has been a learning experience; henceforth I will be more cautious in my writing By www.thehindu.com Published On :: Wed, 19 Jul 2023 16:16:44 +0530 Sai Rajesh, the writer-director of the Telugu romantic drama ‘Baby’ that has been eliciting extreme responses, says he did not intend to make a toxic film Full Article Movies
io NIA arrests man from Hyderabad in connection with terror module By www.thehindu.com Published On :: Wed, 02 Aug 2023 05:58:00 +0530 Full Article Telangana
io Parental behaviour closely associated with adolescents’ excessive Internet use, finds NIMHANS study By www.thehindu.com Published On :: Sat, 12 Aug 2023 12:59:15 +0530 The study showed that decreased care and increased control from the mother, high autonomy from father and increased rejection from both parents as risk factors associated with adolescent internet excessive use Full Article Health
io Chandrayaan-3 gets closer to Moon after fourth orbit reduction manoeuvre By www.thehindu.com Published On :: Mon, 14 Aug 2023 16:04:41 +0530 The manoeuvre was performed from ISRO Telemetry, Tracking and Command Network (ISTRAC) in Bengaluru. The spacecraft is now just 177 km away from the moon. Full Article Science
io Govt to constitute high-level committee to monitor implementation of crop loan waiver, says Harish Rao By www.thehindu.com Published On :: Tue, 22 Aug 2023 07:44:04 +0530 CM announced unconditional crop loan waiver twice unlike other States, he said Full Article Telangana
io Vennela Kishore to headline ‘Chaari 111’, a spy action comedy By www.thehindu.com Published On :: Wed, 23 Aug 2023 14:55:41 +0530 Telugu comedy actor Vennela Kishore to play the hero in director T.G. Keerthi Kumar’s spy action comedy ‘Chaari 111’ Full Article Movies
io 69th National Film Awards: ‘RRR’, ‘Pushpa - The Rise’ lead as Telugu films grab 10 awards; Allu Arjun is best actor By www.thehindu.com Published On :: Thu, 24 Aug 2023 19:04:45 +0530 S.S. Rajamouli’s ‘RRR’ bagged six awards, followed by ‘Pushpa - The Rise’, ‘Uppena’ and ‘Konda Polam’ at the 69th National Film Awards. Allu Arjun won the award for best actor, while ‘RRR’ was declared the best popular film for providing wholesome entertainment Full Article Movies
io How to serve a sadya in the traditional way By www.thehindu.com Published On :: Sat, 26 Aug 2023 14:59:06 +0530 Here is a quick guide to serving a traditional sadya for Onam. The sadya has several regional variations in Kerala. There are also differences in the way it is served and cooked Full Article Features
io Pawan Kalyan’s ‘They call him OG’ promises to be a stylish action extravaganza By www.thehindu.com Published On :: Sat, 02 Sep 2023 11:59:30 +0530 The teaser of director Sujeeth and Pawan Kalyan’s ‘They call him OG’ reveals an action entertainer set in Mumbai Full Article Movies
io An ongoing trunk show in Coimbatore showcases luxury fashion brands By www.thehindu.com Published On :: Tue, 05 Sep 2023 15:29:24 +0530 Leading design houses from across the country showcase their collections at an ongoing trunk show Full Article Metroplus
io Venkatesh Maha: After three years, crowdfunding seemed the best option for ‘Marmaanuvu’ By www.thehindu.com Published On :: Thu, 07 Sep 2023 16:45:41 +0530 Director Venkatesh Maha talks about taking the crowdfunding route for his new Telugu film ‘Marmaanuvu’ asserting he will not let down the film-loving audience Full Article Movies
io Decomposed body of woman found at construction site near Hyderabad By www.thehindu.com Published On :: Mon, 11 Sep 2023 06:52:56 +0530 Full Article Hyderabad
io School Education Department issues safety directives ahead of monsoon By www.thehindu.com Published On :: Tue, 12 Sep 2023 21:44:40 +0530 School authorities told to stay alert and ensure that children do not go near the ponds or tanks in the area to play; electrical connections to be checked Full Article Chennai
io Zonal misclassification: Government waives ₹240 crore property tax penalty levied by BBMP By www.thehindu.com Published On :: Fri, 15 Sep 2023 22:35:48 +0530 Penalty was levied for zonal misclassification while paying property tax online Full Article Bangalore
io Elaborate arrangements made for Ganesh idol immersion in Hyderabad: KCR By www.thehindu.com Published On :: Thu, 28 Sep 2023 06:32:10 +0530 Full Article Telangana
io First International Calligraphy Festival of Kerala under way in Kochi is a hit with enthusiasts and fine arts students By www.thehindu.com Published On :: Tue, 03 Oct 2023 19:56:15 +0530 Exhibition serves as an introduction to the potential of the art form which is gaining popularity among young artists in State Full Article Kochi
io ‘Our goal was to bring intelligent conversations to Hyderabad’ By www.thehindu.com Published On :: Wed, 04 Oct 2023 08:18:45 +0530 Since 2005 Manthan as a platform succeeded in hosting 450 speakers in their monthly events, and about 65 speakers at the annual Samvaad Full Article Telangana
io Why a cruise would be the best option for a memorable vacation? By www.thehindu.com Published On :: Sat, 14 Oct 2023 14:47:38 +0530 Post the pandemic, it is smooth sailing for cruising as an increasing number of Indians pack their bags to enjoy vacations on luxury liners Full Article Travel
io How Bloom In Green festival is attempting to spread the message of community and conscious living By www.thehindu.com Published On :: Tue, 12 Dec 2023 14:47:14 +0530 Krishnagiri is set to host the fourth edition Bloom In Green festival from December 15 to 18 Full Article Music
io Ministry of Tourism promotes lesser-known tourist attractions By www.thehindu.com Published On :: Sat, 13 Jan 2024 20:42:10 +0530 They include wetlands such as Sultanpur in Haryana, places of mythological significance such as Kurukshetra in Haryana, and cultural heritage sites such as Vijayawada in Andhra Pradesh Full Article India
io Airports to ensure Digi Yatra registration is voluntary and consensual: Scindia By www.thehindu.com Published On :: Sat, 27 Jan 2024 13:29:20 +0530 The Aviation Minister’s comments followed complaints from passengers about forceful collection of personal data at airports Full Article India
io Spanish woman gang rape case: Crimes against foreigners in India rarely result in convictions | Data By www.thehindu.com Published On :: Sat, 09 Mar 2024 09:30:00 +0530 Approximately, one in twenty rape cases in which victims are foreigners results in convictions Full Article Data
io Destination Maldives: tourism undeterred amid diplomatic tussles By www.thehindu.com Published On :: Mon, 11 Mar 2024 17:30:01 +0530 With Manta Air launching a direct flight from Bengaluru to Dhaalu airport, and visa-free entry, it has become easier and cheaper to holiday in the Maldives. We find out how Indian travellers are responding Full Article Travel
io Powered by powdery snow, Gulmarg is vying to become an international winter sports venue By www.thehindu.com Published On :: Sat, 16 Mar 2024 22:01:15 +0530 Indian Olympic Association is working on an international certification for the Gulmarg slopes, which are covered by the powdery snow needed for professional skiing Full Article India
io Holiday bookings up this summer vacation, with some impact from upcoming Lok Sabha elections By www.thehindu.com Published On :: Thu, 28 Mar 2024 11:44:16 +0530 There is an increase of 30-40% in domestic travel, and 15% in international travel bookings Full Article Bengaluru
io Experience diverse themes in photography in an exhibition in Andhra University By www.thehindu.com Published On :: Fri, 29 Mar 2024 13:29:17 +0530 A two-day exhibition by students of Diploma in Photography of Andhra University in Visakhapatnam unfolds diverse themes and creative vision Full Article Life & Style
io These 10 new travel books are a wonderful way to immerse yourself in a destination By www.thehindu.com Published On :: Fri, 12 Apr 2024 10:00:02 +0530 From the wildernesses of India to the adventures of an early historical feminist, here’s a selection of recent titles Full Article Books
io Chasing a sunrise | When you are on vacation without a moment to relax By www.thehindu.com Published On :: Fri, 12 Apr 2024 13:52:04 +0530 In an age of social media, bombarded by the glossy feed of travel bloggers, the fear of missing out is far more acute Full Article Society
io The charm of the 80s school vacation By www.thehindu.com Published On :: Fri, 12 Apr 2024 13:52:40 +0530 Looking back at a childhood without gadgets and the endless triumph of imagination over possession Full Article Society
io Summer of 2024 | Travel edition By www.thehindu.com Published On :: Fri, 12 Apr 2024 16:52:09 +0530 The Magazine’s special edition addresses everything from the realities of tourism in the middle of a heatwave and the plight of our once pristine hill stations, to 10 new travel books and unplanned holidays with the kids Full Article Travel
io The travel trend for 2024: Destination Dupes By www.thehindu.com Published On :: Fri, 03 May 2024 15:11:53 +0530 Skip popular tourist hotspots for lesser known travel destinations that are unexpected, more affordable and every bit as delightful for an unforgettable holiday minus the crowds Full Article Life & Style
io Flight cancellations affected 1.5 lakh people since December 2023: Data By www.thehindu.com Published On :: Fri, 31 May 2024 08:00:00 +0530 After the COVID-19 lockdowns and jet fuel hikes, aviation firms are now grappling with crew troubles Full Article Data
io Fancy an AI-powered vacation in Dubai? By www.thehindu.com Published On :: Fri, 07 Jun 2024 15:37:12 +0530 From courteous robots to generative AI art; Dubai’s determinedly futuristic landscape makes for a transformative holiday destination Full Article Travel
io Tourism authorities yet to explore ways to promote ecotourism destinations in Kozhikode By www.thehindu.com Published On :: Sun, 09 Jun 2024 23:07:37 +0530 Monsoon tourism packages such as rain walks and guided trips have not been announced for tourists here despite their popularity in ecotourism destinations outside the State. Full Article Kozhikode
io Scholars, historians on a mission to illuminate Srikakulam’s forgotten heritage By www.thehindu.com Published On :: Sat, 22 Jun 2024 07:47:25 +0530 While Buddhist structures in Dantapuri near Amadalavalasa have suffered damage, the Salihundam structure near Gara remains largely in good shape, thanks to initiatives taken by the Archaeological Survey of India and Tourism department Full Article Andhra Pradesh
io Katra Marriott Resort & Spa: A luxurious escape near Vaishno Devi shrine By www.thehindu.com Published On :: Sat, 22 Jun 2024 11:09:50 +0530 Marriott hotel’s 150th location in India comes with bunk beds in family rooms, a 24×7 wellness centre, a fully equipped spa and scrumptious local delights. Full Article Travel
io A Chennai-based medical practitioner’s coffee table book captures the Himalayas across the seasons and terrains over two decades By www.thehindu.com Published On :: Sat, 06 Jul 2024 15:41:14 +0530 How life changing is the Himalayan range? Dr Periyathiruvadi, a Chennai-based medical practitioner and founder of Lister Metropolis, has curated a coffee table book of photos from the mountains to answer this question Full Article Books
io Why you should ditch touristy holiday destinations for Sibu — Malaysia’s quaint city on Borneo Island By www.thehindu.com Published On :: Thu, 11 Jul 2024 14:43:48 +0530 Nearly 60 kilometres from the South China Sea, this city in Borneo offers a variety of traditional cuisines Full Article Travel