text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
those should be the
only ones colored red. | 4,947.76 | 3.41 |
So now, when I refresh this,
I now see that Facebook | 4,951.17 | 2.72 |
is a link that is now colored red,
instead of colored blue, because I've | 4,953.89 | 3.72 |
been very specific about
picking an attribute | 4,957.61 | 2.37 |
that I would like to use in order to
reference that particular HTML element. | 4,959.98 | 5.71 |
And we can use CSS selectors in more
powerful ways too, maybe not just | 4,965.69 | 4.04 |
to style a particular
element always, but to style | 4,969.73 | 2.88 |
an element only under certain
conditions or only when | 4,972.61 | 3.21 |
an element is in a particular state. | 4,975.82 | 2.43 |
And this is very often
done for something | 4,978.25 | 1.71 |
like when you hover over something, when
you hover over a button and something | 4,979.96 | 4.14 |
pops out, or you hover over something
and it changes color slightly. | 4,984.1 | 3.49 |
We can begin to do this by adding
what we call a pseudo class to a CSS | 4,987.59 | 4.7 |
selector. | 4,992.29 | 0.87 |
So let's take a look
at an example of that | 4,993.16 | 2.01 |
to see how we can modify an element
when a user hovers their cursor | 4,995.17 | 4.44 |
over that element, for example. | 4,999.61 | 2.28 |
So I'll go ahead and open up a new file,
hover.html, where here, I'll go ahead | 5,001.89 | 5.49 |
and inside the body of the
page just give myself a button. | 5,007.38 | 3.99 |
This button is going to say, Click Me. | 5,011.37 | 3.54 |
And let's add some style to the button. | 5,014.91 | 1.99 |
By default, buttons show
up as fairly simple buttons | 5,016.9 | 2.43 |
that just look something like this. | 5,019.33 | 1.58 |
I might like to add a little bit more
to this button and say, you know what, | 5,020.91 | 3.3 |
let's add some style to the button,
and give it a width of 200 pixels, | 5,024.21 | 4.8 |
a height of 50 pixels, a
font size of 24 pixels, | 5,029.01 | 4.95 |
and maybe a background
color of green, for example. | 5,033.96 | 4.11 |
So I've specified some size information,
how big I'd like the font to be, | 5,038.07 | 3.87 |
and also a background color for
the button, such that now here's | 5,041.94 | 3.33 |
what that button looks like. | 5,045.27 | 1.17 |
Shrink it down a little bit. | 5,046.44 | 1.16 |
It says, Click Me. | 5,047.6 | 1.69 |
But many buttons, especially nowadays,
they give you a little bit of feedback. | 5,049.29 | 3.96 |
You hover over them, and they
change their color slightly. | 5,053.25 | 3.09 |
How do they do that? | 5,056.34 | 1.18 |
Well, often it's using
a CSS pseudo class, | 5,057.52 | 3.2 |
where I can say button
colon hover, meaning | 5,060.72 | 3.99 |
when I am hovering
over a button, then I'd | 5,064.71 | 3.57 |
like you to change the
background color to orange, | 5,068.28 | 3.91 |
for example, some other color. | 5,072.19 | 2.43 |
So now, I specified that by
default normally for a button, | 5,074.62 | 3.45 |
your background color
should be green, but when | 5,078.07 | 2.37 |
the button is being
hovered over instead, | 5,080.44 | 2.28 |
now change the background
color to orange, | 5,082.72 | 2.76 |
such that now when I open up
this page and go to Click Me, | 5,085.48 | 3 |
if I hover over the button, the
color of the button changes. | 5,088.48 | 3.69 |
Normally green changes to orange. | 5,092.17 | 2.34 |
And so that is a very powerful feature
that we have access to as well. | 5,094.51 | 4.72 |
All right, so now we've seen how
we can use various different CSS | 5,099.23 | 3.08 |
selectors to very precisely define how
we want our web pages to be styled. | 5,102.31 | 4.71 |
But one other thing we can use
CSS for that's quite powerful | 5,107.02 | 2.82 |
is responsive design. | 5,109.84 | 1.86 |
And responsive design
is all about making sure | 5,111.7 | 2.43 |
that our web pages look good, no matter
how you're looking at the web page. | 5,114.13 | 3.57 |
Nowadays, people aren't always looking
at web pages on their computers. | 5,117.7 | 3.11 |
But they're looking at web pages on
their mobile phones or on their tablets | 5,120.81 | 3.13 |
as well. | 5,123.94 | 0.85 |
And it's important as we begin to
design web pages that we design our web | 5,124.79 | 3.2 |
pages in a responsive way. | 5,127.99 | 1.98 |
So we'll look at a
number of different ways | 5,129.97 | 1.8 |
we can implement responsive
design in our web pages, | 5,131.77 | 3.24 |
starting with the
discussion of the viewport. | 5,135.01 | 3.21 |
And what the viewport is is the viewport
is the visual part of the screen | 5,138.22 | 4.41 |
that the user can actually see. | 5,142.63 | 1.91 |
So the viewport is this
entire area of the web page | 5,144.54 | 3.22 |
that displays content to the user. | 5,147.76 | 2.4 |
So one question you might ask is, what's
going to happen when you take this page | 5,150.16 | 3.48 |
and translate it onto a mobile screen? | 5,153.64 | 3.27 |
Well, one thing that many
mobile devices do by default | 5,156.91 | 2.85 |
is treat their viewport as though it
is the same width as a computer screen. | 5,159.76 | 4.65 |
Because not all web pages are optimized
from all device mobile devices, | 5,164.41 | 3.66 |
you want to make sure that on a
mobile device you can see everything. | 5,168.07 | 2.88 |
And so many phones will
take a web page like this | 5,170.95 | 3.12 |
and just shrink it down to
fit onto a mobile screen that | 5,174.07 | 3.87 |
looks a little something like that. | 5,177.94 | 1.86 |
Now, of course, that's probably not
really what we want it to look like. | 5,179.8 | 3 |
Ideally, we want our page to
adapt to different sized screens. | 5,182.8 | 3.69 |
Maybe we want the heading
and the image and the text, | 5,186.49 | 2.4 |
if that's what these are, to grow a
little bit to fill that entire screen. | 5,188.89 | 4.17 |
And so one simple thing we can do
is just to add a little line of code | 5,193.06 | 4.32 |
to our HTML inside the head section of
our page that controls the viewport. | 5,197.38 | 5.16 |
This line of code here is providing some
metadata to our HTML page and saying, | 5,202.54 | 4.92 |
I would like you to
change the viewport to be | 5,207.46 | 2.52 |
specifically the width of the device. | 5,209.98 | 3.09 |
By default, many phones will
use a viewport that's actually | 5,213.07 | 2.55 |
wider than the width
of the device, treat | 5,215.62 | 1.99 |
it as if they're loading
a page in a computer, | 5,217.61 | 2.09 |
and then shrinking it down to
the size of a mobile device. | 5,219.7 | 3.12 |
If you and your web
page specify, though, | 5,222.82 | 2.07 |
that you want the viewport
to be just the device width, | 5,224.89 | 2.91 |
oftentimes a page is going to look a
whole lot better on a mobile device. | 5,227.8 | 5.05 |
But in addition to just
adding a line like this, | 5,232.85 | 2 |
there are other actual
changes we can make | 5,234.85 | 1.83 |
to our page to make it look a
little better on different screens. | 5,236.68 | 3.51 |
And one of those has to
do with media queries. | 5,240.19 | 2.67 |
And media queries are
all about controlling | 5,242.86 | 2.37 |
how our page is going to look depending
on how we render that particular page, | 5,245.23 | 4.83 |
or what size screen we're
rendering that page on. | 5,250.06 | 2.76 |
So let's take a look
at an example of how | 5,252.82 | 2.13 |
we might go about using
media queries in order | 5,254.95 | 3.06 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.