Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Having trouble with the CSS Flexboxes

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #249538

    I’m quite new to CSS; I have designed websites before in Photoshop but I’m just getting started with the coding aspect.

    Anyway, besides the point, I was trying to create my personal website and wanted to achieve a result similar to this:

    I’m having a lot of trouble with achieving the result which I wanted for the grid using the Flexboxes.

    Another problem is the border-right doesn’t extend until the end of the viewport height. It was fine until I put some paragraphs in there.

    Would appreciate any help on this greatly.

    Here is the codepen link: http://codepen.io/anon/pen/WReOoW

    #249539
    Beverleyh
    Participant

    I’m having a lot of trouble with achieving the result which I wanted for the grid using the Flexboxes.

    If you Google “flexbox 2×2 grid” you will find various examples.

    Another problem is the border-right doesn’t extend until the end of the viewport height. It was fine until I put some paragraphs in there.

    Sorry, I don’t understand the problem. The border looks fine here (on iOS) . Can you clarify?

    #249541
    Atelierbram
    Participant

    @abdul_h65 Modules with panels like these are an excellent fit for flexbox. But you want an extra wrapper around those image-text pairs, to make that wrapper the flex-item. I still find this visual guide to flexbox playground helpfull, but maybe you are also using something like this.

    The vertical border (from top to bottom in the middle) could better be done with a small vertical repeating background-image. In my fork of your demo I used an embedded SVG image.

    Also at some point this layout is going to break for smaller screens, so for this reason I put those layout styles within a min-width media-query.

    http://codepen.io/atelierbram/pen/apoEyj

    Please let me know if you have any further questions about this.

    #249545

    Hi, @Atelierbram. Thanks a lot for your help. That worked like a charm :)

    Just ran into another minor problem. I’m trying to push the project details to the bottom of the image; I tried using margin-top, margin-bottom, padding top, padding-bottom… but none of these have worked so far.

    Thanks in advance!

    Codepen: http://codepen.io/anon/pen/NdKYjm

    #249546
    Beverleyh
    Participant

    To make the image and the grey text box sit flush up against each other?

    Try removing the default margins on the paragraph element, and also change the default display value of the img from inline-block to block (inline-block elements have extra vertical spacing for hanging letters).

    #249547

    That worked but just have another issue :(

    The container won’t align to the image properly.

    Applying the max-width: 65em on the container solves the issue, but that is a lazy way of doing it, because it only solves the issue on my screen. As soon as I try it on a bigger screen, it looks slightly off.

    #249548

    I know we have to use the media queries for that, but perhaps there is a better way of solving that issue instead of using the max-width property?

    #249549
    Beverleyh
    Participant

    I’m not sure what you mean. Aren’t the image and .project-details div inside the.portfolio-panel div that is confining the width equally?

    Or do you mean that the image width stops expanding when it reaches its natural width, while the text box keeps on getting wider? If so, you can cap it at a max-width that’s the same as the image width (so they match at 600px). There’s nothing wrong with using max-width BTW.

    To offer specific help, we’d need to see a demo that illustrates the problem you’re having.

    #249559
    Atelierbram
    Participant

    Aren’t the image and .project-details div inside the.portfolio-panel div that is confining the width equally? … we’d need to see a demo

    Indeed, … maybe make an account on Codepen?

    Anyway, I updated my fork of your demo with some additions – the ones suggested by @beverleyh, like changing the value for the display property on the image to block, and changing the max-width on the .project__details to 600px.

    Note that the .portfolio__panel is a flex-parent on wider screens now as well. This is done with flex-direction column, which allows us to have equal-height columns (with unequal amounts of text content). The way this is done is with setting the value for the flex-grow property on the .project__details to 2, and a value for the min-heightproperty on the .portfolio__panel wrapper.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.