CSS ESSENTIAL 1 Flashcards
layout, Responsive design
an element is ____ if the total height of an element is equal to its content and width is equal to the full width of the document (e.g. div,p,)
Block element
Can Block element contain either inline or block element(s)?
Yes!
an element is _____ if the total height of an element is equal to its content and width is <b>equal to the width of the content</b>, and only contain inline
inline element
is there an extra space between block element and another element?
yes! there is extra space after an inline element
How could you define a margin/padding of an HTML element? What are different ways to define margin/padding?
https: //i.imgur.com/kmketX6.png
1. to define a margin: of an element start at the top, right, bottom, left(clockwise)
2. Other ways are:
2. 1. margin: Top, [left and right], bottom;
2. 2 margin: [top and bottom], [left and right]
div{ width:950px; margin:0 auto; } So what is this snippet code does and its purpose?
set the width to 950px, and top and bottom margin to 0 and left and right to auto;
What is max-width? how to use it?
It is a CSS property that sets the max-width of an object. if the contained element is larger that containing the element, then the height of the containing element is adjusted to fit the contained element.
<a>dfdf</a>
a{ padding:20px; border:solid black; } what is the purpose of padding for this scenario?
<a>
is more clickable</a>
https://1drv.ms/u/s!Ant-SckYa-42g8s3bDYngWihVKeDAg
Why this happen after float:left is applied?
If you float an element, the precending elements will wrap on it and the natural flow of elements are changed?
what clear:both does
to not wrap the precending elements to the floated element
use of overflow:auto; and overflow:hidden;
to clear float for the parent of floated element. floated element overflows to the containing element. clearfix also clear the floated element(search it)
what #container does here
https://jsfiddle.net/testoftheyearend/opk24agb/10/
to not wrap preceding element use container (#container)
width should be defined
https://jsfiddle.net/testoftheyearend/smta9L2r/1/
CLEARFIX
The ________ property specifies the display behavior (the type of rendering box) of an element.
display
What is the total width and height, content box width and content height?
div.content-box {
width: 160px;
height: 80px;
padding: 20px;
border: 8px solid red;
background: yellow;
}
.content-box {
box-sizing: content-box;
}
/* Total width: 160px + (2 * 20px) + (2 * 8px) = 216px
Total height: 80px + (2 * 20px) + (2 * 8px) = 136px
Content box width: 160px
Content box height: 80px */
content is the defualt box-sizing property value which means the borser, margin, padding are not included to the overall size of content box(width and height).