When utilizing the width
and height
styles, keep in mind that they only affect the inner dimensions of the HTML element. On the other hand, the border weight
dictates the appearance of the outer part of the element.
In one scenario, it seems like there is no room for the content to fit properly.
#Tri{
width:0px;
height:0px;
border-top: 50px solid yellow;
border-right:50px solid red;
border-bottom:50px solid green;
border-left:50px solid blue;
}
Meanwhile, in another case, it appears that there is ample space for the content to expand since the div
element adjusts itself based on the available width
.
#Tri{
border-top: 50px solid yellow;
border-right:50px solid red;
border-bottom:50px solid green;
border-left:50px solid blue;
}
Consulting the principles of the css box model, margin is initially added to create distance between elements on the webpage. Subsequently, borders are applied, showcasing this with the four colored triangles representing the borders. Padding then comes into play, creating space between the content and the border. Lastly, defining the style with width:0px
and height:0px
specifies that these measurements apply strictly within the bounds of the border.