When I started at my job, we where two front-end developers at my team. It was me and a senior front-end developer. Then the senior front-end developer quit his job, I was the only front-end developer at my team. And it was fine. I did my job, and there was no harm. We had some job interviews, but we did not meet the right fit. The time went by, and then it hit me: I was the only one knowing anything about our front-end. The bus factor was at one, which is not a good number in this case. Why? If I get hit by a bus, the project will be in a bad situation.
I then talked to my boss, and we came to the agreement, that we all should be responsible for the front-end. The work could be done in pair programming. At least until we would find the right match. I thought that was a great idea. I had a total burnt out from working alone on the front-end.
We then presented the idea, and the first reacting was fear from the other developers. The fear was mostly concerned about CSS.
HTML and CSS is for losers π We should all use Microsoft Word.
β Steffen π€ (@mrsteffenp) June 8, 2019
Why do developers fear CSS?
I talked to the other developers about why they fear CSS. The first thing brought up was cascading π΅ What if they make changes to one class, that will effect five hundred other elements?
The next thing brought up was support of browsers π» What if they implement something, that isn't supported in some browsers?
The final thing was building something from the ground up π‘ What if they make something, that isn't solid and doesn't look good?
Cascading π΅
This is one of the biggest fears. When other developers are talking about this, I guess they are talking about many things. It is both importance, specificity, source order and how properties inherit from different rules. The styling can be specified in many different places, and it can interact in complex ways. This is why CSS is so powerful, but it is also the reason why, it can be confusing and difficult. The cascading can be a devilish thing, if you donβt know the rules of how selectors can overrule other selectors π
Importance
This is a well talked subject. We all know, that it is (in most cases) bad to use this little helper. This is because !important will always win π
Specificity
Specificity is basically a measure of how specific a selector is. Like, inline styling is the most specific, then #id, then .class, and then the element. From there, the specificity can be measured in a million different ways. If you have doubts, you can use a specificity calculator.
Source order
Source order is basically that later rules will win over earlier rules. If you write a selector with a property and a value, and then later on write the same selector with the same property - but with a different value. What will then happen? π€
Inheritance
Inheritance in CSS is both simple and tricky. It can be explained in this way: Some property values applied to an element will be inherited by the element's children, and some won't. Doesn't that sound great? π΅ CSS properties like font-size and color do inherit, and properties like margin and padding donβt inherit. I guess that you will have to use common sense in this one. If margin would be inherited, it would cause a huge mess! You could use MDN as reference.
Browser support π»
Unless your client is a company that only support Internet Explorer 6, you shouldnβt worry that much. Most users are using modern browsers with great support of CSS. If you feel insecure whether you should use a specific property, then you can check it out at caniuse. If a browser doesn't support the property, but you really want to use it, then most browsers @supports the CSS at-rule of the same name. Then you can make a fallback solution.
@supports (display: grid) {
div {
display: grid;
}
}
Building something from the ground up π‘
This is mostly about the communication between designers and developers. The communication is not always that great. Sometimes the ambitions of the designers can be too high in relation to the company's wallet and the developers' skills - or what is actually possible.
The point is, that we as developers should be more integrated in the design process, so we all can fell comfortable with the outcome. With that being said, if the developer feels comfortable with the design, then it will be easier building it from the ground up.
I hope this wasn't a bunch of nonsense. I just really want to tell other developers, that doesn't work with CSS on a daily basis, that CSS isn't magic β¨
Thank you for your time!
If you liked this, then please β€οΈ and follow me on Twitter.
Latest comments (54)
it's about time before we see another system to replace it..
I see CSS much alike iptables rules.
Actually, the main problem of CSS is the metodologies we use to develop. They force us to do mistakes and technical debt. Over the time, anything becomes unmaintainable. That's where the functional CSS shines all over you minid.net/2019/04/07/the-css-utili...
CSS is magic and I love it. but it's not rocket science.
This is a lovely read Steffen. Thanks for it.
As someone who has been kept away/kept myself away from CSS, can vouch for both how easy and how important it is to understand stuff like specificity/cascading after building something from scratch with plain grids and mental models of the concepts above.
Good job :)
Man, I feel like the opposite, with design Since I don't have someone handing me a design, coming up with or thinking of one is hard. I'm comfortable with very basic designs, and those will get the job done, but they don't really stand out.
I guess it's a weakness I hope to shore up. But, I often feel caught between where to spend my time. Learn more design oriented skills, or more programming oriented skills. Never enough time in the day, I suppose. It sucks.
dev.to/katsanos_george/the-real-re...
The biggest fear comes from the fact that debugging or troubleshooting isn't easy with CSS especially when complex layouts and things like floats and transformations are involved.
Add to that the fact that you can have responsiveness, various levels of styling (external sheets,
<style>tag, element property) and browsers can also have subtle differences in rendering, it easily gets mind numbing!Front-end debugging with html/css is still an evolving science compared to back-end debugging which is quite straightforward in comparison.
This certainly was worth the read. Very true, especially the part about changing something somewhere an it affecting many other parts. Even though I had these fears, I really couldn't have put them into words as you've done. I just use frameworks and learn enough to do what I want that those frameworks I use don't do.
Now I know what my exact fears are, I can face them
Thank you so much π
I'd prefer they fear CSS rather than writing lots of !important.