All language subtitles for 11. Refactoring our Website Part 2

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
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
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

0 All right. So in the last lesson we looked at what this syntax means and we learned all about how to combine 1

selectors in CSS code. 2

Now if you haven't taken a look at that then I strongly recommend you do because it's really really 3

useful so that you can understand what exactly is going on over here. 4

But now we're going to continue to refactor our code. 5

So the next thing I want to do relates to the fact that we've got certain sections on our web site that 6

have a colored background where the text is white and then we have other sections where the background 7

is white and the text is black. 8

So this is a repeated pattern across our web site. 9

So I want to capture that and refactor our code to make it a little bit more modular and reusable. 10

So what I'm going to do is I'm going to look through my code and give each of these sections a class 11

based on whether it's a colored section or if it is a white section. 12

So the first title section is a colored section, 13

the second section, features section, is a white section, and then testimonials was colored, I think, 14

and then press was also a colored section, and then pricing was a white section, 15

and finally the cta was a colored section, and the footer was a white section. 16

All right. 17

So now all of our sections have a class depending on whether they should be white or if they should 18

be colored. 19

And if I hit save I can now go and create some of these sections up top so just below containers. 20

I'm going to add another comment that's called sections, and I'm going to add our classes here, 21

the colored-section and the white-section. 22

All right. 23

So now if we take a look at our code you can see that for the colored sections we tend to add a background 24

color of that bright red pinkish color and then we give the text a white color. 25

Now for the white sections we tend to just give it a background color of white and maybe a little later on 26

we decide that we want to add other changes to our different sections, 27

but at the moment that's basically all that each section has. 28

So let's put that in here. 29

So I'm going to remove these two bits of code and I'm going to put it inside the colored section and 30

then the white section is simply going to have a background color of white. 31

And now I can go through my code and remove some of the repeated declarations. So, in the case of the 32

testimonial section, even though it's a colored section because it has white tags and has a background 33

color and we've already given it a class of colored-section, 34

it is slightly different from the other colored sections because it has this kind of peachy color rather 35

than this bright pinkish red. 36

So what we can do here is we can delete the part that's repeated, which is the 37

white text, because it's already inside a section that has a class of colored-section, which has that 38

text color that's applied, but we can override the background color by applying a style to our id. 39

And it's important to remember that there is a hierarchy between different types of selectors, 40

as we mentioned before. So ids are the most specific and their styles get applied preferentially over 41

everything else, 42

then next comes classes, and finally comes these HTML elements. 43

So if I right click and inspect to go into the Chrome Developer Tools and I select our section here 44

which has an HTML element of section, 45

class of colored-section, and an id of testimonials, 46

you can see that even though colored-section is applying the background color of that bright pinkish 47

color and id testimonials is applying this more peachy color, 48

you can see that this one gets overridden and it's shown as being crossed out in the Chrome Developer 49

Tools. 50

So if we didn't have this style that's applied in the id, which as we said is more specific, has higher 51

ranking, then it would default to the colored-section background color, but because we do, then this one 52

is going to override the other color. And it's pretty much the same thing 53

inside the press section as well. 54

All right. So the last one that we have is the cta section which we can now basically delete because 55

the section already has a class of colored-section so we don't need to write out that code again. 56

So let's hit save and refresh our web site and hopefully absolutely nothing has changed. 57

So we're doing a good job with our refactoring. 58

Now another thing that you might have noticed up here is that, because we're targeting the container that's 59

inside the title section, we don't actually need this extra title id. 60

We can actually just combine these two into the same selector and we can delete that specific title 61

id selector.

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