Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
understanding border-images to fill perfectly without streching

I try to use an image as a border image for a div.

The div width and height changes (I don't know how the dimensions will be)

The border-images width and height changes (I don't know how the dimensions will be)

I really tried to understand what is slicing doing, but I can't get a dynamic formula so that any given border-image will look good for any given div size (look good = not sctreched, filled,nicely repeated as long the border-image is seamless)

for a given border-image pineapple.png with a dimension 1584x1200px => 105 133 round looks good, but how do I get this magic numbers? What numbers use there for slice to get a crispy border-image regarding not violating its proportions? Is it depending on the div size AND the border-image size?

div{
background:red;
height:100px;
width:400px;
border: solid 5vmin transparent;
border-width: 5.67909vmin;
border-image: url(https://cdn.dribbble.com/users/4297010/screenshots/7740500/media/7c2554596ed3249419127182c5199e65.jpg)105 133 round;
}
<div>
</div>

Javascript solutions are also much appreciated

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda