Ganesan C
What is box-sizing property in CSS and its use?

What is box-sizing property in CSS and its use?

By Ganesan C in CSS on Aug 12 2021
  • Deepak Rawat
    Apr, 2023 20

    We set the box sizing property of all items to the bounding box using the universal selector *. This ensures that the total width and height of each element include its content, padding, and border. This makes it easy to modify the content and make it fit its specifications.

    1. /* Default box-sizing */
    2. .deepak {
    3. width: 300px;
    4. padding: 20px;
    5. border: 5px solid black;
    6. margin: 10px;
    7. }
    8. /* Apply border-box to all elements */
    9. * {
    10. box-sizing: border-box;
    11. }

    • 0
  • Md Sarfaraj
    Aug, 2021 16


Most Popular Job Functions


MOST LIKED QUESTIONS