Problem with border-image

0

HTML:

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Nuevos Estilos</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="style.css" />
    <script src="main.js"></script>
</head>
<body>
    <header id="principal">
        <span id="titulo">Estilos CSS Web 2.0</span>
    </header>
</body>
</html>

CSS:

body{
    text-align: center;
}

#principal{
    display: block;
    width: 500px;
    margin: 50px auto;
    padding: 15px;
    text-align: center;

    border: 29px;
    -moz-border-image: url("diamonds.png") 29 stretch;
    -webkit-border-image: url("diamonds.png") 29 stretch;
    border-image: url("diamonds.png") 29 stretch; 
}

#titulo{
    font: bold 36px MiNuevaFuente, verdana, sans-serif;
    color: hsla(304, 37%, 31%, 0.5);
}

@font-face{
    font-family: 'MiNuevaFuente';
    src: url('font.ttf');
}

I want to place the border-image but when I execute it, the border does not appear in the browser.

    
asked by Génesis 06.11.2018 в 14:29
source

2 answers

1

You have the problem in the property border , you should put it like this:

border: 29px solid transparent;

Apart from the thickness of the border, you should indicate your texture solid so that it has a full coverage of the entire border and you indicate that it is transparent so that you can see the image.

body{
    text-align: center;
}

#principal{
    display: block;
    width: 500px;
    margin: 50px auto;
    padding: 15px;
    text-align: center;
    border: 29px solid transparent;
    -moz-border-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7CGAyIuH7UED1c3EyrfcsQ0W4pYWT_eCjOPa28tikB-kBkAjKcA") 29 round;
    -webkit-border-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7CGAyIuH7UED1c3EyrfcsQ0W4pYWT_eCjOPa28tikB-kBkAjKcA") 29 round;
    -o-border-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7CGAyIuH7UED1c3EyrfcsQ0W4pYWT_eCjOPa28tikB-kBkAjKcA") 29 round;
    border-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7CGAyIuH7UED1c3EyrfcsQ0W4pYWT_eCjOPa28tikB-kBkAjKcA") 29 round; 
}

#titulo{
    font: bold 36px MiNuevaFuente, verdana, sans-serif;
    color: hsla(304, 37%, 31%, 0.5);
}

@font-face{
    font-family: 'MiNuevaFuente';
    src: url('font.ttf');
}
<header id="principal">
  <span id="titulo">Estilos CSS Web 2.0</span>
</header>
    
answered by 06.11.2018 в 14:42
1

Remove quotes in border properties:

#principal{
   display: block;
   width: 500px;
   margin: 50px auto;
   padding: 15px;
   text-align: center;

   border: 29px;
   -moz-border-image: url(diamonds.png) 29 stretch;
   -webkit-border-image: url(diamonds.png) 29 stretch;
   border-image: url(diamonds.png) 29 stretch; 
}
    
answered by 06.11.2018 в 14:44