All language subtitles for 10 - Code, pre, and br.en

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,005 --> 00:00:04,002 - Sometimes you want to put some code on a webpage. 2 00:00:04,002 --> 00:00:05,005 Let's say you're writing an article 3 00:00:05,005 --> 00:00:08,002 about making a webpage or you want to tell people 4 00:00:08,002 --> 00:00:10,004 about some of the syntax encode. 5 00:00:10,004 --> 00:00:14,006 Here, we've got some CSS in the middle of a sentence. 6 00:00:14,006 --> 00:00:18,009 I'd like that code to stand out and look like code. 7 00:00:18,009 --> 00:00:21,007 So I'll use the code element. 8 00:00:21,007 --> 00:00:25,004 I'll type an opening code tag before my bit of CSS 9 00:00:25,004 --> 00:00:27,005 and a closing code tag afterwards. 10 00:00:27,005 --> 00:00:29,007 You can see that the styling changes. 11 00:00:29,007 --> 00:00:32,002 It switches to a monospaced font 12 00:00:32,002 --> 00:00:34,007 and of curse we can make this look however it is 13 00:00:34,007 --> 00:00:36,003 that we want it to look. 14 00:00:36,003 --> 00:00:40,000 Code, by default, is an inline element. 15 00:00:40,000 --> 00:00:41,005 So this part of the CSS 16 00:00:41,005 --> 00:00:45,000 remains part of the sentence that it's in, inline. 17 00:00:45,000 --> 00:00:49,007 Now what if we wanted to write about some HTML as well? 18 00:00:49,007 --> 00:00:52,006 I want to change this word H4 19 00:00:52,006 --> 00:00:54,008 by putting the brackets around it 20 00:00:54,008 --> 00:01:01,001 but oh, it turned the word element into an H4 headline. 21 00:01:01,001 --> 00:01:06,004 It did the thing rather than printing H4 out on the page. 22 00:01:06,004 --> 00:01:09,000 Let me try wrapping this in a code element 23 00:01:09,000 --> 00:01:12,000 but no, that doesn't keep the browser 24 00:01:12,000 --> 00:01:16,005 from interpreting the H4 as an H4. 25 00:01:16,005 --> 00:01:21,009 To do that, we need to type <. 26 00:01:21,009 --> 00:01:25,000 This is a funny thing called HTML entity. 27 00:01:25,000 --> 00:01:30,006 When we type < we'll get a less than sign. 28 00:01:30,006 --> 00:01:36,005 If we type > we'll get a greater than sign. 29 00:01:36,005 --> 00:01:40,002 I'll talk more about HTML entities in a future video, 30 00:01:40,002 --> 00:01:42,002 there are a whole bunch of them. 31 00:01:42,002 --> 00:01:44,004 But for now, these two are helpful 32 00:01:44,004 --> 00:01:46,008 if you want to write about HTML syntax 33 00:01:46,008 --> 00:01:48,008 in a way so that it's shown on the page 34 00:01:48,008 --> 00:01:50,008 instead of being executed. 35 00:01:50,008 --> 00:01:56,005 Next, let's look at the br and pre elements. 36 00:01:56,005 --> 00:01:59,004 Normally, we can type all of the spaces 37 00:01:59,004 --> 00:02:02,001 and return characters that we want in our code 38 00:02:02,001 --> 00:02:04,003 and the browser is going to ignore them all. 39 00:02:04,003 --> 00:02:07,001 I talked about this a bit in a video about lists, 40 00:02:07,001 --> 00:02:09,008 how you can indent your code to help make it more readable 41 00:02:09,008 --> 00:02:12,001 for humans without it having any effect 42 00:02:12,001 --> 00:02:14,002 on the content on the webpage. 43 00:02:14,002 --> 00:02:17,001 But what if you want to have an effect on the content? 44 00:02:17,001 --> 00:02:20,000 What if you want to be able to put a whole bunch of spaces 45 00:02:20,000 --> 00:02:23,009 between words or between lines and have it count? 46 00:02:23,009 --> 00:02:25,009 For a poem, for example, 47 00:02:25,009 --> 00:02:28,009 I've wrapped this poem in a paragraph element. 48 00:02:28,009 --> 00:02:31,004 It's two sentences and as a whole, 49 00:02:31,004 --> 00:02:33,003 it seems like a paragraph. 50 00:02:33,003 --> 00:02:35,007 But the way it's coming out on the page on the right, 51 00:02:35,007 --> 00:02:37,007 it looks all wrong. 52 00:02:37,007 --> 00:02:40,002 The browser is ignoring the line breaks 53 00:02:40,002 --> 00:02:41,007 that are in the poem. 54 00:02:41,007 --> 00:02:44,009 You could see on the left how much meaning is conveyed 55 00:02:44,009 --> 00:02:46,009 by the way it's formatted. 56 00:02:46,009 --> 00:02:50,002 We don't want to make each line into a separate paragraph 57 00:02:50,002 --> 00:02:52,000 because these aren't separate paragraphs. 58 00:02:52,000 --> 00:02:53,002 We just want a line break 59 00:02:53,002 --> 00:02:55,003 at the end of each one of these lines, 60 00:02:55,003 --> 00:02:58,003 something that the browser will respect. 61 00:02:58,003 --> 00:03:01,007 That is what the br element is for, 62 00:03:01,007 --> 00:03:05,004 it gives us a way to break a line. 63 00:03:05,004 --> 00:03:07,008 I'll put a br element at the end of each line 64 00:03:07,008 --> 00:03:09,008 and now this poem looks correct. 65 00:03:09,008 --> 00:03:13,000 Br is just a simple, single tag, 66 00:03:13,000 --> 00:03:14,007 there's no opening or closing to it, 67 00:03:14,007 --> 00:03:16,002 there's nothing that goes inside of it, 68 00:03:16,002 --> 00:03:19,001 it just marks a place for a line break. 69 00:03:19,001 --> 00:03:21,002 Let's look at another poem 70 00:03:21,002 --> 00:03:25,003 where the spacing is even more irregular and meaningful. 71 00:03:25,003 --> 00:03:27,006 The whole poem is coming out 72 00:03:27,006 --> 00:03:30,006 as a mashed up pile of words right now. 73 00:03:30,006 --> 00:03:32,009 I could put a br at the end of each line 74 00:03:32,009 --> 00:03:35,007 but that wouldn't create the indentations 75 00:03:35,007 --> 00:03:38,007 or the flowing white space that we see. 76 00:03:38,007 --> 00:03:43,002 We want to get the spacing into the content itself 77 00:03:43,002 --> 00:03:44,008 because it's inherent to the content, 78 00:03:44,008 --> 00:03:47,002 it's part of the meaning of this content. 79 00:03:47,002 --> 00:03:49,008 So let's do that in HTML with a pre element. 80 00:03:49,008 --> 00:03:54,006 I'll wrap this poem in pre tags and now as you can see, 81 00:03:54,006 --> 00:03:56,009 the browser pays attention to the spacing, 82 00:03:56,009 --> 00:03:58,008 the line breaks and everything. 83 00:03:58,008 --> 00:04:01,000 We can come in here and add a random character 84 00:04:01,000 --> 00:04:03,005 into a random spot and it will stay there. 85 00:04:03,005 --> 00:04:06,002 Pre and code are frequently combined 86 00:04:06,002 --> 00:04:09,005 to provide a way to show a block of code with indentation. 87 00:04:09,005 --> 00:04:11,008 Here's an example that puts these parts together. 88 00:04:11,008 --> 00:04:14,007 I've written some HTML using HTML entities, 89 00:04:14,007 --> 00:04:17,007 I've added indentation to make it easier to understand 90 00:04:17,007 --> 00:04:20,007 and I followed it with some CSS that's also indented. 91 00:04:20,007 --> 00:04:23,002 The whole thing is wrapped in a code element 92 00:04:23,002 --> 00:04:25,008 to tell the browser, hey, this is some code. 93 00:04:25,008 --> 00:04:28,002 And all of that is wrapped in a pre element 94 00:04:28,002 --> 00:04:31,002 which maintains the formatting and the spacing. 95 00:04:31,002 --> 00:04:35,002 That's the code, br and pre elements. 96 00:04:35,002 --> 00:04:36,007 Three elements that can be useful 97 00:04:36,007 --> 00:04:39,007 for communicating semantic formatting for code 98 00:04:39,007 --> 00:04:42,000 and for other kinds of content. 7407

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