Box Model Flashcards
Display
how many ways can an element be displayed ?
1: Block Level element
2:Inline elements
3:inline, block
4:flex
5:grid
What is the Box Model?
According to the Box Model concept, every element on page is rectangular box and may have,
1:width
2:height
3:padding
4:Borders
5:Margins
syntax
div {
border: 6px solid #949599;
height: 100px;
margin: 20px;
padding: 20px;
width: 400px;
}
How can We can change an element’s display property value by selecting that element within CSS and declaring a new display property value.
A: P {
display: block;
}
B; p {
display: inline;
}
important distinction with inline-block elements is that they are not always touching, or displayed directly against one another. Usually a small space will exist between two inline-block elements. This space, though perhaps annoying, is norma
important distinction with inline-block elements is that they are not always touching, or displayed directly against one another. Usually a small space will exist between two inline-block elements. This space, though perhaps annoying, is norma
div {
display: none;
}
using a value of none will completely hide an element and render the page as if that element doesn’t exist. Any elements nested within this element will also be hidden.
How does a box model look like ?
1:Margin
2:Border
3:Pading
which formula is used to calculate the total width of
an element?
According to the box model, the total width of an element can be calculated using the following formula:
margin-right + border-right + padding-right + width + padding-left + border-left + margin-left
According to the Box Model, How do we calculate the height of an element?
margin-top + border-top + padding-top + height + padding-bottom + border-bottom + margin-bottom
How to set specifics (width and height ) for styling?
div {
width: 400px;
height: 100px;
}
sizing inline-level elements
what do we need to keep in mind when sizing inline- level elements ?
elements will not accept the width and height properties, or any values tied to them.Block and inline-block elements will, however, accept the width and height properties and their corresponding values.
Margin and Padding.
1:Depending on what factor does the browser apply margin and padding?
2:The default margins and padding for these elements may differ from what to what ? and what to what
3:The ______ may apply default margins and padding to an element to help with legibility and clarity
1:Depending on the element.
2:They may differ from browser to browser and element to element.
3:The browser
1:What does the margin property allow us to do ?
1:It allow us to to set the amount of space that surrounds an element.
1:Where does the margin fall?
2:What can margin be used for ?
3:How to write a margin property.
1:Margins for an element fall outside of any border and are completely transparent in color.
2:Margins can be used to help position elements in a particular place on a page or to provide breathing room, keeping all other elements a safe distance away.
3: div {
margin: 20px;
}
NOTE:
One oddity with the margin property is that vertical margins, top and bottom, are not accepted by inline-level elements. These vertical margins are, however, accepted by block-level and inline-block elements.