CSS Box Sizing and CSS Word Wrap

The CSS Box size is permits USA to incorporate the artefact and also the border within the total dimension and height of part. CSS Box size is one in all the properties which incorporates artefact and border types of the weather.

CSS box size property is usually used for vogue components behaviors. Content-box model helps to satisfy the default conditions of the CSS designs and can set some prices {in dimension|in breadth|wide |broad} of the content box it’ll enable and for applicable to all or any the hypertext mark-up language contents that we’ve got assigned within the boxes and value are going to be rendered with the ultimate width

Syntax:- The syntax of box sizing to style the size of th box.

<!DOCTYPE html>
<html>
<head>
    <title>Syntax of Box Sizing</title>
    <style type="text/css">
    .element{
        box-sizing: value;
    }
    </style>
</head>
</html>

Example of CSS Box Sizing

Code:-

<!DOCTYPE html>
<html>
<head>
    <title>Example of Box Sizing</title>
    <style type="text/css">
    .s{
        width: 350px;
        height: 150px;
        border: 2px solid skyblue;
    }
    .s1{
        width: 400px;
        height: 200px;
        border: 5px solid black;
    }
    </style>
</head>
<body>
    <h1>Gurukulzone SRCS</h1>
    <div class="s">
        This is the example of box sizing.
    </div>
    <br>
    <div class="s1">
       This is the example of css box sizing. 
    </div>
</body>
</html>

Output:-

CSS Word Wrap

The CSS word wrap may be a feature which will break the words in such a fashion that they are doing not cross the boundary of the instrumentation outlined. The CSS Word Wrap property was custom-made from the feature of constant name offered by Microsoft, wherein, rather than creating the user scroll horizontally, to browse the whole sentence, the sentence is broken into elements, to suit the window.

Syntax:- overflow-wrap: normal| break-word;

Example:-

Normal Feature of Overflow-Wrap

The normal parameter of overflow-wrap, the sentences or string breaks solely at allowable intervals like comma separation or full stops or area between words. it’ll not break long words notwithstanding it’s crossing the boundary.

Code:-

<!DOCTYPE html>
<html>
<head>
    <title>Example of normal feature of overflow-wrap</title>
    <style type="text/css">
       div{
        width: 100px;
        margin: 20px;
        background-color: skyblue;
        border: 5px dotted lightskyblue;
        box-shadow: inset 10px 10px 15px 15px white;
        font-style: italic;
        overflow-wrap:normal;
       } 
    </style>
</head>
<body>
    <h1>Gurukulzone SRCS</h1>
    <p>Example of normal feature of overflow-wrap</p>
    <div>Lorem ipsum dolor sit amet, consectetur adipisicing 
        elit, sed do eiusmod tempor incididunt ut labore et 
        dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip 
    ex ea commodo consequat. </div>
</body>
</html>

Output:-

Break-Word Feature of Overflow-Wrap

When we use the break-word parameter for the overflow-wrap property, it breaks long and otherwise unbreakable words to suit within the outlined instrumentality.

Code:-

<!DOCTYPE html>
<html>
<head>
    <title>Example of Break-Word feature of overflow-wrap</title>
    <style type="text/css">
       div{
        width: 100px;
        margin: 20px;
        background-color: skyblue;
        border: 5px dotted lightskyblue;
        box-shadow: inset 10px 10px 15px 15px white;
        font-style: italic;
        overflow-wrap:normal;
       }
       .cont{
        font-style: italic;
        overflow-wrap: break-word;
    } 
    </style>
</head>
<body>
    <h1>Gurukulzone SRCS</h1>
    <p>Example of Break-Word feature of overflow-wrap</p>

    <div class="cont">Lorem ipsum dolor sit amet, consectetur adipisicing 
    elit, sed do eiusmod tempor incididunt ut 
    labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip 
    ex ea commodo consequat. </div>
</body>
</html>

Output:-

Leave a Reply

Your email address will not be published. Required fields are marked *