text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
meaning what I'm about to link is going
to be a style sheet for this page. | 3,021.74 | 3.54 |
It's going to describe how I want for
the elements on this page to be styled. | 3,025.28 | 4.4 |
And then, just as in the case
of a link to another page, | 3,029.68 | 2.85 |
I use href to specify a hyperlink
reference, what I want to link to, | 3,032.53 | 5.01 |
I'm now going to specify
using an href attribute what | 3,037.54 | 3.39 |
CSS file I would like to know link. | 3,040.93 | 2.19 |
And in this case the CSS file that
I'm going to link is styles.css. | 3,043.12 | 5.04 |
That is the file that just so
happens to contain all of the CSS | 3,048.16 | 3.63 |
that I would like to apply
to this particular file. | 3,051.79 | 3.6 |
Now, if I refresh the page, I
see again nothing has changed. | 3,055.39 | 3.99 |
In the last two revisions, the
page has stayed exactly the same | 3,059.38 | 2.82 |
as far as the user is concerned. | 3,062.2 | 1.47 |
They still see two headings. | 3,063.67 | 1.2 |
Both of them are centered. | 3,064.87 | 1.09 |
Both of them are blue. | 3,065.96 | 1.22 |
But now, the advantage
is that here is my HTML. | 3,067.18 | 3.3 |
It's shorter than it was before. | 3,070.48 | 1.87 |
And in particular, there's no CSS that's
baked in to this HTML file at all. | 3,072.35 | 4.76 |
I factored it all out into
the separate styles.css file. | 3,077.11 | 4.38 |
And now if I have multiple HTML files
that are all using the same styling, | 3,081.49 | 4.68 |
I can just link them all
to the same styles.css | 3,086.17 | 3.36 |
file, such that they're all
using the same style information. | 3,089.53 | 3.72 |
I don't need to repeat myself. | 3,093.25 | 1.56 |
And if ever I need to make a
change across all of those pages, | 3,094.81 | 3.42 |
I just change the styling once. | 3,098.23 | 1.95 |
I change the styles.css file. | 3,100.18 | 2.37 |
And then all of the web pages that
are linked to that style sheet | 3,102.55 | 3.66 |
will update as well in order
to reflect those changes. | 3,106.21 | 3.2 |
So again, we've been able to factor
out some of this style information | 3,109.41 | 3.67 |
to a separate file just to make
our lives a little bit easier. | 3,113.08 | 4.25 |
All right, so so far
we've now seen how we | 3,117.33 | 1.75 |
can CSS in a number of different ways
to add some basic styles to our page. | 3,119.08 | 4.29 |
We've seen that we can take an
element and change its color. | 3,123.37 | 2.86 |
We've seen how we can take an
element and change its alignment, | 3,126.23 | 2.63 |
move it from left aligned to right
aligned to centered, for example. | 3,128.86 | 3.12 |
As it turns out, there are a
lot of different CSS properties | 3,131.98 | 2.88 |
that we can add to our
HTML elements in order | 3,134.86 | 2.94 |
to style them in various different
ways, more than we'll have time | 3,137.8 | 3.54 |
to talk about in this lecture. | 3,141.34 | 1.6 |
But now, let's just
take a look at a couple | 3,142.94 | 1.82 |
of the most popular, most
common CSS properties | 3,144.76 | 2.81 |
that we can add in order to make our
web pages look the way we wanted to. | 3,147.57 | 4.84 |
And one of the most
powerful tools for CSS | 3,152.41 | 2.31 |
is controlling the size of
various different elements. | 3,154.72 | 2.85 |
By default, HTML just used a default
size for everything on the page. | 3,157.57 | 4.14 |
But if I want to more precisely control
how big any particular element is I | 3,161.71 | 4.62 |
can use CSS in order to do so. | 3,166.33 | 3.1 |
So let me now create a new file
that I will call a size.html. | 3,169.43 | 4.31 |
We'll start with the same HTML
code and call the page Size. | 3,173.74 | 5.48 |
And now, inside the body
of my page, let me just | 3,179.22 | 2.94 |
have a vertical section of my
page, just some section of my page | 3,182.16 | 3.24 |
that's going to have some content. | 3,185.4 | 1.72 |
And I'm going to put
this inside of a div tag. | 3,187.12 | 3.38 |
Now, this is the first time
that we've seen a div in HTML. | 3,190.5 | 2.7 |
You can think of a
div as just a division | 3,193.2 | 2.52 |
of the page, some section
of the page that's going | 3,195.72 | 2.55 |
to have some content inside of it. | 3,198.27 | 1.74 |
And we use divs because it makes it easy
to reference a particular div or nest | 3,200.01 | 4.74 |
information inside of other pieces
of information, or just to divide | 3,204.75 | 3.54 |
and break up our page into
multiple different sections. | 3,208.29 | 2.82 |
Here, inside of the body,
I'm just going to have | 3,211.11 | 2 |
a single div that is going to
say something like hello world. | 3,213.11 | 3.97 |
And now, I'm going to add
some style to this page | 3,217.08 | 2.94 |
in order to control
the size of this div, | 3,220.02 | 2.22 |
to control the size of this
section of my web page. | 3,222.24 | 3.24 |
I could use inline styling. | 3,225.48 | 1.35 |
I could factor things
out into another file. | 3,226.83 | 1.95 |
But since I'm only dealing
with one file for now, | 3,228.78 | 2.49 |
I'm just going to add a style
section to the top of my web page | 3,231.27 | 2.88 |
just so you can more clearly
see how the style of this page | 3,234.15 | 2.88 |
is going to map on to the way that
we're modifying these HTML elements. | 3,237.03 | 5.25 |
And I would like to style
this div in a couple of ways. | 3,242.28 | 3.7 |
One thing I can do is give
the div a background color. | 3,245.98 | 2.25 |
Let me change its background
color to blue, for example. | 3,248.23 | 3.77 |
And then I can say, all right,
I'd like to give this div a width | 3,252 | 2.94 |
and a height, some size information. | 3,254.94 | 2.37 |
I can say, go ahead and give
this div a width of 100 pixels | 3,257.31 | 3.78 |
and maybe a height of 400 pixels. | 3,261.09 | 4.5 |
So now, when I go ahead and open
up size.html, this is what I see. | 3,265.59 | 5.99 |
I see in a 100 by 400 pixel
wide vertical, or rectangular, | 3,271.58 | 4.53 |
section of my page, I see
the words Hello World. | 3,276.11 | 3.45 |
And so you might imagine if you
have multiple different elements | 3,279.56 | 2.67 |
on your page, as your web pages start
to get a little bit more complex, | 3,282.23 | 3.06 |
you probably want to have some
more precise control over how wide | 3,285.29 | 3.3 |
or how tall any particular element is. | 3,288.59 | 2.4 |
And these width and height
attributes can be very helpful | 3,290.99 | 2.61 |
because I can very easily change
the width to say like 500 pixels, | 3,293.6 | 3.21 |
for example. | 3,296.81 | 1.02 |
And now when I refresh the page, now
I see that the width of this page, | 3,297.83 | 3.29 |
or this div, the section of the page,
has actually now gotten a lot wider. | 3,301.12 | 4.95 |
And so we have the ability
to control size using CSS. | 3,306.07 | 4.45 |
Go ahead and can close some of
these pages that I no longer need. | 3,310.52 | 3.04 |
And now take a look at some
other things that we can do. | 3,313.56 | 2.54 |
In addition to controlling
the size-- and let | 3,316.1 | 1.59 |
me change this color to
something a little bit lighter, | 3,317.69 | 2.29 |
something like orange, such that now
if I open up size, it looks like this. | 3,319.98 | 5.16 |
I'll make this a little bit smaller. | 3,325.14 | 1.62 |
Let's try 200 by 200 pixels. | 3,326.76 | 2.95 |
It looks now like this. | 3,329.71 | 1.41 |
You might imagine there are some other
changes that I might like to make. | 3,331.12 | 3.09 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.