Align Repetitive Regions (Divs)

Asked

Viewed 42 times

-2

I’m having trouble aligning the repetitive regions of DreamWeaver.

As you can see, post 4 respected the order and stood next to the third, and the fifth below it. But the ninth post should be below the seventh, stood next to him below the eighth.

Is there any way to fix it?

  • Felipe, take the Stack Overflow tour and learn the most effective way to ask questions, an answer will come faster.

  • Only with the DreamWeaver and without code it will be difficult

1 answer

0


As you have not put any code, I will pass you a solution that should be adjusted by you in your code.

Following:

  • Let’s assume that all posts have a class, for this example: post.
  • As we can see, they follow a logic where all odd-number posts are on the left and all even-numbered should be on the right.
  • You can use the selector nth-child to achieve the desired effect by adding to your CSS:

    .post:nth-child(odd) {
        clear: both;
    }
    
  • The .post:nth-child(odd) will select everything that contains the class post odd-numbered and will apply the clear: both that will release everything on your side and throw you down. You can also achieve the same effect with a clear: left; that will release only the left.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.