text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
Like this Hello World, for example, is very close to the edge
3,334.21
4.29
of this particular div.
3,338.5
1.23
It's right up against the upper left corner of that div.
3,339.73
2.78
I might want to change that by adding what
3,342.51
1.75
we might call some padding to this particular HTML element, some space,
3,344.26
4.17
just so that the content of the element isn't
3,348.43
2.28
so close to the border of the element itself.
3,350.71
3.7
So, for example, one thing I can do is inside this div add some padding.
3,354.41
4.19
Say maybe I want 20 pixels worth of padding on the inside of the element,
3,358.6
4.9
such that now when I refresh the page, we
3,363.5
2.72
see that we have some padding along the outside of the element.
3,366.22
3.22
So that Hello World now shows up not right up
3,369.44
2.33
against the edge of the element, but inside a little bit as well.
3,371.77
4.42
And if we have a particular HTML element that
3,376.19
1.94
maybe is too close to the edge of the screen,
3,378.13
2.13
maybe it's too close to the top of the screen,
3,380.26
2.23
we can also add space around outside of the element
3,382.49
3.17
by adding what we call margin to the element as well.
3,385.66
2.92
So I can say let's give it 20 pixels of margin inside of this div.
3,388.58
4.31
And then refresh.
3,392.89
1.11
And now we see that whereas before this div was very close
3,394
3.84
to the upper left edge of the screen, now
3,397.84
2.1
we've moved it 20 pixels away from everything.
3,399.94
2.44
So it's got some space on all four sides of it.
3,402.38
3.71
So that's how we can now use margin and padding just
3,406.09
2.95
to make the page look a little bit nicer to the user.
3,409.04
2.21
So objects are not too close together or too far apart.
3,411.25
3.24
Padding, again, is on the inside of the border of the element.
3,414.49
3.57
I can add 20 pixels of padding, for example,
3,418.06
2.65
to make sure that the content inside of the element,
3,420.71
2.4
in this case, the words Hello World, just have a little bit of space
3,423.11
3.35
from the border.
3,426.46
0.93
And that's padding on the inside of the element.
3,427.39
2.22
Margin, meanwhile, is on the outside of the element.
3,429.61
2.76
We add some margin along the outside of the border to space
3,432.37
3.06
the element out from other elements that might
3,435.43
2.19
be nearby it to make sure that there's enough space between the border
3,437.62
3.06
of the element from the top of the screen and also from the left
3,440.68
2.74
and also the bottom and the right, though there's no objects there
3,443.42
2.75
that we're currently creating space from.
3,446.17
2.67
So by combining width and height and margin and padding,
3,448.84
3.66
we now have the ability, using CSS, to make sure
3,452.5
3.06
that we're able to layout our page the way we want to lay out the page,
3,455.56
3.05
so that elements have the right amount of spacing from each other
3,458.61
2.71
and are the correct size.
3,461.32
2.16
So now, let's take a look at some other features that CSS is going to give us.
3,463.48
3.93
In addition to just changing where particular elements are,
3,467.41
2.94
like centering text or adding size and margin and padding,
3,470.35
3.24
we can also use CSS to change how elements actually look.
3,473.59
3.66
We've seen it to change the color of text, changing it from one color,
3,477.25
3
like black, to another color, like blue.
3,480.25
2.49
But we can also use CSS to be able to change something like the font
3,482.74
4.29
that we use in order to display text.
3,487.03
2.19
Modern web pages don't show everything in the exact same font.
3,489.22
2.97
Usually, some designer is choosing what font
3,492.19
2.4
they want for any particular web page.
3,494.59
3.18
So let's experiment with those possibilities.
3,497.77
2.05
I'll now create a new file that I'll call font.html,
3,499.82
4.4
inside of which will be an HTML page called font.
3,504.22
5.23
And inside the body, I'll again just have a div
3,509.45
2.02
that says Hello World, same as before.
3,511.47
3.27
But now, inside of the style tag here, up in the head section of my web page,
3,514.74
4.98
I would like to add some font information to this div.
3,519.72
4.02
And in particular, there are a number of different font-related CSS properties
3,523.74
3.66
that I can add to control the font of any particular HTML element.
3,527.4
4.53
One thing I can specify is the font family,
3,531.93
3.18
specifying what font would I like to use in order to display this text.
3,535.11
4.89
And maybe I want to display it in Arial, for example,
3,540
2.63
which is a common font used on the internet, such
3,542.63
2.92
that now if I open up font.html, I now see in Arial the words Hello World,
3,545.55
6.84
different from the text that I was using before.
3,552.39
3.09
You can also specify multiple different fonts.
3,555.48
2.76
Not all computers support all fonts.
3,558.24
1.92
So I could specify that just in case Arial isn't supported,
3,560.16
3.63
fall back to any sans serif font, any of the fonts that
3,563.79
3.57
don't have the little glyphs at the edge of each of the characters.
3,567.36
3.34
So now, if I refresh the page, because my web browser supports Arial,
3,570.7
3.2
I don't notice anything different.
3,573.9
1.44
But you might imagine if you're using more complex fonts that not all web
3,575.34
3.04
browsers have or support, you might add some backups just
3,578.38
2.78
in case the font you want isn't actually available.
3,581.16
3.81
In addition to a font family, I might also
3,584.97
2.01
specify a font size, how big I want the font to be inside of this div.
3,586.98
4.33
So I can specify that I'd like the font size of this give to be, you know,
3,591.31
3.6
28 pixels, for example, such that now I refresh it.
3,594.91
3.23
And now, this div appears using larger text.
3,598.14
3.48
And I can also, just as like text editors
3,601.62
2.22
let you specify whether you want it to be normal text or bolded text,
3,603.84
3.81
I can specify a font weight for this div and say
3,607.65
3.51
that in addition to being in font Arial in size 28,
3,611.16
2.97
I would also like for the font to be bold, such that now I refresh it,
3,614.13
3.96
and now, the font shows up as bold.
3,618.09
2.73
And using these CSS style sheets, we're able to selectively apply
3,620.82
3.57
the styling to only particular parts of the web page.
3,624.39
3.48
If I have another underneath this div some more text down here, for example,
3,627.87
5.16
that additional text that's outside of the div
3,633.03
2.73
isn't going to be affected by the CSS styling, such
3,635.76
3.12
that now if I refresh this page or some more text
3,638.88
2.64
shows up in that same standard default font provided by my web browser and not
3,641.52
4.92
the custom font that I have specified to apply to only
3,646.44
3.06