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:03,006
- The less than sign, the greater than sign
2
00:00:03,006 --> 00:00:06,007
and the ampersand are part of the characters
3
00:00:06,007 --> 00:00:09,002
that we use to write html.
4
00:00:09,002 --> 00:00:13,005
So what happens when we want to use them in our content?
5
00:00:13,005 --> 00:00:15,007
We looked at this a little bit in chapter two
6
00:00:15,007 --> 00:00:18,003
during the video about code and pre,
7
00:00:18,003 --> 00:00:20,006
let's get into it more deeply here.
8
00:00:20,006 --> 00:00:24,005
When I write a greater than or less than or ampersand
9
00:00:24,005 --> 00:00:28,008
symbol with spaces around it, it will show up as content.
10
00:00:28,008 --> 00:00:30,002
But if I start to write something
11
00:00:30,002 --> 00:00:34,004
that might look like an html element, it disappears.
12
00:00:34,004 --> 00:00:37,007
The browser thinks it should do this as part of html
13
00:00:37,007 --> 00:00:39,008
instead of displaying it.
14
00:00:39,008 --> 00:00:42,002
If you are writing inside a content management system
15
00:00:42,002 --> 00:00:45,001
like WordPress or using a tool like markdown,
16
00:00:45,001 --> 00:00:48,001
there's a chance that the layer between your text editor
17
00:00:48,001 --> 00:00:50,009
and the pure html will handle these characters
18
00:00:50,009 --> 00:00:53,004
for you just fine.
19
00:00:53,004 --> 00:00:55,000
Other times, you're going to need a way
20
00:00:55,000 --> 00:00:56,006
to handle this yourself.
21
00:00:56,006 --> 00:00:59,008
This is when we use what's called a character entity.
22
00:00:59,008 --> 00:01:02,008
Html entities are formatted like this.
23
00:01:02,008 --> 00:01:06,008
Ampersand, some kind of short code, and a semicolon.
24
00:01:06,008 --> 00:01:10,004
We type them into an html file and they get converted
25
00:01:10,004 --> 00:01:13,005
into the characters that we want.
26
00:01:13,005 --> 00:01:16,000
This is what we did in the demo for pre.
27
00:01:16,000 --> 00:01:18,007
Every instance of a greater than or less than symbol
28
00:01:18,007 --> 00:01:21,006
is written out as a corresponding character entity.
29
00:01:21,006 --> 00:01:24,000
The W3C keeps a reference chart
30
00:01:24,000 --> 00:01:27,002
of all the character entities where you can mark them up.
31
00:01:27,002 --> 00:01:29,001
Html entities can also be helpful
32
00:01:29,001 --> 00:01:33,001
for typing characters that aren't on your keyboard.
33
00:01:33,001 --> 00:01:35,008
For example, if you want to put a copyright symbol
34
00:01:35,008 --> 00:01:40,007
in your content, you can type ampersand, copy, semicolon.
35
00:01:40,007 --> 00:01:43,001
You don't have to use the character entity.
36
00:01:43,001 --> 00:01:46,000
Frequently, you can just copy and paste the character
37
00:01:46,000 --> 00:01:48,009
or learn the keyboard command for it.
38
00:01:48,009 --> 00:01:53,000
But using these html character entities is one way to do it.
39
00:01:53,000 --> 00:01:55,006
There's one special entity that I want to point out.
40
00:01:55,006 --> 00:01:58,001
The non breaking space.
41
00:01:58,001 --> 00:02:00,009
Normally, spaces provide opportunities
42
00:02:00,009 --> 00:02:03,004
for lines of text to wrap.
43
00:02:03,004 --> 00:02:06,007
The words stay whole, and when there's not enough room
44
00:02:06,007 --> 00:02:08,008
for a whole sentence, the browser looks
45
00:02:08,008 --> 00:02:11,008
for a place to wrap the line of text.
46
00:02:11,008 --> 00:02:15,006
It looks for any space where there's a space between words.
47
00:02:15,006 --> 00:02:17,007
A normal space.
48
00:02:17,007 --> 00:02:20,007
But we can insert what's called a non breaking space
49
00:02:20,007 --> 00:02:24,005
between two words, instead of a regular space,
50
00:02:24,005 --> 00:02:29,001
and the browser will know not to break the line there.
51
00:02:29,001 --> 00:02:31,009
Let's say I want my name to be in a phrase
52
00:02:31,009 --> 00:02:33,009
and to never have my first name, Jen,
53
00:02:33,009 --> 00:02:36,002
on a separate line from my last name, Simmons.
54
00:02:36,002 --> 00:02:43,000
I can type for non breaking space,
55
00:02:43,000 --> 00:02:45,002
between my first and last names,
56
00:02:45,002 --> 00:02:47,002
and the line will never break there.
57
00:02:47,002 --> 00:02:49,002
People also use the non-breaking space
58
00:02:49,002 --> 00:02:50,005
to force the browser to put
59
00:02:50,005 --> 00:02:53,001
more than one space between words.
60
00:02:53,001 --> 00:02:54,003
As we've already talked about,
61
00:02:54,003 --> 00:02:56,008
if you have a bunch of spaces in your html,
62
00:02:56,008 --> 00:03:00,002
the browser will ignore everything beyond the first space.
63
00:03:00,002 --> 00:03:03,005
The browser won't remove non breaking spaces, however,
64
00:03:03,005 --> 00:03:06,000
so you can put two spaces between each sentence,
65
00:03:06,000 --> 00:03:10,005
for example, if one of those spaces is a non breaking space.
66
00:03:10,005 --> 00:03:12,009
Html character entities give you a way
67
00:03:12,009 --> 00:03:15,006
to ensure that the browser will put the character
68
00:03:15,006 --> 00:03:21,000
that you want on the page, including non breaking spaces.
5318
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.