CSS | коробка украшения перерыв Свойство

Опубликовано: 1 Марта, 2022

Свойство box-decoration-break используется для управления оформлением рамки после фрагментации абзаца. Он определяет фон, отступ, границу, поля и путь обрезки элемента, который применяется, когда блок для элемента разбивается на отдельные части.

Синтаксис:

 коробка-украшение-разрыв: срез | клон | начальный | наследование;

Property values:
slice: This property breaks the edges of the element fragments as a whole.

  • Syntax:
    box-decoration-break: slice;
  • Example:
    <!DOCTYPE html>
    <html>
        <head>
            <title>box-decoration-break property</title>
            <style>
                body {
                   text-align:center; 
                   width:80%;
                }
                span {
                    border: 2px solid green;
                    padding: 5px;
                    border-radius: 6px;
                    font-size: 24px;
                    line-height: 3;
                      
                }
                span.geek{ 
                    -webkit-box-decoration-break: slice;
                    -o-box-decoration-break: slice;
                    box-decoration-break: slice;
                      
                }
                .gfg {
                    font-size: 40px;
                    color: green;
                    font-weight: bold;
                }
            </style>
        </head>
        <body>
            <div class = "gfg">GeeksforGeeks</div>
            <div class = "geeks">
              A computer science portal for geeks
            </div>
            <h2>box-decoration-break: slice;</h2>
            <span class="geek">
                Prepare for the Recruitment drive
                of product based companies<br>
                like Microsoft, Amazon, Adobe etc 
                with a free online placement<br>
                preparation course. The course focuses 
                on various MCQ"s & Coding<br>
                question likely to be asked in the 
                interviews & make your<br>
                upcoming placement season efficient
                and successful.
            </span>
        </body>
    </html>                    
  • Output:

Clone: It is used to decorate each fragment of the element as if the fragments were unbroken, individual elements. Borders wrap the four edges of each fragment of the element, and backgrounds are redrawn in full for each fragment.

  • Syntax:
    box-decoration-break: clone;
  • Example:
    <!DOCTYPE html>
    <html>
        <head>
            <title>box-decoration-break property</title>
            <style>
                body {
                   text-align:center; 
                   width:80%;
                }
                span {
                    border: 2px solid green;
                    padding: 5px;
                    border-radius: 6px;
                    font-size: 24px;
                    line-height: 3;
                      
                }
                span.geek{ 
                    -webkit-box-decoration-break: clone;
                    -o-box-decoration-break: clone;
                    box-decoration-break: clone;
                      
                }
                .gfg {
                    font-size: 40px;
                    color: green;
                    font-weight: bold;
                }
            </style>
        </head>
        <body>
            <div class = "gfg">GeeksforGeeks</div>
            <div class = "geeks">
                A computer science portal for geeks
            </div>
            <h2>box-decoration-break: clone;</h2>
            <span class="geek">
                Prepare for the Recruitment drive
                of product based companies<br>
                like Microsoft, Amazon, Adobe etc 
                with a free online placement<br>
                preparation course. The course focuses 
                on various MCQ"s & Coding<br>
                question likely to be asked in the 
                interviews & make your<br>
                upcoming placement season efficient
                and successful.
            </span>
        </body>
    </html>                    
  • Output:

initial: It sets the property to its default value.

  • Syntax:
    box-decoration-break: initial;
  • Example:
    <!DOCTYPE html>
    <html>
        <head>
            <title>box-decoration-break property</title>
            <style>
                body {
                   text-align:center; 
                   width:80%;
                }
                span {
                    border: 2px solid green;
                    padding: 5px;
                    border-radius: 6px;
                    font-size: 24px;
                    line-height: 3;
                      
                }
                span.geek{ 
                    -webkit-box-decoration-break: initial;
                    -o-box-decoration-break: initial;
                    box-decoration-break: initial;
                      
                }
                .gfg {
                    font-size: 40px;
                    color: green;
                    font-weight: bold;
                }
            </style>
        </head>
        <body>
            <div class = "gfg">GeeksforGeeks</div>
            <div class = "geeks">
                A computer science portal for geeks
            </div>
            <h2>box-decoration-break: initial;</h2>
            <span class="geek">
                Prepare for the Recruitment drive
                of product based companies<br>
                like Microsoft, Amazon, Adobe etc 
                with a free online placement<br>
                preparation course. The course focuses 
                on various MCQ"s & Coding<br>
                question likely to be asked in the 
                interviews & make your<br>
                upcoming placement season efficient
                and successful.
            </span>
        </body>
    </html>                    
  • Output:

Поддерживаемые браузеры: браузеры, поддерживаемые свойством box-decoration-break , перечислены ниже:

  • Google Chrome 22.0 -webkit-
  • Firefox 32.0
  • Opera 11.5 -webkit-
  • Safari 6.1 -webkit-