S
S
Smeecy Smeecy2016-08-15 09:46:50
css
Smeecy Smeecy, 2016-08-15 09:46:50

Why are goods crooked?

There is a standard oc 2.0 template, but the products in the categories are displayed crookedly, because of what could this be?
de5e6bcc4b50458e818e4feffd3784a6.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Pautov, 2016-08-15
@Wekeed

Because the product cards are all laid out using float. And, if their height is different, as can be seen in the picture, then they knock out those that lie under them. This is how floats work. Use inline-block, flexbox, or give all blocks the same height. And better limit the height of the title and description of the product using a fixed height + overflow: hidden. And also, to the last paragraph, you can add this property

M
Mike, 2016-08-15
@ddale

On SCSS it will be like this:

@mixin justifyBlocks {
    text-align: justify;
    font-size: 0;
    line-height: 0;
    
    &:after {
        content: '';
        display: inline-block;
        width: 100%;
    }
}

And for all descendants of the first level like this:
> div {
  display: inline-block;
  vertical-align: top;
}

I think I have explained the solution clearly. Ask if anything. =)
PS And to align to the left, then text-align: left, : after - delete, and for descendants, the width in%. In the case of justify, you can also set the width of the child block in%.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question