I have a problem with positioning 3 images in one container div. I want to set them at the top of the page but I cannot do it. I’ve been trying for a long time and still struggle with it.
Can somebody look at my code and check it out what is wrong?
If you want to organize divs using flex you can order your elements in css or you need to move your html elements in the order you want them to appear.
If you want to order your components with flex the your wrapper has to display: flex as well.
The easiest way to move the .box class to the top is move the html elements to the start of the wrapper.
I understand, are you just trying to put it at the very top in a row or are you trying to put it in the same line as your header content in a column like it is now.
Look, what I want to achieve (if it’s possible of course).
Red line - is a div’s border from these 3 pictures
White line - is a div’s border form my content.
I want to make these borders (where I can change position) like this:
Blue border - for these 3 pictures
Black border - for my content.
I’m gonna try it! In what kind of projects FlexBox is useful? Cause I have just started my journey with HTML and CSS and cannot figure it out yet, what should I use and when.
I’ve used flexbox on a whole website, loved it. Great way to make a responsive website.
In my case it was an existing website, old (2007) and not responsive. With flexbox I was able to keep the old elements.
I think it’s possible with your design as well. I’m trying something in codepen. I’ll let you know if I succeed.
@dannyb I agree with @mindstomedia, you need to organise parents and children. I’ve changed your pen into something that may look like what you want. But it’s not perfect. It’s not very responsive.
on top of the css file, you can see what you’re doing with the boxes. It helps to see the parents and children, margins, paddings, etc. You can take it out when you’re finished or when you want to see the result. Just put it back in again to have a good look at things.
Yeah flexbox can make your head explode but its its awesome when it does what you want. I recommend you play around with flexbox outside of this project with many simple coloured divs and simple text and organize them in many different ways, this really helped me understand how to structure and how different flexbox css elements work.
I had a whole, real, website to make mistakes with. And when I worked on it I’ve never made so many mistakes in such a short period of time in my entire life! And I loved every minute of it!