Embracing a CSS Defense Strategy

Exploring the new tools and techniques on frontend development. Loves to meet up with new people and participate in the community. I do interesting stuff on codepen https://codepen.io/nirazanbasnet
Search for a command to run...

Exploring the new tools and techniques on frontend development. Loves to meet up with new people and participate in the community. I do interesting stuff on codepen https://codepen.io/nirazanbasnet
No comments yet. Be the first to comment.
A few months ago, my product manager dropped something in the team channel. "We are adding an AI agent to the platform next quarter. It will handle follow-ups automatically." Just like that. One messa

f you’re diving into React, you’ve likely come across the ‎useRef hook. But what exactly is ‎useRef(), and how can it make your life easier? In this post we’ll cover what ‎useRef is, walk through five

A bug that only happens for some users, that you can never reproduce, that isn't in your code. Welcome to the React + browser-translation crash — what causes it, why it's so sneaky, and the battle-tested one-file fix.

Upgrading a core production database is usually the stuff of dev nightmares. It often involves maintenance windows, scheduled downtime, and the looming fear of a botched migration. But what if you cou

We are moving into products that adapt, predict and react with real context. Designing only interfaces is not enough anymore. We are designing experiences that understand the user. Designers and digital agencies are now challenged to move beyond trad...

Engineering at JoBins
167 posts
Welcome to Engineering at JoBins — where we share the stories, insights, and lessons from building a world-class hiring platform. From system design and scalability to developer tools and team culture, our engineers write about the real challenges we solve every day. Whether you're a curious developer or a fellow builder, we hope our experiences inspire and inform your own engineering journey.
Hey there, CSS enthusiasts! But before we get all serious with the blog, let's take a moment for a CSS meme break. 🎉

In today's blog, we're going to chat about something we've all encountered in our coding adventures: defending ourselves against those tricky CSS issues and gearing up for the future. Also, we explore ways to tackle CSS challenges with tips and tricks 🍕💻
Provide the ability to control layout through logical, rather than physical, direction, and dimension mappings.
Normal Approach

With Logical Approach - How it works



<section>
<div class="section-header">
<h2>Latest articles</h2>
<a href="/articles">See all</a>
</div>
</section>
.section-header {
display: flex;
justify-content: space-between;
}
.section-header:has(> a) {
align-items: center;
border-bottom: 1px solid;
padding-bottom: 1rem;
}

ol {
list-style-type: upper-alpha;
color: darkblue;
}
/* stylelint-disable-next-line selector-pseudo-class-no-unknown */
:is(ol, ul, menu:unsupported) :is(ol, ul) {
color: green;
}
:is(ol, ul) :is(ol, ul) ol {
list-style-type: lower-greek;
color: chocolate;
}
Comparison between :is() & :where()



The difference between :where() and :is() is that :where() always has 0 specificity
One way of sizing an element depends on its content size and using fixed values for the width or height of an element.
Min Content

Max Content

Fit Content
<h2>A heading, block-element, with a fit content property</h2>
h2 {
width: fit-content;
}
Avoid a certain CSS issue or behavior from happening.


To solve such problems use text-overflow: ellipsis property

Ever experienced that moment when you open a modal, start scrolling, and suddenly find yourself scrolling the content underneath the modal (aka the body element) once you reach the end? That, my friend, is what we call scroll chaining.

flex, flex-col & overflow for dynamic height

We can solve the issue by Use position: sticky property.

position: fixed
A better approach using max-width: inherit

Note - Just do not use
leftandrightproperty
Using :empty selector

Using @media (hover: hover)

the hover style will only work when the user is using a tool device like a mouse or a trackpad.

:focus-within Pseudo-Class
:not SelectorThis pseudo-class functions by excluding elements that don't match a specific selector. For instance, it proves handy when you want to verify if an item is the last one and, if so, remove the border.

Justify-Content: Space-Between
When the number of items is less than four, here is what will happen.


After using the scrollbar-gutter property.


In a nutshell, coding like a pro in CSS is all about staying in the loop! Keep tabs on the latest features and specs, dive into articles on best practices, and make friends with MDN web docs for handy references. Don't shy away from peeking into others' code on platforms like Codepen and Awwwards for some cool insights.
Oh, and don't forget to embrace your inner explorer so, hop on the CSS adventure and let your coding journey shine! 🚀
Keep on Hacking, Cheers.