problem when creating a triangle in after da div with css

Asked

Viewed 87 times

1

staff needed to create a triangle in my :after of my div however this Shape would have to be 100% wide I made a triangle Shape but it is with fixed width and this can not because in mobile it gets bad and when the site opens in bigger screens it gets crooked follow prints of what I did with the code:

inserir a descrição da imagem aqui
inserir a descrição da imagem aqui

Css that creates the triangle:

#lp-pom-block-875{
    position: relative;
  }

  #lp-pom-block-875:after{
    content: '';
    display: block;
    position: absolute;
    top: -60px;
    left: 0;
    width: 100%;
    height: 0;
    border-left: 680px solid transparent;
    border-right: 680px solid transparent;
    border-bottom: 60px solid #f9f0e9;
  }

NOTE: Notice that in the images I showed the triangle does not fit by the fixed size and I do not know how to give a size of 100%;

1 answer

1

You can’t use position Absolute, or you lose responsiveness. This width 100%, does not work with position Absolute.

Daria para tentar usar media queries ou teria de mudar para relative e ajustar na tela.

  • To use media queries that’s the problem and if I don’t use absolute position it doesn’t get on my div

  • Are you sure? if you put relative, in all Ivs, ai in the lower div, Voce puts a style margin-top: -50px for example, da para usar valor negativo.

Browser other questions tagged

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