Span Tag
The span tag is used to style a small part of text without breaking line. It is an inline element.
<span>text</span>
<p>I am learning <span style="color:red;">HTML</span> today.</p>
Only "HTML" becomes red color.
px, %, vw, vh (CSS Units)
These are used to set size, width, height, spacing.
px (Pixel):
Fixed size unit.
div {
width: 200px;
}
200px = fixed size.
Does NOT change for screen size.
% (Percentage):
Relative to parent element.
div {
width: 50%;
}
Takes 50% of parent width.
vw (Viewport Width):
Relative to screen width.
div {
width: 50vw;
}
1vw = 1% of screen width.
50vw = half of screen width.
vh (Viewport Height):
Relative to screen height.
div {
height: 100vh;
}
100vh = full screen height.
Top comments (0)