r/FullStack • u/fruitpunch327 • Sep 23 '22
LPT: I have found that using borders while using flex in CSS helps me immensely.
For anyone struggling when working with flex in CSS I find it helpful to have different colored and styled borders to understand what the containers and items are doing, it gives me a good visual as I learn how to use flex and what I need to do to make it work. The colors also help figure out what segment in the CSS code needs to be adjusted because in VS code the colors have a block showing the color next to it.
This "technique" reminds me of using console.log() inside of a JS code to understand what certain functions and what-not are doing.
9
Upvotes
3
u/ngawanglhamu Sep 23 '22
Sometimes borders will introduce horizontal scroll as it adds certain pixels to our box-size but the same effect can be achieved using outline. I'm glad that many others find this technique useful.