So i’m pretty new to web development, maybe a month into,
about to graduate high school, go to college, etc.
I know this career field is all about experience which is why i want to start as early as possible and I have been making a couple of websites from scratch. here is a sample and here is my problem (below the image)
So far I am have only been using HTML and CSS for my stuff, but i wanted to know… How can I properly make the red div’s size themselves inside this blue one in the layout above. The problem is the uneven spacing that worries me.
Thanks in advance for the help.
The answer depends on what browsers you want to support. I’m not sure if you know this, but basically IE is going to be the browser that holds back web development for now. We are currently on IE11, with Edge cming out soon. Are you OK with doing IE10+? This depends on your user base; whether IE9 (or even 8) is worth supporting.
Flex is good for the purpose, as long as you don’t need to support old IE (@RyanReese was writing about it at the same time). You could also try inline-blocks with percentage widths and text-align:center on the wrapper div.
Basically, Flexbox support for IE is lacking in some areas or requires an older syntax depending on the IE version.
I would start with learning the old school methods of floats/hacks to horizontally and vertically center content. Odds are if OP has to edit anyone else code or an existing theme that’s what he’ll be working with. After that I would master Flexbox and start incorporating that in as well.