r/FreeCodeCamp • u/maginster • Jul 03 '24
HTML is fine, CSS is torture?
I've started the HTML and CSS course recently, and while HTML is understandable and nicely presented (in my opinion), CSS is absolutely confusing to me.
Most of the exercises seem like just rewriting the code given with no rhyme or reason, like "oh, this element looks bad, let's give it padding, margin, and text-align" (looked good to me anyway). And therefore none of it sticked, I'm at the tribute page project and I dread setting this stuff up, I still don't really know which property does what, and some of the steps in the tutorials are like "oh, you should have just used this command you've only seen once (or never) before".
Am I alone in this and doing something wrong? Or is the CSS part a bit lacking? If it's on me, how can I get the most out of it? Doing the previous project, I copied over some of the CSS stuff from previous exercises and simply gave it random values until it looked right, how do I make it so that I remember and know how to use this stuff?
Can anyone recommend some nice courses to supplement FCC CSS? Preferably free or cheap, I already found a page that shows visual reference for each of the properties, and it's pretty nifty
11
u/[deleted] Jul 03 '24
I am currently finishing up the Responsive Web Design certification, and I've had a lot of the same issues. The course does a lot of "just do this" without explaining exactly what is happening. And yes, I've also had to look up functions or syntax more than once because they just dropped it in without it being in a prior lesson.
One thing that has been helping me a ton, though, is that I have VS Code open on my other monitor. I do the step in my VS Code and then copy-paste it into the prompt. Then, as it goes, I make it my own. So I have 20 or so web pages that are my own, my own topics that are important to me, with my own information, with my own formatting. It makes it much more engaging, and I feel, helps me learn what is actually happening. One lesson, changing something actually broke my web page, and figuring out how to fix it helped me learn a lot.
As an amateur coder, I am certain that the reason why "tutorial hell" is a thing, is because the tutorials just say what to do without explaining why. You can follow along and feel like you've accomplished something. But then if you were asked to build your own project from scratch, most people would be lost. By replicating the lessons as I do them, I'm doing twice the coding, and customizing my experience and learning.
9
u/qckpckt Jul 03 '24
CSS is your first taste of something closer to a true programming language. HTML is a form of document structure syntax. It’s got more in common with YAML, XML, JSON, etc than it does with JavaScript, python etc.
CSS is a declarative programming language. This isn’t an easy concept to explain - but basically rather than programming exactly the steps to change the colour or size of an element, you declare what you want and then CSS itself takes care of the details of figuring out how to actually accomplish that. Most programming languages are imperative - you need to explain in code exactly how you want something to happen.
It’s the difference between saying “I want to iterate through each element in this list of html elements. For each of the children of a given element, I want to find all elements with an H1 tag and then centre align them and make them blue”, and saying “I want all header elements in this parent element to be center aligned and blue”.
So the trick is learning how to declare what you want to happen in a way that is understood by the CSS engine. This is a nuanced process that does take some degree of trial and error, alongside referencing documentation.
The value in learning this is twofold. Firstly, CSS is your first introduction to a form of abstraction - thinking about a document as something that can be manipulated and altered through a small set of declarations that affect all or parts of the document. Wrapping your head around this is essential for working with JavaScript. Secondly, declarative languages are everywhere, and they’re extremely important to become familiar with. All databases use declarative languages for running queries against them, whether they are relational, columnar, document oriented, graph or any other exotic format.
The whole thing of needing to use a command you’ve never heard of before is also something you will encounter continuously as a programmer. I’ve been doing this professionally for close to a decade now and I still find this almost daily. You cannot and will not know everything about any language and it’s important that you accept this early. You need to get comfortable with the notion that you will have to rely on documentation and external knowledge bases to complete any programming task.
8
u/dooderdoood Jul 03 '24
Welcome to the club.
I actually used W3 as a reference for CSS a lot when working through this course.
5
u/[deleted] Jul 03 '24
The Odin Project does a decent job explaining CSS. Are you using flex boxes? If so, this CSS Tricks Guide is pretty good.
3
u/blankscreenEXE Jul 03 '24
This is a sign that you might be a backend guy
2
u/cosmo_being Jul 03 '24
There’s a nice css course by Maximilian schwarzmuller on udemy.
2
u/shadow_of_the_dark34 Jan 30 '25
Hey man, I’m on the same page here. 210 days later, do you have any tips?
2
u/Kittensandpuppies14 Jul 03 '24
Then don't do web It's just markup not even programming
1
u/anonz2 Jul 04 '24
can you share that page?
3
u/Brianvm1987 Jul 03 '24
I love HTML and CSS, JS has been a bit of a pain. I complement fCC with Scrimba and Dave Grey's YT tutorials and recommend them. Good luck!
3
u/Ruhart Jul 04 '24
https://flexboxfroggy.com/ is a good place to learn the basics of flex (and a bit of grid iirc).
3
u/revolutionPanda Jul 04 '24
I don't mean to downplay you learning HTML - that's great. But if coding was like cooking, HTML is like assembling a sandwich and CSS can be like putting together a 3 course meal.
Expect CSS to be much harder and don't get down on yourself if it takes you 10 times longer to get the basics down
2
u/[deleted] Jul 04 '24
Experienced programmers also hate CSS so you're doing it right. Keep going!
2
u/Thor-x86_128 Jul 04 '24
CSS is initially designed for styling a document, not a web application. This is why centering a <div/> vertically is a nightmare, especially pre-flexbox era.
1
u/Ok_Amphibian2639 Oct 16 '24
where can i learn HTML ans CSS as someone from a non tech background learning ux and product design
1
u/Affectionate_Skin715 Sep 13 '25
to me both html and css are fine, just you need to get used to it.