Technology News

Inline Styles as Classes (lol)

If you’re abhorred by using inline styles, just move that style to the class attribute! And then make sure you have CSS in place that, ya know, does what it says on the box.

OK lemme dig in and totally ruin the joke.

  • First off, it’s a joke, so don’t actually do this. I don’t even mind the occasional inline style for one-off stuff, but this is not that.
  • To me the weirdest part is that period (.) character. Escaping the more unusual characters with a backslash () feels normal, but what is that period about? UPDATE: It’s because of the space. It’s two classes in the HTML, not one. Derp.
  • The little period trick there doesn’t work when the following character is a number (e.g. .padding:.1rem;). UPDATE: Because classes that start with a number are invalid. Derp.
  • You can avoid the escaping and trickery if you go with an attribute selector like [class*="display: flex;"].
  • This reminds me of Mathias Bynens’ research: CSS character escape sequences. But… that doesn’t seem to work anymore? I wonder if browsers changed or if the tool broke and doesn’t output what it should anymore (e.g. does .color3A #f06d06 look right?).

Here’s all that playing around:

Biden says Putin “knows there are consequences” if cyberattacks continue
The problem with Facebook’s attempt to be more like Nextdoor

Related Articles

The Biggest Web Design Mistakes to Avoid

the-biggest-web-design-mistakes-to-avoid
Chances are, if you don’t like a company’s website, you’re not going to stay on it for very long. Constant disruptive pop-ups? Annoying. Wonky navigation bar? Forget it. Even the…

How To Boost B2B Sales Using Content Marketing

how-to-boost-b2b-sales-using-content-marketing
Are you wondering whether content marketing is the right strategy from a B2B perspective? You might question whether content marketing can efficiently reach your best prospects and create sales for…

Key Points On Understanding The GST Number

key-points-on-understanding-the-gst-number
Understanding-The-GST-Number In India, indirect Taxes have driven businesses. Such taxes are leading to remodelling and restructuring of major business systems and operations expecting a change in the involved taxes and…