r/ProgrammerHumor • u/splatterghost Spanish is turing complete • Dec 16 '18
The pains of CSS
714
371
72
304
u/RockleyBob Dec 16 '18
My initial intuition about what any given line of CSS will do is dead wrong. 100% of the time.
114
30
Dec 16 '18
*{ box-sizing: border-box; }
15
u/Peechez Dec 17 '18
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }if we're gonna go there
→ More replies (2)100
u/AndrewIsANerd Dec 16 '18
W3schools knows what they all do, so therefore I do too if someone asks
→ More replies (2)36
21
u/Zmodem Dec 16 '18
You'll really love how DOM reordering occurs when a parent's opacity is changed and the children fall behind elements, even if their z-index and relative parent are properly set.
→ More replies (1)42
39
u/break_rusty_run_cage Dec 16 '18
My initial intuition about what any given line of CSS will do is dead wrong.
100%Auto of the time.FTFY
(Don't kill me. I'm no programmer)
→ More replies (1)37
Dec 16 '18
body {
background-color: white;}
Entire website gets shrunk into the corner, and the background color is somehow not even white
39
23
593
u/T4O2M0 Dec 16 '18
64
u/kerohazel Dec 16 '18
It's ok if you don't consider CSS a programming language. I don't. But a lot of real programmers still have to deal with it.
→ More replies (16)81
u/Adawesome_ Dec 16 '18
Curious, how is this gatekeeping?
114
u/MrHandsomePixel Dec 16 '18
There is this running joke around the community that CSS isn't a programming langugage.
Although HTML and CSS can technically be turing complete (quick google search, didn't even know), the main function of CSS is in its name: Cascading Style Sheets To add style to stuff
88
27
→ More replies (3)27
u/SandyDelights Dec 16 '18
Just to be bit-picky, neither HTML nor CSS are Turing complete – using both HTML5 and CSS3 together can be considered Turing complete, though. Neither is a Turing complete language on its own.
→ More replies (2)213
u/ArcaneYoyo Dec 16 '18
CSS doesn't really have logic, it's purpose is just to structure things and style them.
37
u/aloofloofah Dec 16 '18
SQL isn't Turing complete either but nobody thinks that Bobby Tables doesn't belong here.
→ More replies (5)→ More replies (21)196
u/abbott_costello Dec 16 '18
Its still programming adjacent, most programmers know what CSS is while most non-programmers don’t know what CSS is. Saying it doesn’t belong on the sub is just pedantic
→ More replies (12)→ More replies (4)56
→ More replies (10)136
Dec 16 '18 edited Dec 16 '18
The sub is programmerhumor, not programminghumor, not serversidehumor.
Never underestimate a STEM nerd to not be an elitist fuckass.
→ More replies (129)15
18
11
11
10
Dec 16 '18 edited Dec 17 '18
I wonder if it's because no one really tries to learn CSS properly. At least in my experience I picked up enough html/css to get started but only really focused on getting better at JS and CSS is mostly an after thought. Most of the time I'm dealing with a framework like Bootstrap or Materialize and just edit those.
So I wonder if it's actually a pain in the ass or i just haven't learned it properly. Probably both.
EDIT: I take it back, I just remembered IE. Fuck CSS. At least JS had jQuery were I didn't have to write too much browser specific code.
EDIT2: It's probably more IE's fault than CSS, I'm sorry CSS.
12
Dec 16 '18
I see this way too much. A lot of people don’t know CSS well. They either think it’s completely broken or it’s not “programming” and don’t bother to really look into it. CSS positioning is not that complicated. Yes, it’s weird to wrap your head around at first but after reading up about it and playing around with it, you should know how it works. Not to mention Flex has made everything easier.
It does become a pain in the ass when you have to make it responsive on all browsers and devices. A lot of tweaks to be done. And of course, if you want to do really fancy frontend stuff, you will have to put more effort in.
→ More replies (4)→ More replies (2)2
u/SuperSatanOverdrive Dec 16 '18
I don’t think it’s that much of a pain (usually). Especially since there’s many great frameworks to get you started. And while you before had to have a framework to get stuff like responsive grids, now you can use native functionality like flex to achieve the same result.
The pain comes if you’re forced to implement something which really should be in the standard. Like, for instance statically positioned headings in a table that has an auto width.
9
u/crsuperman34 Dec 17 '18
Am CSS/SCSS/Front-End dev, I've been wanting to build an entire site only using pseudo selectors...
and then paying a professional shop to do some work on it. Just to get the reaction.
2
8
36
39
7
8
u/fuck_the_mods Dec 16 '18
Last week I added overflow: auto to an element and it broke z-index on iOS. W T F
2
u/killm_good Dec 16 '18
Chrome on Android interprets hex colors with <FF alpha to be fully transparent.
rgba()is fine though.→ More replies (1)2
u/Omega192 Dec 17 '18
Somehow mobile Safari has bugs desktop Safari doesn't. It's up there with IE in terms of causing me immense frustration.
4
4
3
3
3
3
3
3
3
Dec 17 '18
So true..there should be multiple versions of that Pikachu image depicting different browsers, too
3
10
u/Andy_B_Goode Dec 16 '18
I have never understood why CSS has remained so popular as a way of positioning things in a browser viewport. It's bizarre to me that in this day-and-age, after years of single-page web apps, browsers haven't implemented some alternative to CSS that better suits app-like websites instead of page-like websites. I know there are workarounds, but they basically amount to writing code that then gets transformed into CSS for browser consumption. Why can't we have a native alternative? Why do I keep having to use a system that's essentially meant for aligning chapter headings on a page, when what I'm really doing is positioning a popup dialog relative to where the user clicked?
→ More replies (4)
5
2
u/MasonXD Dec 16 '18
As someone who just made a Pokémon themed website for University this is very literal to me
2
2
2
Dec 16 '18
Is the programming job market so flooded that this sub reaches the front page everyday?
→ More replies (4)
2
2
u/VoldemortsHorcrux Dec 17 '18
My go to way of modifying css after 3 years is still make some changes in chrome dev tools and see what changed. And after 10 minutes of that google it. All the specifics never stuck with me.
2
u/ow2330 Dec 18 '18
It’s not just painful with css, it’s fucking hell with css when you include animation, transition and transformation
2
2
1
1
1
1
1
1
u/Coconut_Biscuits Dec 16 '18
Random guy from /r/all here. What does CSS stand for? I know it's a programming language but whenever I see it, I read it as Counter Strike Source
5
Dec 16 '18
It’s Cascading Style Sheets. The reason for why everything on a website looks nice and right on the screen. Without CSS, it would look a random text file.
→ More replies (2)
1
u/craftsmany Dec 16 '18
Psst Can I tell you something creepy?
Horizontal and vertical centering
→ More replies (1)
1
u/iapetus-11 Dec 16 '18
Yess, at first when I was coding I thought you had to put it in every page every time instead of in one .css file
1
u/Codephluegl Dec 16 '18
A line of CSS that saved my ass countless of times, when trying to debug weird issues with floats:
* { outline: 1px solid red !important; }→ More replies (1)
1
1
1
1
1
1
1
u/crsuperman34 Dec 17 '18 edited Dec 17 '18
on your
<body>tag putstyle="{ box-sizing: content-box!important;}"
then in the first line of your css put:body { box-sizing: border-box }body > * { display:inline }design your site so it looks ok,
send it to your dev friend, ask them to fix something.
watch them cry.
1
1
1
u/trialander Dec 17 '18
Doing a school project, trying to put images as the asides. It ends up EXACTLY like this, lmao.
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
u/SupremeRedditBot Dec 17 '18
Congrats for reaching r/all/top/ (of the day, top 25) with your post!
I am a bot, probably quite annoying, I mean no harm ^though
Message me to add your account or subreddit to my ^blacklist
1
1
1
1
u/LinAGKar Dec 18 '18
I designed a web page recently and it wasn't so bad. Though I'm not sure how I would have done it without flexbox.
1
u/BlackAccipiter Dec 20 '18
Well... That's fucked up. Let me fix this! (And goes to make more codes in CSS and adds JS codes)
(Gets more fucked up) NOOOOOO
1
1
1
u/Piece_Of_Mind1983 Nov 25 '21
As someone with about an hour’s worth of experience with css this is far too accurate.
0
Dec 16 '18
[deleted]
193
u/RVA_101 Dec 16 '18
Gesundheit.
37
Dec 16 '18
I don't think I've heard of that Pokemon before. What type is it?
68
6
3
0
Dec 16 '18
[deleted]
58
Dec 16 '18
A lot of frontend developers feel the same way about backend.
4
u/VoldemortsHorcrux Dec 17 '18
Im a frontend developer and still feel sorry for myself and any other person that has to mess with css. I honestly never bothered to really learn how to do stuff and just google anything when positioning crap comes up
14
Dec 17 '18
People typically dislike what they don't understand.
I hated CSS until I spent enough time to understand it. Now it does exactly what I expect 99% of the time and the other 1% is user error.
→ More replies (4)2
u/is_that_my_butt Dec 17 '18
I feel like the better part of frontend developers feel the same way about frontend, too.
7
Dec 17 '18
Any programmer feels that way about a clusterfuck codebase. I've taken over projects from horseshit Java and Rails developers that made me want to shoot myself in the face. All the frontend devs I know enjoy frontend. If they didn't enjoy it, they wouldn't do it.
27
u/SuperSatanOverdrive Dec 16 '18 edited Dec 17 '18
I really like working as a frontend developer. Specifically with node.js, graphql, modern javascript and react.
I sort of get the same feeling as you when I have to look at the Java backend with the never-ending boilerplate and all the undocumented spring/spring-boot magic that’s going on, and having to deal with SQL.
Edit: that being said, I think Kotlin looks like a pretty cool development in the java world
6
11
u/Omega192 Dec 17 '18
As a frontend I'm very much okay with this being a dominant sentiment cause it just means job security for me 😉
But you can have cluster fucks on all ends. When you finally get to work with a well designed frontend it's a whole new world.
5
u/DigitalCrazy Dec 17 '18
My feelings exactly. I'm just sitting here in joy because I have
almostabsolutely no problems with CSS, it does everything I want it to.Gets even better when you use a preprocessor.
36
u/M1A8 Dec 16 '18
CS major here, had to learn Html + CSS for a mandatory communications course.
I was nearly finished designing a digital poster project with Html/CSS and I noticed I had an incomplete div section with no closing div bracket. I figured "Hey that's weird, everything still looks completely fine without it. Wouldn't hurt to add the closing div anyway."
Big mistake.
Every fucking image gets shifted down into the depths of hell, the page length expands thirty miles, the text is absolutely nowhere to be seen.
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
6
u/metavurt Dec 17 '18
It's actually not, anymore. What may look like clusterfuck is probably due to not using best tools for what's wanted. All modern browsers are quite aligned these days - CSS grid and CSS flexbox work across the board. If it's a clusterfuck, it's probably a js dev trying to bend css to their will, or it's a css dev, trying to do js like css.
In the past two years the most issues I have is with upgrading a teams' knowledge about what they can and cannot do without touching or needing a framework of any kind. I get a lot of "what?! you can do that?!" because there just hasn't been a pause in the frontend sector, and given everyone a chance to catch up and recognize which tools are best for which tasks. A lot of headache could be saved at the front side of a project, if better assessments are made.
Sorry to babble on - it's 2018, and I am having the same conversations I had in 1998. Didn't think I would be here. Again.
9
u/Erlandal Dec 16 '18
I thought JS was also heavily used for backend stuff. I'm thinking about Node.js, Express, React, etc.
6
u/wootangAlpha Dec 17 '18
Frontend dev here. For newer web apps, sure. Most of the software world is still using java and C# for backend. Some companies have a fear for bleeding edge stuff like React which it must be said has so much tooling that it's maintenance should be a job on it's own.
→ More replies (2)2
u/LOOKITSADAM Dec 16 '18
There was a big trend/push for it a while ago, but that seems to have cooled down once people realized how horrible it is. The places I see it most now are when user-defined functionality snippets need to be executed (like AWS lambda) and when a company's engineering department is like 75% front end engineers by background.
14
Dec 16 '18
This is just not remotely true. There are NodeJS/React/Vue/Angular jobs all over the place.
→ More replies (4)10
u/SuperSatanOverdrive Dec 16 '18
It’s not horrible. Node.js is great as a web app server. It can run on really limited resources.
→ More replies (1)0
Dec 16 '18
[deleted]
3
u/Erlandal Dec 16 '18
Aren't most websites nowadays made through either MERN or MEAN though?
→ More replies (1)5
u/SuperSatanOverdrive Dec 16 '18
How can you say it is niche? What are you basing this on?
Here’s some sites/companies that use node.js for their backends:
Netflix
Trello
Uber
Paypal
Medium
eBay
NASA
Yahoo
Zendesk
Walmart
Groupon
Shutterstock
→ More replies (3)2
Dec 16 '18
I really don't understand this. HTML/CSS is pretty straightforward, and is way easier than programming actual logic. Basically all you're doing is making boxes then defining the size and location. All the other CSS stuff comes down to repetition, memory, and Google, just like normal programming.
4
Dec 16 '18
Try making everything look the same on different browsers especially IE, bud.
→ More replies (4)4
1
u/calm_down_meow Dec 17 '18
In my experience it's because it takes longer than you want it to take (longer than 5 minutes). To get that view to look great it could take multiple attempts/iterations, and most programmers just simply don't care that much about it. It really does matter though, and a poor enough design will make users question your entire website.
→ More replies (1)1
Dec 16 '18
That’s how I feel about backend too lol I think Frontend can be annoying but also fun to do especially with modern JavaScript frameworks.
1
u/gawalls Dec 16 '18
Same here, I know enough to get by on front end but glad I'm not a front end developer.
0
3
Dec 16 '18
[removed] — view removed comment
1
u/wootangAlpha Dec 17 '18
True story I still do mockups on PowerPoint before coding it. Makes it easy to get something out of my head in two minutes.
2.9k
u/RedZaturn Dec 16 '18
Sure you have tried to use CSS but have you ever designed a website in Microsoft word?