Lecture 6
Lecture 6
LECTURE 06
2
Box sizing
9/15/2024
3
Box Sizing
The box-sizing property allows us to include the padding and border in an element's total width and
height.
If you set box-sizing: border-box; on an element, padding and border are included in the width and height.
.div1 {
width: 300px;
height: 100px;
border: 1px solid blue;
box-sizing: border-box;
}
.div2 {
width: 300px;
height: 100px;
padding: 50px;
border: 1px solid red;
box-sizing: border-box;
}
9/15/2024
4
Psedo Class Selectors
9/15/2024
5
Pseudo-element Selectors
9/15/2024
6
Pseudo-element Selectors
The ::first-line pseudo-element is used to add a special style to the first line of a text.
The ::first-letter pseudo-element is used to add a special style to the first letter of a
text.
The ::first-line pseudo-element can only be applied to block-level elements.
The ::before pseudo-element can be used to insert some content before the content
of an element.
The ::after pseudo-element can be used to insert some content after the content of
an element.
The ::marker pseudo-element selects the markers of list items.
The ::selection pseudo-element matches the portion of an element that is selected
by a user.
9/15/2024
Attribute Selectors
The attribute selectors can be useful for styling forms without class or ID:
input[type="text"] {
width: 150px;
display: block;
margin-bottom: 10px;
background-color: yellow;
}
input[type="button"] {
width: 120px;
margin-left: 35px;
display: block;
}
Activity