Using Sibling Selectors to Style the Element Before the Match

The original question for the below answer was wanting to hide a link when a button that’s next to the link has a “selected” class. This is interesting because this requires a sibling selector, but sibling selectors in CSS are a bit funky… with a sibling selector, the target element is always _subsequent_. That meansContinue reading “Using Sibling Selectors to Style the Element Before the Match”

CSS Clamp: The Goldilocks of CSS Math Functions

There is a problem I have wrestled with a couple of times, which was frustrating to solve… but can now be easily solved using clamp, which is currently in an Editors Draft of the CSS Values and Units Module Level 4 specification. It is sat alongside similar mathmatical CSS nuggets, such as min and maxContinue reading “CSS Clamp: The Goldilocks of CSS Math Functions”

Fixing CSS object-fit for Internet Explorer

A common problem with images, especially if they are user-generated, is that they don’t have the correct aspect ratio for their intended purpose. Also, as we re-flow pages for many different devices, we often want the image to work with different aspect ratios. This is where the CSS object-fit property comes in very useful. ThereContinue reading “Fixing CSS object-fit for Internet Explorer”

Minification Failed. Returning Unminified Contents.

Has you ASP.NET applicaiton reported that minification failed? If you are using bundles in application, you might come across this exception comment at the top of your larger-than-expected bundle file. /* Minification failed. Returning unminified contents. (List of problems here) */ It can happen for JavaScript or CSS, but it means minifier has found somethingContinue reading “Minification Failed. Returning Unminified Contents.”

Generate Multiple Themes From the Same LESS File

So you have a CSS theme written using LESS. A simple example would be like the example below… you’ve extracted your variables into a file named “variables.less” and you use an import to make those variables available to your main stylesheet. If you decide to change something important, you can do that in the variablesContinue reading “Generate Multiple Themes From the Same LESS File”