CSS Box-Model

 Css Box-Model :-

It consists of :- Margin, borderpadding and the actual content. 

1.CSS box-model:- Css box-model is a fundamental concepts that defines structure of a web element's layout.

Every element on webpage is considered a box.

Css box-model components layout:-

1.Content :- It is the actual content of the elements ,such as a text or image.
  
2. Padding :- Padding is the space between the content and border.It is used to create space around the content inside the elements.

3. Border :- A line that surrounds padding and content.It is the area between margin and padding.

4. Margin :- Margin is the outermost space around the element. Margin is the space between element's border and neighbouring element.




Coding :-

<html>
 <head>
 <style type="text/css">
    .king
      {
         background-color:skyblue;
         width:270px;
         border:solid 8px green;
          padding:15px;
         text-align:justify;
         margin:15px;
       }
  </style>
<title></title>
</head>
<body>
 <div class="king"> Video provides a powerful way to help prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page and text box designs that complement each other. For example, you can add a matching cover page, header and sidebar. Click Insert, then choose the elements you want from the different galleries.
Themes and styles also help to keep your document coordinated. 
</div>
</body>
</html>


Output is :-





 By hover effects :-
Coding :-

<html>
 <head>
 <style type="text/css">
    .king
      {
         background-color:skyblue;
         width:270px;
         border:solid 8px green;
          padding:15px;
         text-align:justify;
         margin:15px;
       }
        .king:hover
       {
         background-color:orange;
         color:white;
        border:solid 8px red;
       }
</style>
<title></title>
</head>
<body>
 <div class="king"> Video provides a powerful way to help prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page and text box designs that complement each other. For example, you can add a matching cover page, header and sidebar. Click Insert, then choose the elements you want from the different galleries.
Themes and styles also help to keep your document coordinated. 
</div>
</body>
</html>



Output is :-

 
Css border:-

Used to set an element's border:

1. border-width:25px;
2. border-style:dotted/dashed/double/solid
3. border-color:black;
 
Style 1:-

Coding :-

<html>
<head>
<style type="text/css">
 .bob
    {
      border-bottom-style:solid;
      border-top-style:solid;
      border-left-style:solid;
      border-right-style:solid;
      border-bottom-width:8px;
      border-top-width:8px;
      border-left-width:8px;
      border-right-width:8px;
      border-bottom-color:green;
      border-top-color:green;
      border-left-color:green;
      border-right-color:green;
    }
    .tim
    {
      border-bottom-style:dashed;
      border-top-style:dashed;
      border-left-style:dashed;
      border-right-style:dashed;
      border-bottom-width:8px;
      border-top-width:8px;
      border-left-width:8px;
      border-right-width:8px;
      border-bottom-color:pink;
      border-top-color:pink;
      border-left-color:pink;
      border-right-color:pink;
    }
    .kim
    {
      border-bottom-style: dotted;
      border-top-style: dotted;
      border-left-style: dotted;
      border-right-style: dotted;
      border-bottom-width:8px;
      border-top-width:8px;
      border-left-width:8px;
      border-right-width:8px;
      border-bottom-color: skyblue;
      border-top-color: skyblue;
      border-left-color: skyblue;
      border-right-color: skyblue;
    }
    .king
    {
      border-bottom-style: double;
      border-top-style: double;
      border-left-style: double;
      border-right-style: double;
      border-bottom-width:8px;
      border-top-width:8px;
      border-left-width:8px;
      border-right-width:8px;
      border-bottom-color:red;
      border-top-color:red;
      border-left-color:red;
      border-right-color:red;
    }
</style>
<title></title>
 </head>
<body>
 <h1 class="bob">This is solid 
        border.</h1>
 <h1 class="tim">This is dashed
     border.</h1>
<h1 class="kim">This is dotted
    border .</h1>
<h1 class="king">This is double
    border .</h1>
 </body>
</html>
Output is :-














Style 2:-

Coding:-



Output is:-




Style 3:-

Coding:-




Output is:-

Style 4:-

Coding:-



Output is:-




Border-radius:-

Used to round the corners of an element's outer border edges:

1. Border-radius:10px;
2. Border-radius:50%;

1.Border-radius:10px;

Coding :-

<html>
 <head>
  <style type="text/css">
       .bob
         {
            background-color: red;
             height:100px;
             width: 100px;
             border-top-right-radius: 50px;
             border-top-left-radius: 50px;
           border-bottom-left-radius:30px;
         border-bottom-right-radius:
30px;
         }
         .tim
         {
             background-color: orange;
             height:100px;
             width:100px;
             border-radius: 100px;
         }
         .sim
         {
             background-color: skyblue;
             height:100px;
             width:100px;
             border-radius: 30px;
         }

</style>
 <title></title>
</head>
<body>
    <div class="bob"></div>
    <br><br>
    <div class="tim"></div>
    <br><br>
    <div class="sim">
   <br><br>
 </body>
</html>
Output is :-

2.Border-radius:50%;

Coding :-




Output is :-



Comments

Popular posts from this blog

Css basic Properties ✍🏻

Basic Html Notes

Advanced Html Notes