DEV Community

Saharan-sub
Saharan-sub

Posted on

CSS got too many moving parts

Why am I struggling with CSS, too many moving parts 😭😭😭

I need help!!

Top comments (14)

Collapse
 
lysofdev profile image
Esteban Hernández

A lot of CSS rules are no longer relevant. Further, with tooling like CSS-in-JS, many of the CSS tricks of years ago are no longer necessary since the JS can handle it in a more elegant and legible way.

The most important parts of CSS IMO are Flex, the Box Model, typography, colors and knowing how to copy-paste snippets that accomplish almost exactly what you need and adjusting the one or two values necessary for your use case. Further, you'll end up using CSS libraries like Tailwind and Post-Processors like Sass in most professional environments which handle the rare edge cases under the hood.

My advice is focus on accomplishing clear-cut goals such as replicating a mock-up or a website you like rather than trying to learn all of the rules and values by memory. Again, most of them are no longer relevant.

Collapse
 
lysofdev profile image
Esteban Hernández

Sorry, forgot to say. Feel free to post your exact questions and many people will be kind enough to guide you through them.

Collapse
 
godwin_france profile image
Saharan-sub

Thanks, this is very insightful

Collapse
 
jwp profile image
John Peters • Edited

This will help. Start using html5 grid for all layout. It's better than flex box because it does both columns and rows plus areas.
Then switch to Scss for it's power in Specivity. The only others things needed are margins, colors, borders, font size and padding. Use only em, rem or vh sizes and you're set.

Collapse
 
hamo225 profile image
Tarek Hamaoui

Hey buddy. What’s the problem?

Collapse
 
godwin_france profile image
Saharan-sub

Just trying to figure out what to use and when to use them.

Been practicing building a number of Tables. Will move on to forms after this.

Just want to be a to style a page from scratch

Collapse
 
jkhaui profile image
Jordy Lee

Learn flexbox religiously, as well as the position attribute. After a lot of practice with that CSS will be a walk in the park for you bro.

Thread Thread
 
godwin_france profile image
Saharan-sub

Alright, I have not covered flexbox yet. Maybe that will be the key.

For position attribute, which ones do you mean ?

Thread Thread
 
lysofdev profile image
Esteban Hernández • Edited

position: relative|absolute|fixed|sticky

Just understand what each of those 4 options does and you'll be miles ahead.

Thread Thread
 
jkhaui profile image
Jordy Lee • Edited

position: absolute and position: relative. Most important is you understand how this attribute interacts with a child element and its parent container (e.g. an absolute div within a relative div), as well as the bottom, top, left, right attributes.

There's also position: sticky but I think the only time you'll use that is with a navbar

edit: as another user pointed out, there's fixed too. But imo absolute and relative are by far the most important due to how they are influenced by every other element in the DOM.

Thread Thread
 
godwin_france profile image
Saharan-sub

I will do that

Collapse
 
steveblue profile image
Stephen Belovarich

table is notoriously difficult to style. form inputs also have very peculiar traits, as you have to override browser default styling.

Perhaps take a step back to learn how block elements like div and inline elements like span behave with CSS.

Collapse
 
fishermedders profile image
Fisher

I feel the same way about a lot of it. These comments are super nice, and props to you guys for helping a fellow dev out!

Collapse
 
guvenaltunsoyy profile image
guven

Absolutely i agree