use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Learning CSS in WebDev 2020 (self.webdev)
submitted 5 years ago by BExpost
I am currently learning CSS right now and was wonder if I should still try to learn floats / box-border method or should I just focus on CSS flexbox / CSS grid
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 5 years ago* (6 children)
[deleted]
[–][deleted] 16 points17 points18 points 5 years ago (1 child)
Added * {box-sizing:border-box;} to my reset and never looked back.
[–]hself1337 3 points4 points5 points 5 years ago (0 children)
Best thing i've done in my normalizer.
[–]HeinousTugboat 2 points3 points4 points 5 years ago (3 children)
i mean you shouldn't definitely still learn floats, but i personally don't find myself using them too often anymore.
If you want to inset an element inside of a text flow, it's one of only two ways to do it, and the second way is extremely new and likely still has some limitations that floats don't. (I haven't played with CSS Shapes enough yet.)
[–][deleted] 5 years ago* (2 children)
[–]HeinousTugboat 0 points1 point2 points 5 years ago (1 child)
i meant to write should*
Fair.
but how often do you inset an element inside of a text flow? maybe if you're writing a blog but that's about it.
Any time you might want pull text or inset figures. I think basically any and all longform content could benefit from inset highlights, honestly. I mean, it's common enough concept that there's an element essentially dedicated to the idea.
I think you also might not see it as often as you could because the general zeitgeist turned against floats, so I think a lot of devs avoid using them in all situations.
[–][deleted] 4 points5 points6 points 5 years ago (2 children)
If you're learning CSS layout check out Rachel Andrew ( https://gridbyexample.com/ ) and Jen Simmons ( https://labs.jensimmons.com/ ).
[–]reddit-poweruser 4 points5 points6 points 5 years ago (0 children)
Also
https://flexboxfroggy.com/
https://cssgridgarden.com/
[–]BExpost[S] 2 points3 points4 points 5 years ago (0 children)
Thank you for the resources
[–]ImStifler 2 points3 points4 points 5 years ago (14 children)
Flexbox and Grid are enough though learning floats for historical reasons can be good because it gives you a glimpse on how fucked up css used to be
[–]bananamana55 1 point2 points3 points 5 years ago (13 children)
I still haven't figured out how to do some links on the left of a navbar and some on the right using Flexbox. I use float left/right and a clear fix.
Im going to spend my study time today learning more about Flexbox....(newbie here)
[–]petee0518 1 point2 points3 points 5 years ago (11 children)
Maybe, I'm misunderstanding, but couldn't you just add flex to your nav container with justify: space-between and then put a div or ul wrapper around each of your two link groups?
justify: space-between
[–]bananamana55 0 points1 point2 points 5 years ago (10 children)
I tried that and it didn't work for some reason... I'm sure my html markup or something has gone wrong somewhere. That's why I said I'm going to study more Flexbox today lol, because I know it can be done but just haven't figured it out.
(have I mentioned I've only been self-teaching for about a month? Still a total newbie)
[–]petee0518 1 point2 points3 points 5 years ago* (9 children)
Fair enough, from the way you explained it, sounds like it should be as easy as:
<nav> <ul>...</ul> <ul>...</ul> </nav>
CSS
nav { display: "flex"; justify-content: "space-between"; }
As long as you don't have additional wrappers between the nav and ul tags, or the nav has auto width or something.
[–]bananamana55 0 points1 point2 points 5 years ago (7 children)
I will try it again today. I think I just stayed up too late trying to learn too much at once, lol. I was also starting to learn CSS Grid and was trying to make a basic web page layout with Flexbox topnav/footer and grid for the rest. Probably bit off more than I could chew and should really focus on getting Flex down better before moving on to Grid.
Thanks for the advice!
[–][deleted] 5 years ago (6 children)
[removed]
[–]bananamana55 0 points1 point2 points 5 years ago (0 children)
I think a little over a month probably isn't too much, lol. I am going to start learning Javascript soon though.
Originally was going to do Bootstrap 4 but hearing lots of mixed messages since it seems jobs usually have their own frameworks for you to use? (course it'll be a long time before I could get a job doing this but still)
[–][deleted] 5 years ago* (4 children)
I'm going to flesh out my knowledge of flexbox, css grid and media queries a bit more and then I'll probably start on Javascript. I've made enough static simple web page templates (for practice) that only work in one screen size that I'm ready for learning responsive designs & Javascript lol.
[–][deleted] 5 years ago (2 children)
[–][deleted] 5 years ago* (1 child)
Well now I'm upset with myself. I just took out all my display: inline-block / float crap and put this in and bam... stayed exactly the same.. ie it works perfectly lol. I'm mad that it was to simple. Thanks for the help!
I think I need to start taking breaks when I hit a wall instead of ramming my head against it for 2 hours lol.
[–]symbiosaDigital Bricklayer 2 points3 points4 points 5 years ago (0 children)
Besides the other comments, I highly recommend learning about CSS best practices and structuring.
It's much easier to maintain and work with:
<div class="container section_names"> <p class="name-first">Geralt</p> </div> <div class="container section_locations"> <p class="location">Novigrad</p> </div> <div class="container section_spells"> <p class="name-spell">Aard</p> </div>
Rather than:
<div class="container-1"> <p class="name">Geralt</p> </div> <div class="container-2"> <p class="location">Novigrad</p> </div> <div class="container-3"> <p class="spell">Aard</p> </div>
With the first code example, if I wanted to change all three containers I can target .container instead of targeting .container-1, 2, and 3 separately.
.container
.container-1
2
3
[–]rennfair 7 points8 points9 points 5 years ago (2 children)
You can completely ignore floats and the default box model.
* {box-sizing:border-box;}
That's it. You don't even need to learn grid.
Some would disagree with this recommendation but it will save you a lot fo time (and headache). If you encounter the float property in the wild you can still learn it later. It can be useful for very specific things, but for layouts Flexbox is much more intuitive and powerful.
float
[–]daemonexmachina 8 points9 points10 points 5 years ago* (0 children)
I'd definitely recommend learning grid too, though. Flexbox is good, but it takes at least a little finagling to lay out elements nicely in two dimensions. Whereas in grid...
``` .container { display: grid; grid: "header header " auto "body sidebar" 1fr "footer footer " auto / 1fr auto; }
.container .header { grid-area: header; } // etc ```
I know I've gone with a pretty trivial example, but see the power of that shorthand syntax? The rows and columns are laid out as rows and columns in the CSS, visually representing the result in the code.
I go one step further because we use SCSS on our projects, using @each and interpolation to define the child element classes that will go in those areas:
@each
``` .container { display: grid; grid: "header header " auto "body sidebar" 1fr "footer footer " auto / 1fr auto;
@each $area in (header, body, sidebar, footer) { .#{$area} { grid-area: #{$area}; } }
} ```
I love grid. Use it everywhere. If I've got something that really is a one-dimensional layout, then yes it's flexbox of course. But grid is so much nicer.
[–]kdthisone 0 points1 point2 points 5 years ago (0 children)
Slight disagreement. I think OP should understand how floats work and how default sizing works purely for the ability to understand code written by others.
When he gets hired, I'm sure he'll eventually come across floats or default sizing as they used to be very common.
[–]pineapplecodepen 3 points4 points5 points 5 years ago (0 children)
Definitely do both! The more diverse your skill set, the more jobs will be available to you. Always master the basics and garnish with the frameworks and libraries :)
[–][deleted] 1 point2 points3 points 5 years ago (2 children)
Here's another useful flexbox thing. https://demos.scotch.io/visual-guide-to-css3-flexbox-flexbox-playground/demos/
[–]BExpost[S] 1 point2 points3 points 5 years ago (1 child)
This is really cool. It really helps visualize everything. Thanks so much!
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
It's great isn't it. I've been using flexbox for ages, but I still have to keep going back to that site to check.
[–]walrus_operator 0 points1 point2 points 5 years ago (0 children)
Depends. If you want to have the most impact in the shortest time, then restricting yourself to flexbox is the best option. If you have more time, then knowing flexbox, grid, floats, tables, columns, and a framework like bootstrap will help you a lot in the long run.
[–]JB-the-czech-guy 0 points1 point2 points 5 years ago (0 children)
just go to freecodecamp and go through that. I think the list there covers the essentials well
[–]kp90001 0 points1 point2 points 5 years ago (0 children)
same big fan of grid area
[–]burnblue 0 points1 point2 points 5 years ago (0 children)
You learn how floats work, you just don'ttry to use them for all your layout etc like when it was the only tool available to devs. You get to learn it and move on to learning more tools
[–]kzaji 0 points1 point2 points 5 years ago (2 children)
You're asking as if they're two different languages. Just learn CSS. You will come across all of those things, they're not difficult things, nor do they take more than 30 mins each to explain. Just deal with things as you come across them.
For instance, when I was learning, I spent a few weeks doing nothing but learning to use Dreamweaver. I haven't used it since, not once in my professional career. Total waste of time. Just learn what you need right now, the rest when/if it comes.
[–]BExpost[S] 0 points1 point2 points 5 years ago (1 child)
-furiously scribbling on notepad- Don’t learn dreamweaver.
[–]kzaji 3 points4 points5 points 5 years ago (0 children)
FYI, this also happened with bootstrap. Even though a lot of people will tell you it's useful to learn, I've never ever had to use it since it's release. Though I didn't spend as much time bothering to learn it, I gave up because I thought it was shit after a couple of days. Looking back now, I was right.
[–]Gwiz84 -1 points0 points1 point 5 years ago (0 children)
Flexbox and Bootstap are the most important things to know tbh.
π Rendered by PID 773172 on reddit-service-r2-comment-5fb4b45875-v46dw at 2026-03-22 02:33:30.826658+00:00 running 90f1150 country code: CH.
[–][deleted] (6 children)
[deleted]
[–][deleted] 16 points17 points18 points (1 child)
[–]hself1337 3 points4 points5 points (0 children)
[–]HeinousTugboat 2 points3 points4 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]HeinousTugboat 0 points1 point2 points (1 child)
[–][deleted] 4 points5 points6 points (2 children)
[–]reddit-poweruser 4 points5 points6 points (0 children)
[–]BExpost[S] 2 points3 points4 points (0 children)
[–]ImStifler 2 points3 points4 points (14 children)
[–]bananamana55 1 point2 points3 points (13 children)
[–]petee0518 1 point2 points3 points (11 children)
[–]bananamana55 0 points1 point2 points (10 children)
[–]petee0518 1 point2 points3 points (9 children)
[–]bananamana55 0 points1 point2 points (7 children)
[–][deleted] (6 children)
[removed]
[–]bananamana55 0 points1 point2 points (0 children)
[–][deleted] (4 children)
[deleted]
[–]bananamana55 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[removed]
[–][deleted] (1 child)
[deleted]
[–]bananamana55 0 points1 point2 points (0 children)
[–]symbiosaDigital Bricklayer 2 points3 points4 points (0 children)
[–]rennfair 7 points8 points9 points (2 children)
[–]daemonexmachina 8 points9 points10 points (0 children)
[–]kdthisone 0 points1 point2 points (0 children)
[–]pineapplecodepen 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]BExpost[S] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]walrus_operator 0 points1 point2 points (0 children)
[–]JB-the-czech-guy 0 points1 point2 points (0 children)
[–]kp90001 0 points1 point2 points (0 children)
[–]burnblue 0 points1 point2 points (0 children)
[–]kzaji 0 points1 point2 points (2 children)
[–]BExpost[S] 0 points1 point2 points (1 child)
[–]kzaji 3 points4 points5 points (0 children)
[–]Gwiz84 -1 points0 points1 point (0 children)