CSS Box Model (HTML and CSS tutorial 47) complete course HTML CSS in Hindi

Publicado em: 17 Setembro 2023
no canal de: Academind learn
36
1

Content: This is where the actual content of the element, such as text, images, or other media, resides. It is surrounded by padding, border, and margin.

Padding: This is the space between the content and the inner edge of the element's border. Padding helps create distance between the content and the border, providing visual breathing room.

Border: The border surrounds the padding and content. It is typically a solid line, but it can be styled in various ways, including dashed or dotted lines.

Margin: This is the space between the border of an element and the outer edge of its parent container or adjacent elements. Margins are used to control the spacing between elements on a page.

Here's an illustration of the CSS Box Model:
[---------------------------------]
| Margin |
| [-----------------------------] |
| | Border | |
| | [-------------------------] | |
| | | Padding | | |
| | | [---------------------] | | |
| | | | Content | | | |
{_____________________}

In terms of CSS properties, you can manipulate these components using:

width and height to control the size of the content area.
padding to set the space between the content and the border.
border to style and set the thickness of the border.
margin to control the space outside the border, affecting the element's positioning in relation to other elements.
For example, to set a red border with 10 pixels of padding around a div with a width of 200 pixels and a height of 100 pixels, you might use the following CSS:

div {
width: 200px;
height: 100px;
padding: 10px;
border: 2px solid red;
}
Keep in mind that when you set the width and height properties, you're referring to the content box by default. If you want to include padding and border in the overall dimensions, you'll need to adjust those values accordingly.

Understanding the Box Model is crucial for effective layout design in web development, as it allows you to control the spacing and arrangement of elements on a webpage.
_________________________________________________________________
Thank you 👍


Nesta página do site você pode assistir ao vídeo on-line CSS Box Model (HTML and CSS tutorial 47) complete course HTML CSS in Hindi duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Academind learn 17 Setembro 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 36 vezes e gostou 1 espectadores. Boa visualização!