All language subtitles for 23 - Responsive width.en

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

- In the last video, we just looked

at how we can use the image element and the srcset attribute

to list a set of image files and have the browser decide

which file to download and display

considering the pixel density of the screen.

What if instead we want the browser

to consider the width of the viewport

and to choose a file based on the size of the screen

as well as the density?

Let's look at a demo.

It's very similar to the one I just showed in the last video

with four images listed inside of a srcset attribute.

But this time instead of saying one x, two x,

three x, four x,

we'll tell the browser how wide each file is,

480w, 960w.

That means 480 pixels wide, 960 pixels wide.

Now the browser will dynamically choose

which image to display based on a combination

of device density and viewport width.

This is not going to pick the right size image

for the layout that you have.

It's choosing the image based on an assumption

that you need the image to be 100% of the viewport width.

So why?

Well, this system is designed to be fast

and for the browser to make a decision

about which image to download

as early as possible in the page loading process.

It chooses the image file before the CSS has been parsed

and before layout has happened.

So the browser has no idea

what you're going to do with that image.

It doesn't know what the size of the box is going to be

where the image is going.

If we know the image is going to be a lot smaller

than the width of the whole page,

we probably want to add more information here

for the browser to use when it's making its choice

about which file to grab.

Here, I've used CSS to make this image half the width it was

in the last demo,

but the browser is still loading the bigger files.

We don't need so much data,

so let's tell the browser when to use the file.

We'll use the sizes attribute for this,

listing which size image to use at which media query.

You can see now that the second photo looks just as good,

but it's using the smaller files.

It's using the files that are the right size

for the layout that we have.

HTML has a lot of power when it comes to providing options

to the browser for downloading different size files

of the same photo.

Srcset gives you two options

for communicating to the browser

that there are a set of images available to use.

You can specify which images are

for which resolution of screen,

or you can indicate which image has how many pixels

and let the browser choose an image based

on the combination of screen density and viewport width.

The sizes attribute gives you a way to specify

for the browser how much of the viewport's width

that image will take up at which break point.

In every case, you're giving the browser information

in the HTML so it can decide intelligently

which image file to download,

especially considering the network conditions

and the user's preferences.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.