text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
And the Alt text that I'll use in this case
1,151.57
2.4
is just going to be the word cat, for example.
1,153.97
3.45
And that's all I need.
1,157.42
1.05
Now, notice in particular there's something a little bit
1,158.47
2.34
different about this image tag compared to other tags
1,160.81
2.94
that we've seen before in the sense that it doesn't have a closing
1,163.75
3.36
tag in the sense that the body had a beginning of the body and an end
1,167.11
3.58
to the body, our ordered list had a beginning of the ordered list
1,170.69
2.9
and the end of the unordered list with list items in between.
1,173.59
2.82
It doesn't really make sense for an image,
1,176.41
2.97
for example, to have the beginning of the image
1,179.38
2.07
and the end of the image and some content
1,181.45
1.8
in between, because the image is just a single HTML element that can't really
1,183.25
4.68
have anything inside of it.
1,187.93
1.86
So in that sense, we don't actually need a closing image tag.
1,189.79
3.21
The image tag is self-closing.
1,193
1.93
It is its own beginning and end.
1,194.93
1.88
So we can just say we want an image to be here
1,196.81
2.79
that is cat.jpeg with an alternative text of just the word cat, for example.
1,199.6
6.1
So now, if I open up image.html, we'll see
1,205.7
3.41
that what gets loaded is quite large, a picture of a cat.
1,209.11
3.69
And I can scroll around and see this entire image.
1,212.8
2.97
Of course, this picture of a cat is probably larger than I wanted it to be.
1,215.77
3.19
I probably, when I my user visits this web page,
1,218.96
2.05
I don't want them to have to scroll all the way to the right
1,221.01
2.5
in order to see the entire cat.
1,223.51
1.77
So I can actually add additional HTML attributes
1,225.28
3.15
in order to modify the size of the image that I'm displaying.
1,228.43
3.03
And later we'll see we can use CSS to do a similar thing as well.
1,231.46
3.52
But for now, what I can add is an additional attribute
1,234.98
3.23
and say that let me give cat.jpeg, this image tag,
1,238.21
3.3
another attribute that, in this case, I'll just call width.
1,241.51
3.21
And I'll say that width is going to be equal to 300,
1,244.72
3.15
because I would like for this image to be 300 pixels wide, for example.
1,247.87
4.96
So now, if I refresh this page, I now see
1,252.83
2.3
that the same cat image appears, except now it
1,255.13
2.4
appears at 300 pixels wide exactly.
1,257.53
2.73
So I'm able to add additional attributes, additional information
1,260.26
3.69
to control how an HTML element is going to appear.
1,263.95
3.17
In this case, I want to control its width,
1,267.12
1.75
and it automatically scales down the height
1,268.87
1.92
to make sure that the image is proportional as well.
1,270.79
3.68
Now, on the internet, in addition to just displaying information
1,274.47
2.88
on a single page, it's also common for a page to link to other pages.
1,277.35
4.21
In fact, that's one of the main important values
1,281.56
2
of the internet is the ability to go from one page
1,283.56
2.34
to another via these links.
1,285.9
2.19
And so one thing we might reasonably want to do
1,288.09
2.28
is add some links to our page, where if you click on something,
1,290.37
2.82
you're taken to another page altogether.
1,293.19
2.73
So let's take a look at an example of that.
1,295.92
2.71
I'll create a new file based on hello.html.
1,298.63
2.96
And I'll add lang equals English for good measure.
1,301.59
2.42
And I'll call this new file link.html, where here, we're
1,304.01
4.24
going to practice with building some links into our HTML page.
1,308.25
4.1
I'll copy the content of hello.html again, call this link.
1,312.35
5.58
In order to create a link, I'm going to use a tag
1,317.93
2.48
called the a tag, short for the anchor tag.
1,320.41
3.57
And the a tag takes one important attribute,
1,323.98
2.79
which is called href, for hyperlink reference, which
1,326.77
3.69
is going to specify what page I would like to link to.
1,330.46
3.82
So if, for example, I wanted when a user clicks on this link
1,334.28
2.81
to go to google.com, then I'd set the href attribute
1,337.09
3.69
of this tag equal to HTTPS://google.com, for example.
1,340.78
7.04
Then inside of the a tag, I would specify what text I want to display.
1,347.82
4.83
What text should the user see such that when the user clicks on that text
1,352.65
3.81
they're taken to the web page?
1,356.46
1.6
In this case, I'm just going to say something like, Click here,
1,358.06
3.62
for instance.
1,361.68
2.03
Now, if I open up a link.html, this is what the user sees.
1,363.71
5.46
They see a blue link that says Click here.
1,369.17
2.28
And when the user does click on that link,
1,371.45
2.55
they're taken to HTTPS://google.com.
1,374
4.75
And it turns out that we can use this href attribute not only
1,378.75
3.09
to link to different websites altogether,
1,381.84
2.31
but we can link to different pages on the same website.
1,384.15
3.54
So, for example, if I wanted to link to that cat page
1,387.69
2.73
that I designed a moment ago, instead of linking to google.com,
1,390.42
3.9
I could instead just link to image.html.
1,394.32
4.53
And now, if I save that and refresh, or if I open up link.html again,
1,398.85
5.94
now I see a click here link, where when I click on Click here,
1,404.79
3.21
now I'm taken to that page, image.html, that
1,408
3.63
happened to have that picture of a cat from before.
1,411.63
3
So using these anchor tags and href attributes,
1,414.63
3.03
we're able to link together multiple pages.
1,417.66
1.83
So that if we have a website that has many different web pages,
1,419.49
2.79
we can connect them all together by using a combination
1,422.28
3.03
of these various different links.
1,425.31
2.58
So now that we've seen images and links and lists, what other HTML elements
1,427.89
4.44
might we add to our web page?
1,432.33
1.65
Well, one thing we might want to add are things
1,433.98
1.95
like tables, just other ways of displaying information.
1,435.93
2.65
So let's go ahead and create a table and look at what HTML elements
1,438.58
3.47
we can use in order to do so.
1,442.05
2.71
So I'll go back here to my text editor, create a new file called table.html.
1,444.76
4.46
Using the same starting HTML, we'll call this page Table.
1,449.22
4.96
And inside the body of this page now, there
1,454.18
2.33
are a number of different HTML elements that we'll
1,456.51
2.49
need in order to create a table, because as you might imagine,
1,459
3.07
a table is really composed of multiple parts.
1,462.07
2.42