[User] Please transcribe this text

[Assistant] But the two men were not interested in champagne. They were policemen.


[User] Please transcribe this text

[Assistant] We'd like to ask you some questions, Mr Williams. At the police station. Come with us, please.


[User] Please transcribe this text

[Assistant] On Tuesday morning, Jason was tired and unhappy.


[User] Please transcribe this text

[Assistant] And there were two policemen in the room with him. One policeman stood by the door and watched and listened. The second policeman sat at a table.


[User] Please transcribe this text

[Assistant] And asked questions. Questions. Questions.


[User] Please transcribe this text

[Assistant] Tell me again, where were you at four o'clock on Saturday afternoon? At home, said Jason. I'm telling you the truth. Ask my mother and father. I didn't steal anything.


[User] Please transcribe this text

[Assistant] I'm not interested in your mother and father, said the policeman. I can talk to them later.


[User] Please transcribe this text

[Assistant] At the moment I'm interested in you.


[User] Please transcribe this text

[Assistant] And your answers to my questions.


[User] Please transcribe this text

[Assistant] You were in town on Saturday afternoon. We know that because a woman saw you. No, said Jason. That's a lie.


[User] Please transcribe this text

[Assistant] I was at home all afternoon and evening. I watched football on television. Tell me about the football then. Who won? Jason said nothing.


[User] Please transcribe this text

[Assistant] His hands and his face felt hot. When did the football finish? Five o'clock? Six o'clock? Yes, no, said Jason. I don't remember. The policeman smiled.


[User] Please transcribe this text

[Assistant] How much money was there in the bag, Jason? There wasn't. Jason stopped. Careful, he thought. Be careful. There wasn't a bag, he said.


[User] Please transcribe this text

[Assistant] I told you, I didn't steal the old woman's bag. Old woman?


[User] Please transcribe this text

[Assistant] Who said anything about an old woman? Now Jason felt cold. You did, he said. Oh no, I didn't, said the policeman. I talked about a woman.


[User] Please transcribe this text

[Assistant] So how did you know she was an old woman? He stood up.


[User] Please transcribe this text

[Assistant] Jason Williams. On Saturday afternoon, you hit Mrs. Emma Carter on the head and snatched her bag.


[User] Please transcribe this text

[Assistant] You stole her money and her lottery ticket.


[User] Please transcribe this text

[Assistant] Her winning lottery ticket. So you stole five million pounds from Mrs. Carter. You're in trouble, Williams. Big trouble. I want to see my lawyer, said Jason suddenly. Jason did not know any lawyers.


[User] Please transcribe this text

[Assistant] But people on television always said that.


[User] Please transcribe this text

[Assistant] That afternoon, a different policeman took Jason to court.


[User] Please transcribe this text

[Assistant] The court was in a big grey building in the middle of the town.


[User] Please transcribe this text

[Assistant] Jason and the policeman waited in a small room. The policeman did not look at Jason and he did not say anything. Jason felt very unhappy. Then a woman came into the room. She was young with short brown hair and an interesting face.


[User] Please transcribe this text

[Assistant] She wore a black skirt and a white shirt and carried a big black bag. Mr Williams, she said to Jason.


[User] Please transcribe this text

[Assistant] I'm Sally Cash and I'm your lawyer. The policeman left the room.


[User] Please transcribe this text

[Assistant] And Sally Cash sat down and began to ask Jason questions.


[User] Please transcribe this text

[Assistant] Soon, a man in a black coat came into the room.


[User] Please transcribe this text

[Assistant] Are you ready to go into court, Miss Cash? He asked. Nearly ready, John, said the lawyer. She looked at Jason.


[User] Please transcribe this text

[Assistant] I'm going to do all the talking in court. Okay? I don't want you to say anything.


[User] Please transcribe this text

[Assistant] Nothing important is going to happen today. They're going to send you to the Crown Court. That's a more important court. When? asked Jason. Soon.


[User] Please transcribe this text

[Assistant] Can I go home tonight? asked Jason.


[User] Please transcribe this text

[Assistant] Last night I slept in a cell at the police station. It wasn't very nice. No, I'm sorry, said Miss Cash. You can't go home. You see, you're a rich man now.


[User] Please transcribe this text

[Assistant] You can buy a ticket to New York, Hong Kong. You can buy an aeroplane.


[User] Please transcribe this text

[Assistant] The police want you to stay in this country. But I want to go home. I can ask the court, said Sally Cash.


[User] Please transcribe this text

[Assistant] Two men and a woman sat at the end of a long table.


[User] Please transcribe this text

[Assistant] And listened carefully to everyone's story.


[User] Please transcribe this text

[Assistant] Then, the woman looked at Sally Cash.


[User] Please transcribe this text

[Assistant] This case must go to the Crown Court, she said.


[User] Please transcribe this text

[Assistant] Jason Williams must stay at the police station and... Excuse me, said Sally Cash.


[User] Please transcribe this text

[Assistant] Mr Williams slept in a police cell last night. He's very young and he was unhappy and afraid.


[User] Please transcribe this text

[Assistant] The woman talked quietly to the two men for a minute. Then she said


[User] Please transcribe this text

[Assistant] Mr Williams, you can go home tonight.


[User] Please transcribe this text

[Assistant] We don't want you to run away, Mr. Williams. Now listen carefully.


[User] Please transcribe this text

[Assistant] You must live at your parents' house. Don't leave the town.


[User] Please transcribe this text

[Assistant] And every morning at ten o'clock you must go to the police station. Do you understand? Yes, said Jason.


[User] Please transcribe this text

[Assistant] Why did you let it go? Because it bit my finger so. Which finger did it bite? This little finger on my right.


[User] Please transcribe this text

[Assistant] One, two, three, four, five. Once I caught a fish alive. Six, seven, eight, nine, ten. Then I let it go again.


[User] Please transcribe this text

[Assistant] Mr. Harris and the Night Train Mr. Harris liked trains. He was afraid of aeroplanes and didn't like buses. But trains, they were big and noisy and exciting.


[User] Please transcribe this text

[Assistant] When he was a boy of ten, he liked trains. Now he was a man of fifty, and he still liked trains.


[User] Please transcribe this text

[Assistant] So he was a happy man on the night of the 14th of September.


[User] Please transcribe this text

[Assistant] He was on the night train from Helsinki to Oulu in Finland. And he had 10 hours in front of him.


[User] Please transcribe this text

[Assistant] I've got a book and my newspaper, he thought. And there's a good restaurant on the train.


[User] Please transcribe this text

[Assistant] And then I've got two weeks holiday with my Finnish friends in Oulu.


[User] Please transcribe this text

[Assistant] There weren't many people on the train and nobody came into Mr. Harris' carriage. He was happy about that. Most people on the train slept through the night.


[User] Please transcribe this text

[Assistant] But Mr. Harris liked to look out of the window and to read and think.


[User] Please transcribe this text

[Assistant] Mr. Harris came back to his carriage and sat in his seat next to the window.


[User] Please transcribe this text

[Assistant] For an hour or two he watched the trees and lakes of Finland out of the window. Then it began to get dark. So he opened his book and began to read.


[User] Please transcribe this text

[Assistant] At midnight the train stopped at the small station of Ottawa. Mr. Harris looked out of the window, but he saw nobody.


[User] Please transcribe this text

[Assistant] The train moved away from the station into the black night again. Then the door of Mr. Harris' carriage opened and two people came in, a young man and a young woman. The young woman was angry. She closed the door and shouted at the man, Carl, you can't do this to me.


[User] Please transcribe this text

[Assistant] The young man laughed loudly and sat down.


[User] Please transcribe this text

[Assistant] Mr. Harris was a small, quiet man.


[User] Please transcribe this text

[Assistant] He wore quiet clothes, and he had a quiet voice.


[User] Please transcribe this text

[Assistant] He did not like noisy people and loud voices, so he was not pleased.


[User] Please transcribe this text

[Assistant] The young woman sat down and said in a quieter voice, Carl, you're my brother and I love you. But please listen to me. You can't take my diamond necklace. Give it back to me now, please. Carl smiled.


[User] Please transcribe this text

[Assistant] No, Elena, he said, I'm going back to Russia soon, and I'm taking your diamonds with me. He took off his hat and put it on the seat. Elena, listen, you have a rich husband.


[User] Please transcribe this text

[Assistant] But I, I have no money. I have nothing. How can I live without money?


[User] Please transcribe this text

[Assistant] You can't give me money, so I need your diamonds, little sister.


[User] Please transcribe this text

[Assistant] She was small with black hair and dark eyes. Her face was white and afraid. Mr. Harris began to feel sorry for Elena. She and her brother didn't look at him once. Can't they see me? He thought. Carl, Elena said. Her voice was very quiet now, and Mr. Harris listened carefully. You came to dinner at our house tonight?


[User] Please transcribe this text

[Assistant] He's going to be very, very angry, and I'm afraid of him. Her brother laughed. He put his hand in his pocket, then took it out again, and opened it slowly. The diamond necklace in his hand was very beautiful. Mr. Harris stared at it. For a minute or two nobody moved, and it was quiet in the carriage. There was only the noise of the train.


[User] Please transcribe this text

[Assistant] And it went quickly on through the dark, cold night.


[User] Please transcribe this text

[Assistant] Mr. Harris opened his book again, but he didn't read it.


[User] Please transcribe this text

[Assistant] He watched Carl's face with its hungry eyes and its cold smile.


[User] Please transcribe this text

[Assistant] What beautiful, beautiful diamonds, Carl said. I can get a lot of money for these. Give them back to me, Carl, Elena whispered. My husband's going to kill me. You're my brother. Please help me. Please. Carl laughed again, and Mr. Harris wanted to hit him.


[User] Please transcribe this text

[Assistant] Go home, little sister, Carl said. I'm not going to give the diamonds back to you. Go home to your angry husband.


[User] Please transcribe this text

[Assistant] Suddenly there was a knife in the young woman's hand. A long, bright knife. Mr. Harris watched with his mouth open. He couldn't speak or move. Give the diamonds back to me! Elena cried. Or I'm going to kill you! A hand on the knife was white.


[User] Please transcribe this text

[Assistant] Carl laughed and laughed. What a sister, he said. What a kind, sweet sister. No, they're my diamonds now. Put your knife away, little sister.


[User] Please transcribe this text

[Assistant] But the knife in the white hand moved quickly, up then down.


[User] Please transcribe this text

[Assistant] There was a long, terrible cry, and Carl's body fell slowly onto the seat.


[User] Please transcribe this text

[Assistant] The color of the seat began to change to red, and the diamond necklace fell from Carl's hand onto the floor. Elena's face was white. Oh no! She whispered. Carl! Come back! Come back! I didn't want to kill you! But Carl didn't answer, and the red blood ran slowly over the floor.


[User] Please transcribe this text

[Assistant] Elena put her head in her hands and again in the carriage there was a long, terrible cry. Mr. Harris's face was white too. He opened his mouth, but he couldn't speak. He stood up and carefully moved to the door. The young woman was quiet now. She didn't move or look up at Mr. Harris. In the corridor Mr. Harris ran.


[User] Please transcribe this text

[Assistant] The guard ran with Mr. Harris back to the carriage. Mr. Harris opened the door and they went inside. There was no dead body of a young man. There was no young woman. No blood. No knife. No diamond necklace.


[User] Please transcribe this text

[Assistant] Only Mr. Harris' bags and his hat and coat. The guard looked at Mr. Harris, and Mr. Harris looked at him. But, Mr. Harris began, but they were here. I saw them. She, the young woman, she had a knife, and she, she killed her brother. A knife, you say? The guard asked. Yes, Mr. Harris said quickly.


[User] Please transcribe this text

[Assistant] Was the young woman's name Elena? he asked. Yes, it was, Mr. Harris said. How do you know that? Do you, do you know her?


[User] Please transcribe this text

[Assistant] Yes, and no, the guard said slowly. He thought for a minute, then looked at Mr. Harris.


[User] Please transcribe this text

[Assistant] Elena di Saronelli, he said. She had dark eyes and black hair. Very beautiful. She was half Italian, half Finnish. Her brother was a half brother.


[User] Please transcribe this text

[Assistant] They had the same father, but his mother was Russian, I think. Was? Had? Mr. Harris stared at the guard. But she! Elena! She's alive! And where is she? Oh no!


[User] Please transcribe this text

[Assistant] Said the guard, Elena di Saronelli died about 80 years ago.


[User] Please transcribe this text

[Assistant] After she killed her brother with a knife, she jumped off the train and died at once. It was near here, I think. He looked out of the window into the night. Mr. Harris's face was very white again. Eighty years ago? He whispered. What are you saying? Was she and her brother? But I saw them.


[User] Please transcribe this text

[Assistant] Yes, that's right, the guard said.


[User] Please transcribe this text

[Assistant] You saw them, but they're not alive. They're ghosts.


[User] Please transcribe this text

[Assistant] They often come on the night train at this time in September. I never see them. But somebody saw them last year. A man and his wife. They were very unhappy about it. But what can I do?


[User] Please transcribe this text

[Assistant] I can't stop Elena and Carl coming on the train. The guard looked at Mr. Harris' white face. You need a drink? He said. Come and have a vodka with me.


[User] Please transcribe this text

[Assistant] Mr. Harris didn't usually drink vodka, but he felt afraid.


[User] Please transcribe this text

[Assistant] When he closed his eyes, he could see again Elena's long knife and could hear her terrible cry. So he went with the guard to the back of the train.


[User] Please transcribe this text

[Assistant] He didn't want to sleep, and the guard was happy to talk.


[User] Please transcribe this text

[Assistant] Elena's father was a famous man here in Finland. He was very rich once.


[User] Please transcribe this text

[Assistant] But he had three or four wives and about eight children. And he liked the good things of life. So there wasn't much money for the children.


[User] Please transcribe this text

[Assistant] Carl the Oldest Son was a bad man, people say.


[User] Please transcribe this text

[Assistant] He wanted an easy life, and money in his hand all the time.


[User] Please transcribe this text

[Assistant] The train hurried on to Ulu through the black night, and the guard drank some more vodka. Now Elena, he said.


[User] Please transcribe this text

[Assistant] A father, a brother, a husband.


[User] Please transcribe this text

[Assistant] One year, she visited her mother's family in Italy, and there she met her husband, Di Saronelli. He was rich, but he wasn't a kind man.


[User] Please transcribe this text

[Assistant] They came back to Finland, and Carl often visited their house. He wanted money from his sister's rich husband.


[User] Please transcribe this text

[Assistant] Elena loved her brother and gave him some money.


[User] Please transcribe this text

[Assistant] Mr. Harris stayed with his friends in Oulu for two weeks.


[User] Please transcribe this text

[Assistant] They were quiet weeks, and Mr. Harris had a good holiday. But he took the bus back to Helsinki.


[User] Please transcribe this text

[Assistant] The bus was slow, and there were a lot of people on it. But Mr. Harris was very happy.


[User] Please transcribe this text

[Assistant] He didn't want to take the night train across Finland again.


[User] Please transcribe this text

[Assistant] Uh, Ms. Woods, any day now, you may proceed. Call your first witness.


[User] Please transcribe this text

[Assistant] You carry the Tang Monk on the journey and earn forgiveness for your crimes.


[User] Please transcribe this text

[Assistant] You will now be a golden dragon in heaven.


[User] Please transcribe this text

[Assistant] You too have earned forgiveness for your past crimes. You will now be a golden deity.


[User] Please transcribe this text

[Assistant] Thank you, Buddha. You have earned forgiveness, Bajie.


[User] Please transcribe this text

[Assistant] You will be Janitor of the Altars, an important deity who looks after Buddhist altars.


[User] Please transcribe this text

[Assistant] Because of you, the people in the east will never have to suffer again. You made a journey that no other person could make. You are now a Buddha.


[User] Please transcribe this text

[Assistant] Life passing me by, not thinking how the years have flowed.


[User] Please transcribe this text

[Assistant] Let's take a closer look at HTML and CSS, languages that we can use to describe the structure and the style of web pages. After that, we'll introduce Git, a version control tool that we can use to keep track of changes we make to our code and also to allow multiple people to collaborate on the same project at the same time.


[User] Please transcribe this text

[Assistant] After that, we'll explore some best practices in industry, including testing to make sure that our code works as expected, and also continuous integration and continuous delivery to allow us to rapidly make changes and deploy those changes to our code whenever we're able to make those updates.


[User] Please transcribe this text

[Assistant] Along the way, you'll have an opportunity to put all of this into practice by building web applications of your very own. This is CS50.


[User] Please transcribe this text

[Assistant] Hey, welcome everyone to Web Programming with Python and JavaScript. My name is Brian Yu, and in this course we'll dive into the design and implementation of web applications.


[User] Please transcribe this text

[Assistant] In lectures, we'll have an opportunity to discuss and explore many of the ideas and tools and languages that are central to modern web programming. And through hands-on projects, you'll have an opportunity to take those ideas and put them into practice, designing multiple web applications of your own, culminating in a final project of your own choosing.


[User] Please transcribe this text

[Assistant] Throughout the term, we'll cover a number of topics in this world of web programming, beginning with HTML5 and CSS3, two of the languages that are central to the understanding of web pages.


[User] Please transcribe this text

[Assistant] HTML is a language we'll use to describe the structure of a webpage, and CSS is a language we'll use to describe the style of a webpage, the colors and the fonts and the layouts and the spacing that make the webpage look exactly the way we want it to look.


[User] Please transcribe this text

[Assistant] After that, we'll turn our attention to Git, a tool not specific to web programming per se, but that we can use in order to version control our programs, to keep track of the different changes we make to our web programs, and to allow us to be able to work on various different parts of the web application at the same time before merging those pieces back together.


[User] Please transcribe this text

[Assistant] After that, we'll take a look at Python, one of the first main languages that we're going to be exploring in the course, which is a language that we're going to use in order to build our web applications.


[User] Please transcribe this text

[Assistant] Specifically, we'll use Python using a framework called Django. Django is a web programming framework written in the Python programming language that we're going to use to make it easy to design and develop our web application.


[User] Please transcribe this text

[Assistant] Django in particular makes it easy to design web applications that interact with data. So after that, we'll turn our attention to SQL, a language that we can use to interact with databases. In particular, looking at how Django allows us to use models and migrations to interact with data and allow users to interact with data all the more easily.


[User] Please transcribe this text

[Assistant] Next, we'll turn our attention to the second of the main programming languages that we'll be exploring in this class, JavaScript, and looking at how we can use JavaScript to run in users' web browsers to make web pages just a little bit more interactive.


[User] Please transcribe this text

[Assistant] In particular, we'll use JavaScript in the context of user interfaces, looking at modern user interfaces and exploring how it is that those interfaces work and how we can develop those user interfaces with a combination of Python and JavaScript.


[User] Please transcribe this text

[Assistant] Next we'll turn our attention to testing and CICD, or continuous integration and continuous delivery, which are tools that we can use in software best practices to make sure that we're able to design and develop code more efficiently. And testing in particular makes sure that as we make changes to our code, we're not breaking existing parts of our web application.


[User] Please transcribe this text

[Assistant] By making sure that we have a whole suite of tests that we can use to ensure that our web application is always behaving as it should.


[User] Please transcribe this text

[Assistant] And finally, we'll turn our attention to scalability and security on the internet. Thinking about what happens as our web application grows larger, as more and more different users start to use our web application, how do we load balance between those people? And what do we need to change about our database to make sure lots of users are able to connect to our web application at the same time?


[User] Please transcribe this text

[Assistant] Moreover, we'll look at the security implications behind designing our web applications. What might an adversary do if we're not careful? And how should we proactively be designing our web application to make sure that it's secure?


[User] Please transcribe this text

[Assistant] But today we begin our conversation with HTML and CSS, two of the languages that are foundational to understanding web pages and how web browsers are able to display those web pages.


[User] Please transcribe this text

[Assistant] And we'll start with HTML, or Hypertext Markup Language, which is a language that we can use to describe the structure of the webpage. All of the buttons and the text and the forms and other parts of the webpage that the user ultimately sees and interacts with.


[User] Please transcribe this text

[Assistant] So let's take a look at this page one line at a time and get an understanding for how it works.


[User] Please transcribe this text

[Assistant] Even if you don't quite understand all the nuances of the syntax, there are probably a couple of things that stand out to you. You might notice the word title, which probably reflects the title of the webpage, for example, which in this case appears to be the word hello. And then down further below, we see that we have the body of the webpage that seems to contain the words hello world.


[User] Please transcribe this text

[Assistant] We'll go ahead and open up a text editor. You can use any text editor you want, but for this course I'm going to use Microsoft's Visual Studio Code. And I'm going to open up a new file that I'm just going to call hello.html.


[User] Please transcribe this text

[Assistant] Inside of hello.html, I'm going to write the same HTML that we just saw a moment ago. And we'll explain each of these lines in due time.


[User] Please transcribe this text

[Assistant] But recall that we had a title of the page that said something like, hello, and then a body of the page where we said something like, hello world, for example.


[User] Please transcribe this text

[Assistant] So this is our very first HTML page. And if I go ahead and open that HTML page, as by opening hello.html, for example, inside of a web browser, what I'll see is something like this. In the body of the page, I see the words hello world.


[User] Please transcribe this text

[Assistant] And if you notice up here at the top of my web browser, I see the title bar where I have the title for this page, which in this case is just the word hello.


[User] Please transcribe this text

[Assistant] So this is our very first web program that we've been able to develop just using HTML. And now let's explore in more detail how exactly this program works. So here again was the web page that we were just looking at.


[User] Please transcribe this text

[Assistant] Each version of HTML has had a slightly different way of indicating that version, but this line here, Doctype HTML, is our way of saying that this HTML page is written using HTML5, the latest version of HTML.


[User] Please transcribe this text

[Assistant] Each of those elements is indicated by what we're going to call an HTML tag, enclosed using those angled brackets. And right here, we'll see the beginning of the HTML tag, which means this is the beginning of the HTML content of our page.


[User] Please transcribe this text

[Assistant] Down below, this slash HTML means that this is the end of the HTML content of the page. And in between is the actual HTML content of the page, which might include other HTML elements.


[User] Please transcribe this text

[Assistant] You might also notice that in this HTML tag, we've specified what we're going to call an HTML attribute, some additional information that we're giving about this tag.


[User] Please transcribe this text

[Assistant] In particular, we're giving it a lang, or language attribute, which is equal to EN, or English.


[User] Please transcribe this text

[Assistant] This just tells the web browser or anyone looking at the HTML of this page that this page is written in a language, and the language it's written in is English. And this is helpful for search engines, for example. When they're looking through many different web pages, trying to figure out what language each web page is in, we can just tell the search engine or anyone else who's looking at the page that this page is written in English.


[User] Please transcribe this text

[Assistant] Now, inside of the HTML body of the page, we have a number of different elements that are going to describe what we want on this page. Starting with the head section of the webpage, which describes stuff not in the main body of the webpage, the part of the webpage the user sees, but other information about the webpage that's going to be helpful or useful for web browsers to know about.


[User] Please transcribe this text

[Assistant] For example, one important thing that the web browser needs to know is what is the title of the web page? And here we see a title tag, again indicated by the word title in those angled brackets, followed by the end of the title tag, indicated by a slash before the title,


[User] Please transcribe this text

[Assistant] And in between the two title tags is the word hello, which means the title of this page should be the word hello.


[User] Please transcribe this text

[Assistant] And that's all the information we'll have in the head of the page. We'll add more information there later, but for now all the webpage needs to know is that it has a title and the title is the word hello.


[User] Please transcribe this text

[Assistant] Next up comes the body of the page, again indicated by a body tag, and that ends with a tag with slash body, meaning this is the end of the body of the page. And the body of the page again is just the visible part of the page that the user can see.


[User] Please transcribe this text

[Assistant] And what do we want inside the body of the page? For now, we just want the text, hello world. And that's the information that's going to be displayed when someone visits this webpage.


[User] Please transcribe this text

[Assistant] And if you want to visually think about the way that all these HTML elements are structured, it can sometimes be helpful to think about an HTML page in terms of a tree-like structure that we call the Document Object Model, or DOM.


[User] Please transcribe this text

[Assistant] And so here, for example, is what the DOM for this webpage might actually look like. Here on the left is the HTML content that we just saw a moment ago. And over here on the right is the DOM, the document object model, the tree-like structure that describes how all of these HTML elements are related to each other.


[User] Please transcribe this text

[Assistant] So we start up here with the HTML element. And this parent element, so to speak, has two child elements within it. A head element and a body element.


[User] Please transcribe this text

[Assistant] As we can see here, we're inside of HTML. We have a head section and a body section. And the indentation here that we're including in the HTML text, it's not strictly necessary. The web browser doesn't care what the indentation is.


[User] Please transcribe this text

[Assistant] So thinking about HTML and HTML documents in terms of this structure can be helpful for understanding which HTML elements are inside of which other HTML elements. And that's going to make it easier for us to reason about these pages later on. And especially as we later transition into the world of JavaScript.


[User] Please transcribe this text

[Assistant] JavaScript is going to make it all the more powerful and give us the ability to actually modify parts of this DOM as well. But we'll certainly get to that in due time.


[User] Please transcribe this text

[Assistant] So now let's take a look at some of the other common HTML tags and HTML elements that we might be interacting with in our webpage. And we'll start by thinking about HTML headaches. So big banners at the top of a page, for example, some headline that describes what a page is about.


[User] Please transcribe this text

[Assistant] So I'll go ahead into my text editor and create a new file that I'll call headings.html.


[User] Please transcribe this text

[Assistant] And the structure of this page is going to be pretty similar to the pages that we've seen before already. So I'm going to start by just using the hello.html text and paste it in here. I'll change the title of the page instead of hello. We'll go ahead and call it headings.


[User] Please transcribe this text

[Assistant] But inside the body of this page now, I want something a little bit different.


[User] Please transcribe this text

[Assistant] I'm going to inside the body of the page use an h1 element and say this is a heading, for example. So h1 is a tag that I can use to create a large heading at the top of my page, like for the title of a page, for example. So if I open up headings.html,


[User] Please transcribe this text

[Assistant] I might see something that looks like this. A big heading at the top of my page that says, this is a heading.


[User] Please transcribe this text

[Assistant] H1, where the H stands for heading, and the 1 stands for the largest possible heading. And in fact, HTML gives us a number of different tags that we can use in order to create headings of various sizes. So for example, I could also say H2, inside of which I say this is a smaller heading.


[User] Please transcribe this text

[Assistant] If H1 is the largest heading, H2 is the second largest heading.


[User] Please transcribe this text

[Assistant] So if I load this page, for example, I now see the H1 at the very top. This is the big heading. And then beneath that I see this is a smaller heading, the H2. And it turns out there's also H3, H4, H5, all the way down to H6, which is the smallest heading.


[User] Please transcribe this text

[Assistant] Such that if I load this page now, I have a big heading, a smaller one, and then here's the smaller.


[User] Please transcribe this text

[Assistant] So we can often use these h1, h2, h3 tags just for visually organizing text inside of a page. If I want the title of the page, but also I want titles for each of the various different sections and subsections that might be contained within that page as well.


[User] Please transcribe this text

[Assistant] So those are headings, and now let's also take a look at some other elements that we might want to add. On webpages we see not just titles and not just text, but we might also see lists, for example. Like if you've ever used a to-do list program on a webpage, for example, you might see a list of things that you need to do, or other webpages might display lists of information.


[User] Please transcribe this text

[Assistant] And it turns out that HTML has two basic types of lists. We have ordered lists for things that are in a particular order, like item number one, item number two, item number three. And we have unordered lists for lists that don't have any particular order. So just bullet point, bullet point, bullet point, for example. And both are quite easy to use.


[User] Please transcribe this text

[Assistant] I'll go ahead and create a new file, and we'll call this lists.html.


[User] Please transcribe this text

[Assistant] And again, in list.html, I'll copy the same structure from hello.html. We're again going to have doctype.html just to indicate the version of HTML. Most of the heading is the same. I'm just going to change the title from hello to lists. And then we're going to replace the body of this page to show some different information here.


[User] Please transcribe this text

[Assistant] So let me first show what an ordered list might look like. Something that has numbers 1, 2, 3. And ordered list as an HTML tag is just OL. OL for ordered list. So I can add a tag that says OL.


[User] Please transcribe this text

[Assistant] So here, for example, I could say li, and then first item, and then I could do the same thing. li second item, and then again li third item.


[User] Please transcribe this text

[Assistant] So what I have here are some elements and then elements nested within other elements. I have an ordered list element, inside of which are three other HTML elements. Three list items that are each indicating each of the individual items that are inside of my HTML list.


[User] Please transcribe this text

[Assistant] I can now open this up by opening lists.html. And this is what I see. I see an ordered list.


[User] Please transcribe this text

[Assistant] Where I have item number one, first item, second item, third item.


[User] Please transcribe this text

[Assistant] Note that I didn't actually need to, in the HTML anywhere, specify the number one, the number two, and the number three. When my web browser reads that this should be an ordered list, my web browser, Chrome in this case, just adds those numbers in for me because it knows what an ordered list means and it knows how to take the HTML that I've written and display it in the way that I intend to to the user.


[User] Please transcribe this text

[Assistant] Now in addition to ordered lists that all have numbers, 1, 2, 3, we also have unordered lists that are just bullet points, bullet points of information. So I could, up above, add some more content to this HTML page. I can say here is an unordered list.


[User] Please transcribe this text

[Assistant] And just as an ordered list, we represented using the OL tag in HTML. OL standing for ordered list. Likewise, we can use the UL tag in HTML to create an unordered list. U for unordered.


[User] Please transcribe this text

[Assistant] So here we're gonna add a UL tag. And again, my text editor here is automatically adding the closing tag here, this slash UL, meaning the end of the unordered list. And many text editors will do this now just so you, the programmer, don't forget to add that.


[User] Please transcribe this text

[Assistant] And now inside of this unordered list, we're again going to have some list items. Also using the li tag, here is one item, and here is another item, and here is yet another item.


[User] Please transcribe this text

[Assistant] If I go ahead and refresh the page now, I'm still on list.html, I now see that on top of my ordered list, I have an unordered list, where each item, instead of being numbered 1, 2, 3, is instead labeled with just bullet point, bullet point, bullet point, where each of these bullet points and each of these numbered items is a list item element or an li.


[User] Please transcribe this text

[Assistant] So hopefully now we can see that as we start to explore these various different HTML tags and nesting HTML tags inside of one another, we're able to create more and more interesting web pages as a result.


[User] Please transcribe this text

[Assistant] So let's explore now what other types of web pages we can create using other types of HTML elements. In addition to lists, one thing you might imagine is that one of the important things on the web is not just displaying text, but also displaying other types of media, like images, for example. So how might we go about doing that?


[User] Please transcribe this text

[Assistant] Well, I can, for example, let's go back into my text editor. Let me create a new file that I'm going to call image.html, which is going to contain some code for displaying some images.


[User] Please transcribe this text

[Assistant] I'll go ahead and go into hello.html and copy this text into the page. Again, change the title to image. And now inside of the body, I'm going to add a new tag called image.


[User] Please transcribe this text

[Assistant] And the image tag has a couple of required attributes. Remember that attributes are what we saw before. Things like adding a lang equals en to the top of my page to indicate that this webpage is written in English, for example.


[User] Please transcribe this text

[Assistant] And the image tag has a couple of required attributes that I need to add. In particular, when I display an image on the page, I need to specify what image I actually want displayed, for example. So I might specify image src, short for source.


[User] Please transcribe this text

[Assistant] Is going to be equal to what image do I actually want to display on this page? And it just so happens that inside of my folder where I have image.html, I have an image called cat.jpeg. So I'm just going to specify cat.jpeg as the file name of the image that I want to display.


[User] Please transcribe this text

[Assistant] And it turns out that images also have a second required attribute.


[User] Please transcribe this text

[Assistant] In addition to the file name or the link to whatever image I want to display, I also need to provide some alternative text.


[User] Please transcribe this text

[Assistant] A text-based representation of what you're going to see on the image. Because in some cases, some web browser might not be able to render the image correctly. You might imagine if there's some error rendering the image, or if someone's on a slow internet connection, or if someone's using a screen reader and therefore can't actually see the image, we want some text-based representation of that image as well.


[User] Please transcribe this text

[Assistant] And so I'll provide some alt text, some alternative text that can be used to substitute the image in case for some reason we can't display the image. And the alt text that I'll use in this case is just going to be the word cat, for example. And that's all I need.


[User] Please transcribe this text

[Assistant] Now notice in particular that something a little bit different about this image tag compared to other tags that we've seen before in the sense that it doesn't have a closing tag.


[User] Please transcribe this text

[Assistant] It doesn't really make sense for an image, for example, to have the beginning of the image and the end of the image and some content in between, because the image is just a single HTML element that can't really have anything inside of it.


[User] Please transcribe this text

[Assistant] So in that sense, we don't actually need a closing image tag. The image tag is self-closing. It is its own beginning and end. So we can just say we want an image to be here that is cat.jpg with an alternative text of just the word.


[User] Please transcribe this text

[Assistant] So now, if I open up image.html, we'll see that what gets loaded is quite large, a picture of a cat. And I can scroll around and see this entire image.


[User] Please transcribe this text

[Assistant] Of course, this picture of a cat is probably larger than I wanted it to be. I probably, when my user visits this webpage, I don't want them to have to scroll all the way to the right in order to see the entire cat.


[User] Please transcribe this text

[Assistant] So I can actually add additional HTML attributes in order to modify the size of the image that I'm displaying. And later we'll see we can use CSS to do a similar thing as well. But for now, what I can add is an additional attribute.


[User] Please transcribe this text

[Assistant] And say that let me give cat.jpg, this image tag, another attribute that in this case I'll just call width.


[User] Please transcribe this text

[Assistant] And I'll say that width is going to be equal to 300, because I would like for this image to be 300 pixels wide, for example. So now if I refresh this page,


[User] Please transcribe this text

[Assistant] I now see that the same cat image appears, except now it appears at 300 pixels wide exactly. So I'm able to add additional attributes, additional information to control how an HTML element is going to appear. In this case, I want to control its width and it automatically scales down the height to make sure that the image is proportional as well.


[User] Please transcribe this text

[Assistant] Now, on the internet, in addition to just displaying information on a single page, it's also common for a page to link to other pages. In fact, that's one of the main important values of the internet, is the ability to go from one page to another via these links.


[User] Please transcribe this text

[Assistant] And so one thing we might reasonably want to do is add some links to our page, where if you click on something, you're taken to another page altogether. So let's take a look at an example of that.


[User] Please transcribe this text

[Assistant] I'll create a new file based on hello.html and I'll add lang equals english for good measure. And I'll call this new file link.html. Where here we're going to practice with building some links into our HTML page. I'll copy the content of hello.html again. Call this link.


[User] Please transcribe this text

[Assistant] And in order to create a link, I'm going to use a tag called the a tag, short for the anchor tag. And the a tag takes one important attribute, which is called href for hyperlink reference, which is going to specify what page I would like to link to.


[User] Please transcribe this text

[Assistant] So if, for example, I wanted when a user clicks on this link to go to google.com, then I'd set the href attribute of this tag equal to https colon slash slash google.com, for example.


[User] Please transcribe this text

[Assistant] Then inside of the a tag, I would specify what text I want to display. What text should the user see such that when the user clicks on that text, they're taken to the web page. In this case, I'm just going to say something like click here, for instance. Now, if I open up link.html, this is what the user sees. They see a blue link that says click here. And when the user does click on that link,


[User] Please transcribe this text

[Assistant] And it turns out that we can use this href attribute not only to link to different websites altogether, but we can link to different pages on the same website. So for example, if I wanted to link to that cat page that I designed a moment ago, instead of linking to google.com, I could instead just link to image.html.


[User] Please transcribe this text

[Assistant] Now I see a click here link where when I click on click here, now I'm taken to that page catimage.html that happened to have that picture of a cat from before.


[User] Please transcribe this text

[Assistant] So using these anchor tags and href attributes, we're able to link together multiple pages. So that if we have a website that has many different web pages, we can connect them all together by using a combination of these various different links.


[User] Please transcribe this text

[Assistant] So now that we've seen images and links and lists, what other HTML elements might we add to our web page? Well, one thing we might want to add are things like tables, just other ways of displaying information. So let's go ahead and create a table and look at what HTML elements we can use in order to do so.


[User] Please transcribe this text

[Assistant] So I'll go back here to my text editor, create a new file called table.html. Using the same starting HTML, we'll call this page table.


[User] Please transcribe this text

[Assistant] And inside the body of this page now, there are a number of different HTML elements that we'll need in order to create a table. Because as you might imagine, a table is really composed of multiple parts. We have our big table, but each table is really just a sequence of individual table rows.


[User] Please transcribe this text

[Assistant] And each of those rows is really just a sequence of individual cells of data within that table.


[User] Please transcribe this text

[Assistant] And so that structure that we're imagining, a table that consists of individual rows, where each row consists of individual cells, is exactly how we're going to represent this table in HTML.


[User] Please transcribe this text

[Assistant] We're going to start with just a table tag that's going to represent the entirety of this table.


[User] Please transcribe this text

[Assistant] But inside of the table, we might have different parts. We might have the heading of the table, we might have the body of the table. So in order to represent that, I'll add t-head that's going to stand for the heading of the table. The stuff at the top of the table that might indicate what each column of the table means, for example.


[User] Please transcribe this text

[Assistant] And let's see, what columns do I want? Well, let's go ahead and add some table headings, which I can represent using the th tag, h for heading.


[User] Please transcribe this text

[Assistant] And maybe I want in this webpage to display information about various different oceans, for example. So maybe I have one column for the ocean, and another column, another table heading, for the average depth of that ocean, and another table heading for the maximum depth of that ocean.


[User] Please transcribe this text

[Assistant] And that'll be the very first row of that table, the heading of the table. But in addition to the heading of the table, we also have the body of the table.


[User] Please transcribe this text

[Assistant] So underneath the T head, I'll go ahead and include T body.


[User] Please transcribe this text

[Assistant] And inside of this table row, we'll go ahead and add some individual data points inside of the table. So inside of my table row, I'm going to have one table data point, or TD, for table data, that says Pacific Ocean, for example.


[User] Please transcribe this text

[Assistant] Then another table data that says 4,280 meters, and then another one for the maximum depth of the Pacific Ocean, which is 10,911 meters.


[User] Please transcribe this text

[Assistant] And in fact, this, these three table heads as well at the top of the page, the ocean, the average depth and the maximum depth, those should actually probably be in a row of their own as well, because the very first part of the table, that is also a row. So I'll go ahead and add a tr, short for table row, and inside of that tr, put these headings.


[User] Please transcribe this text

[Assistant] I'll go ahead and add one more row just so we can see what this looks like and then we'll take a look at the page and then go back to this code. I'll add the Atlantic Ocean too.


[User] Please transcribe this text

[Assistant] Here's what I'm going to see. I'm going to see a table-like representation of the data. It's not just one thing after another after another anymore. It's structured in a table. Now granted, there aren't any borders, and I could probably add some colors and spacing to make this look a little bit nicer. But I see three columns, ocean, average depth, and maximum depth.


[User] Please transcribe this text

[Assistant] Where this very first row is what we might call the table header. The very top of the table that's defining what all of the columns mean. Inside of that table header is a single table row that has three table data cells. Ocean, average depth, and maximum depth.


[User] Please transcribe this text

[Assistant] Then beneath this table header, represented in bold, is the table's body, or the t-body element, inside of which we had two rows, one for representing the Pacific Ocean, one for representing the Atlantic Ocean. And then we had data cells in each one of those rows for representing each of the individual cells that's located within this table.


[User] Please transcribe this text

[Assistant] So this is what that page ultimately looks like. And let's take one more look at the HTML just to get an understanding for how all of these tags interact with one another.


[User] Please transcribe this text

[Assistant] And no need to memorize all these tags right now. Slowly as you begin to design HTML pages, you'll start to get more familiar with what HTML tags are available to you. And certainly all of these HTML tags are things that are easy to reference if you need to look them up. It's very helpful to be able to look up something like


[User] Please transcribe this text

[Assistant] How do I create a table in HTML? And then you'll be able to see what the various different tags you'll need to add are in order to generate the table that you're looking for.


[User] Please transcribe this text

[Assistant] And so using these nested tags, elements inside of elements inside of other elements, we've been able to build something far more complex than just a bulleted list. We've been able to build an entire table that has information as well.


[User] Please transcribe this text

[Assistant] Ultimately our webpages should be webpages that don't just display information, but that also let users interact with that information in some way.


[User] Please transcribe this text

[Assistant] For example, you might imagine that on Google's homepage, for example, it's not just unchanging, there's a field where I can type something in. And anytime users can provide input to a web page, we generally call that a form, or some place where a user can fill out a form in order to provide information to the web page.


[User] Please transcribe this text

[Assistant] And so now let's take a look at how we can use HTML in order to create a form that's going to display some information.


[User] Please transcribe this text

[Assistant] So I'll go ahead and create a new page called form.html. Again, using that same HTML as before. Call the page form.


[User] Please transcribe this text

[Assistant] And inside of the body of this page now, let's say that I want to create a form that gives the user an opportunity to provide their full name, for example.


[User] Please transcribe this text

[Assistant] And now inside of that form, what are the various different parts of the form? Well, there's really two parts that you might imagine to this form. One is a place for the user to actually type in their name, and they probably also need some way to submit the form. Some button that just says submit, such that they can click on that button in order to submit the form.


[User] Please transcribe this text

[Assistant] So how would we do that? Well, in order to create an input field, we're going to use an input tag.


[User] Please transcribe this text

[Assistant] There are a number of different ways that users might provide input to a forum. They might type in text, they might choose from a drop down menu, they might choose from a radio button option, or they might provide input as by clicking on a button, for example. In this case, we're specifically using the type attribute.


[User] Please transcribe this text

[Assistant] To say that when the user is providing input in this way, the type of input that they're providing is going to be some kind of text. Then we might provide a placeholder.


[User] Please transcribe this text

[Assistant] Some default text that's going to be inside of that input field the first time the user looks at the page. So for example, the placeholder might be full name. That way the user knows that what they should type into this placeholder is their own full name. And then finally, we're going to go ahead and give a name to this input field.


[User] Please transcribe this text

[Assistant] Now this isn't going to be something that the user sees when they visit the page. But anytime you submit a form, when we receive that form in our web application, something we'll explore later on, we need some way of knowing which input field corresponded to which value. And so we're going to name each of the input fields just so that later on we'll be able to reference them.


[User] Please transcribe this text

[Assistant] And for now, since the user is typing their full name here, we could just name this full name or we could more succinctly just say name as the name of this input field.


[User] Please transcribe this text

[Assistant] After that, we have an input field where the user can type in their name. And now we need some way for the user to be able to submit this form. So we might say something like input type equals submit to say, here is a way for the user to submit the form. Type equals submit means this is how they're going to submit the form when they're done completing it. Now if I open up form.html,


[User] Please transcribe this text

[Assistant] This is the page that we're ultimately going to see when we load this HTML.


[User] Please transcribe this text

[Assistant] This entire page just contains a single HTML form, but that HTML form contains two parts. The first part was this input element here that allowed an opportunity for the user to type in their full name. They type in their full name into this input field, and when they're done, they can click the submit button to indicate that they would like to now submit this form.


[User] Please transcribe this text

[Assistant] Of course, right now, this form isn't going to do anything when we type in our name and click submit because we haven't added any logic in order to handle this form.


[User] Please transcribe this text

[Assistant] But later on, as we transition into the world of building web applications using Python, we'll see how we can design a form such that after the user submits it, we save information to a database or display some sort of results back to the user, all by using the power of building these web applications and connecting them to these sorts of HTML forms.


[User] Please transcribe this text

[Assistant] And HTML forms can actually get quite a bit more complex. We'll take a look at another example, for instance. Let me open up, uh, forms1, form1.html, which is a form that I built in advance.


[User] Please transcribe this text

[Assistant] Which shows a number of other ways that users can provide information as input to an HTML form.


[User] Please transcribe this text

[Assistant] Here we see an input whose type is text, meaning we want the user to type in their name as text.


[User] Please transcribe this text

[Assistant] But you might also imagine that if a user is logging into a website, for example, they might, in addition to typing in a text-based name or username or email, also provide a password.


[User] Please transcribe this text

[Assistant] And generally, if you've been on a website and you've typed in a password, the password characters don't all show up as the actual characters. For security reasons, they generally show up as just little dots on the screen hiding the actual characters that they're representing. And in HTML, we can do that very easily.


[User] Please transcribe this text

[Assistant] By just saying that the type of this input is password. If they're typing in a password, our web browser will know not to actually display those individual characters.


[User] Please transcribe this text

[Assistant] In addition to just text-based input, we also have radio button input, as I alluded to a moment ago. So here we have a number of different radio inputs where the user might be able to select from a number of options, choosing their favorite color, for example, from a number of these options.


[User] Please transcribe this text

[Assistant] And finally, just to take a look at one other additional feature of HTML5, in fact a new feature of HTML5, is something we might call a data list.


[User] Please transcribe this text

[Assistant] Where we might have the user choose in a drop down from a number of different options, but we want to very quickly filter down or autocomplete based on those options. So if the user needs to select what country they're from, for example, we might have an input field.


[User] Please transcribe this text

[Assistant] And specify that it's going to be associated with a list called countries.


[User] Please transcribe this text

[Assistant] Then immediately below that, I have a data list element whose ID is countries, where here I'm going to specify these are all of the options for what country we could have. Each one is inside of an option element whose value is whatever country they could select, and we have all of the countries of the world listed in these option elements.


[User] Please transcribe this text

[Assistant] So this input here is going to allow me to select one option from a list of all of these possible options. So now if I open up form1.html, here's what that form ultimately looks like.


[User] Please transcribe this text

[Assistant] I can hear inside of the name field, again that word name shows up because it's the placeholder. I can type in my name here.


[User] Please transcribe this text

[Assistant] And inside of the password field, anything I type is going to show up as just little dots instead of the actual characters because the type of that input field with password instead of the type being text.


[User] Please transcribe this text

[Assistant] In favorite color, I now have the ability to choose between various different favorite color options in a radio button format. I choose from one of a number of options.


[User] Please transcribe this text

[Assistant] And finally, inside this country dropdown, I have the ability now, when I click on it, to see all of the countries. But as I start to type letters, like U-N-I-T, it filters down to only the options that I actually care about.


[User] Please transcribe this text

[Assistant] So here if I type in enough letters, eventually I see United States and I can click on that option as well.


[User] Please transcribe this text

[Assistant] So HTML5 builds in these additional features to make it easy to implement something like a text field where it will autocomplete based on the text that you provide. You can just specify that it is inside of


[User] Please transcribe this text

[Assistant] This data list and then provide a list of all the possible values and then HTML and your web browser in turn will take care of the process of rendering that information in the way that you expect it to be displayed.


[User] Please transcribe this text

[Assistant] So those are just some of the possible HTML elements that we can ultimately create by using these various different elements that we nest within each other.


[User] Please transcribe this text

[Assistant] We're going to have some tag that might require some attributes, additional information about the HTML to give context to the web browser for how that element should be displayed. Maybe that element needs to have a particular source for an image. Maybe it needs a link in order to link to somewhere or other information as well.


[User] Please transcribe this text

[Assistant] And then inside of that element you might nest other elements so that your table has rows and inside of those rows we have other cells and you might imagine nesting elements inside of other elements inside of other elements.


[User] Please transcribe this text

[Assistant] But right now so far, all of our webpages have been rather simple.


[User] Please transcribe this text

[Assistant] They've just been, we've described the structure of the page and we've described we want to list here, we want to form there. What we might really like is some way of specifying that we want to style our webpage in some way. We want to add color, we want to add spacing, we want to add some sort of other layout to our page as well.


[User] Please transcribe this text

[Assistant] And in order to do that, we're going to use a second language that we're going to call CSS. Short for Cascading Style Sheets. In particular, we'll use the latest version of CSS, CSS3, which gives us the ability to take an HTML page and tell the web browser how we would like it to be styled.


[User] Please transcribe this text

[Assistant] Instead of just black text in the same font on a white background, we can begin to specify particular CSS properties.


[User] Please transcribe this text

[Assistant] Of how we would like this page to look to make sure that the page looks the way we want it to.


[User] Please transcribe this text

[Assistant] So let's take a look at a simple example now of CSS to take a look at how we can add some CSS code to our page.


[User] Please transcribe this text

[Assistant] So I'll go ahead and create a new file that I'll call style.html just to demonstrate some basic ideas of adding some style to our page. And we'll go ahead and copy the same hello.html from before.


[User] Please transcribe this text

[Assistant] And maybe in addition to hello world, I display an h1, some big heading at the top that says like, welcome to my web page, for example. So now if I open up style.html.


[User] Please transcribe this text

[Assistant] This is what I see. I see a big heading at the top that says welcome to my webpage, beneath which is just the text, hello world.


[User] Please transcribe this text

[Assistant] And now imagine that I want to add some style to this heading at the top of the page. Maybe instead of being left aligned, I want it to be centered. Maybe instead of just being black text, I'd like to change the color. In order to do that,


[User] Please transcribe this text

[Assistant] Just as we've used attributes in the past to add additional information to this particular HTML page, we can do a very similar thing with CSS. We can specify that we're going to give this h1 element a style attribute.


[User] Please transcribe this text

[Assistant] And that is going to be equal to, and then in quotation marks, we're going to provide all of the CSS properties that we would like to add to this particular element.


[User] Please transcribe this text

[Assistant] So the way that CSS styling works is that we can give elements individual CSS properties where a property is something like the color of the element or the alignment of the element.


[User] Please transcribe this text

[Assistant] And each of those properties has a default value, but we can change its value to something else. So if, for example, I wanted to change the color of this heading so that instead of a black heading, it displayed as a blue heading,


[User] Please transcribe this text

[Assistant] I could say for this H1, I would like to give it a color property.


[User] Please transcribe this text

[Assistant] And then to give the color property a value, I say color colon, and then the value that I would like to give to it. So color colon blue, for example, followed by a semicolon, will change the color of this h1 element to blue.


[User] Please transcribe this text

[Assistant] And my text editor is automatically showing me a little square that shows me what this color blue is actually going to look like. This isn't part of the text, it's just my text editor being helpful so that I can see in advance as I'm writing this code what the color is actually going to look like.


[User] Please transcribe this text

[Assistant] Here's what I see. Instead of a black heading at the top, we've changed the color to blue.


[User] Please transcribe this text

[Assistant] If instead of blue I said I want the color to be red for instance, I can refresh the page and now the heading is red and there are many other colors. I can change the color to like spring green for instance and that's going to be a particular shade of green that displays just like this.


[User] Please transcribe this text

[Assistant] And so now we have the ability to add various different style properties to individual elements. I can say, take this heading and change its style so that the color, instead of being black, is going to show up as blue instead.


[User] Please transcribe this text

[Assistant] And if I want to add multiple CSS properties to the same HTML element, I can do that as well.


[User] Please transcribe this text

[Assistant] Here in the style attribute, I can say that in addition to saying that the color is blue, I'd like to give a second CSS property to this element. I'd like to say that the text align property should be center, for example.


[User] Please transcribe this text

[Assistant] The text align property controls, as you might imagine, how a particular HTML element has its text aligned. Is it all the way on the left, all the way on the right, or centered? And if I change the text align property to have a value of center, well then now when I refresh this page,


[User] Please transcribe this text

[Assistant] I see that welcome to my webpage is now both blue and it's centered. I've changed the color and I've changed the alignment of this particular element.


[User] Please transcribe this text

[Assistant] And HTML elements don't need to just be styled directly. They can also get their style information from parent elements. So if you recall again that DOM structure where we have an HTML element inside of which is this body element.


[User] Please transcribe this text

[Assistant] You can imagine if we wanted this styling to apply not just to this heading, but also to the hello world text, I could move the styling information. Move this style attribute, change it from the h1, and escalating it to this body.


[User] Please transcribe this text

[Assistant] And if I move the style to the body, then everything inside of the body is going to be styled in that way.


[User] Please transcribe this text

[Assistant] So let's now take a look at an example of that to see how that works. If I take this style information and I move it so that instead of associating it with the h1, I instead associate it with the body,


[User] Please transcribe this text

[Assistant] Then now, when I refresh the page, I see that both parts of the body, both the big heading at the top that says welcome to my web page, as well as the text, hello world, both have those CSS properties applied. I've changed their color to blue, and I've also changed their text alignment to be centered instead of just left aligned.


[User] Please transcribe this text

[Assistant] But if I do want it to just be that heading, then I can move it out and say that I just want to apply the style to that one individual heading.


[User] Please transcribe this text

[Assistant] Now, one thing that we might imagine might become a problem over time is that imagine if I had multiple heading that I wanted to style in the same way, for example. Let's say I have a second heading that this is a second heading that I also want to be styled as blue and centered as well.


[User] Please transcribe this text

[Assistant] I can refresh this page and see that right now that is not the case. And I don't want to make the entire page blue and centered. I only want these two headings to be blue and centered. So what I could do is I could just take the style code from the h1 and apply it to this h1 as well. So that both of my h1 elements now have the exact same style code.


[User] Please transcribe this text

[Assistant] And I'll go ahead and refresh this and now we see this is the intended behavior. I have two headings, both of which are centered and both of which are blue.


[User] Please transcribe this text

[Assistant] But what we want to start to think about as we start to build web applications, and especially as our web applications start to get a little bit more sophisticated, is to think about the design of how we're building our web pages and how we're building our web applications.


[User] Please transcribe this text

[Assistant] And in particular, anytime we find ourselves copying a lot of the same information from one place to another, that's probably not the best design. And you should start to think about how might you design this a little bit better.


[User] Please transcribe this text

[Assistant] It's not great design, one, just because there's some redundancy that probably doesn't need to be there, but also because it makes the page a little bit more difficult to change and a little more difficult to update. If I instead want to change both of these headings to be red instead of blue, then all of a sudden I need to change my code in two places.


[User] Please transcribe this text

[Assistant] I need to change the style attribute on this first heading up here. And I also need to change the style attribute on the second heading down there.


[User] Please transcribe this text

[Assistant] What I'd like to do is to somehow just be able to write this style code once and then have it applied to both of these headers.


[User] Please transcribe this text

[Assistant] And in fact, there is a way to do that. What we can do is instead of doing what we might call inline styling, where we take the CSS code and place it directly as an attribute of an HTML element, we can move our style code to an entirely different part of the web page.


[User] Please transcribe this text

[Assistant] Recall again that at the top of our HTML page we have this head section that just includes information that's useful to know about the web page but isn't actually part of the body of the web page, the content that the user sees.


[User] Please transcribe this text

[Assistant] This head section is a great place where we can begin to put some style information. Information about how we would like for this webpage to be styled.


[User] Please transcribe this text

[Assistant] So what I can do here is instead of putting these style attributes inside, in line with these HTML elements, I can inside of the head section of my webpage add a style element.


[User] Please transcribe this text

[Assistant] We're in between these, the opening style tag and the closing style tag. I can add any of the style information that I want.


[User] Please transcribe this text

[Assistant] And here's the way that syntax is going to look. I first need to specify what types of elements am I going to style. And in this case, I want to style all of the h1s. So I can just say h1, and then


[User] Please transcribe this text

[Assistant] All of the style code is going to go inside of a pair of curly braces, where I can say I would like the color to be blue, and I would like the text align property to be centered.


[User] Please transcribe this text

[Assistant] So now, here's what I've done. I've taken the CSS code that used to be down here inside the body of the page, actually as an attribute of these h1 elements, and I've moved the style-related code to a different part of my page altogether.


[User] Please transcribe this text

[Assistant] Now the style information is inside the header of my page, inside of the style element, where I've said, for every h1 element, here's how you should style it. The styling is in between the opening and curly closing braces here. And I've said that every h1 should have a color of blue, and every h1 should have a text align property of center.


[User] Please transcribe this text

[Assistant] And that is then going to apply to all of the h1 elements that my webpage happens to find inside the body of my webpage.


[User] Please transcribe this text

[Assistant] So there's a couple of advantages here. Advantage number one is what we talked about a moment ago. I don't need to duplicate the same code in both of these h1 elements. I can write it once and say apply this styling to all of the h1s that show up in the page.


[User] Please transcribe this text

[Assistant] And advantage number two is we've been able to factor out the style code to somewhere else just to make it a little bit cleaner. So that instead of having a really long line you might imagine if we had not just two but maybe five or six or seven different CSS properties that would have taken up a lot of space on one line.


[User] Please transcribe this text

[Assistant] I can instead, in a more readable, more organized way, move that style-related code to the style element at the beginning of the page, just to make it easier to read, easier to visually understand, and just to clean up the body of the webpage as well.


[User] Please transcribe this text

[Assistant] And that's going to be another of the key themes that's going to come up again and again in this class. This idea of separating things out so that every piece can sort of be independent of one another. Our structure of the webpage inside the body is separate from the style. And we'll see the same sort of idea appear again and again as we begin to try to design web applications.


[User] Please transcribe this text

[Assistant] We'll see that we see the exact same thing. Both of the headings still show up as centered. Both of them still show up as blue. But now we have the advantage of having only written the style code once instead of needing to write the exact same style code multiple times in the same way.


[User] Please transcribe this text

[Assistant] But it turns out that we can even do a little bit better than this.


[User] Please transcribe this text

[Assistant] Because one thing you might imagine is that if I have a web application or a website that has multiple different web pages, it's probably going to be likely that each of those web pages


[User] Please transcribe this text

[Assistant] Might need to be styled in similar ways. If I have a big banner at the top of one webpage, then in other pages related to that page, I might want the same banner styled in the same way using similar style information.


[User] Please transcribe this text

[Assistant] And right now, our CSS code is specific to one particular page. And it's not going to be easy to then take that same styling and apply it to another page.


[User] Please transcribe this text

[Assistant] If I wanted to, I'd need to copy the exact same CSS code, put it inside of another page, but then we run into the same problem of duplication, where I've now had to repeat myself across multiple different pages, putting the exact same CSS code across all those different pages.


[User] Please transcribe this text

[Assistant] So there is an improvement we can make, and the improvement we can make


[User] Please transcribe this text

[Assistant] Is to take that CSS code and just move it to an entirely different file.


[User] Please transcribe this text

[Assistant] So instead of putting this style code inside of a style element inside of this HTML page, I'll just create a new file that I'll call styles.css.


[User] Please transcribe this text

[Assistant] Inside of which is going to be all of the CSS that I care about. I want to take every h1, I want to change its color to blue, and now I want to change its text align property to center.


[User] Please transcribe this text

[Assistant] And now, inside of my HTML page, I no longer need to include any CSS at all.


[User] Please transcribe this text

[Assistant] Instead of this style element altogether, I can just link my CSS code in that CSS file called styles.css to this particular HTML page. And how do I link the styles.css file? Well, I can do so again in the head section of my web page using a link


[User] Please transcribe this text

[Assistant] Where I can say I'd like this link to be, uh, the relationship is it's going to be a style sheet. Meaning what I'm about to link is going to be a style sheet for this page. It's going to describe how I want for the elements on this page to be styled.


[User] Please transcribe this text

[Assistant] And then, just as in the case of a link to another page, I used href to specify a hyperlink reference, what I want to link to. I'm now going to specify, using an href attribute, what CSS file I would like to now link.


[User] Please transcribe this text

[Assistant] And in this case, the CSS file that I'm going to link is styles.css. That is the file that just so happens to contain all of the CSS that I would like to apply to this particular file. Now if I refresh the page,


[User] Please transcribe this text

[Assistant] I see again, nothing has changed. In the last two revisions the page has stayed exactly the same as far as the user is concerned. They still see two headings, both of them are centered, both of them are blue, but now the advantage is that here is my HTML.


[User] Please transcribe this text

[Assistant] And now if I have multiple HTML files that are all using the same styling, I can just link them all to the same styles.css file.


[User] Please transcribe this text

[Assistant] Such that they're all using the same style information. I don't need to repeat myself. And if ever I need to make a change across all of those pages, I just change the styling once. I change the styles.css file and then all of the web pages that are linked to that style sheet will update as well in order to reflect those changes.


[User] Please transcribe this text

[Assistant] So again, we've been able to factor out some of this style information to a separate file just to make our lives a little bit easier.


[User] Please transcribe this text

[Assistant] So, so far we've now seen how we can use CSS in a number of different ways to add some basic styles to our page. We've seen that we can take an element and change its color. We've seen how we can take an element and change its alignment. Move it from left align to right align to centered, for example.


[User] Please transcribe this text

[Assistant] As it turns out, there are a lot of different CSS properties that we can add to our HTML elements in order to style them in various different ways. More than we'll have time to talk about in this lecture.


[User] Please transcribe this text

[Assistant] But now let's just take a look at a couple of the most popular, most common CSS properties that we can add in order to make our web pages look the way we want it to.


[User] Please transcribe this text

[Assistant] And one of the most powerful tools for CSS is controlling the size of various different elements. By default, HTML just used a default size for everything on the page. But if I want to more precisely control how big any particular element is, I can use CSS in order to do so.


[User] Please transcribe this text

[Assistant] So let me now create a new file that I will call size.html.


[User] Please transcribe this text

[Assistant] We'll start with the same HTML code and call the page size.


[User] Please transcribe this text

[Assistant] And now inside the body of my page, let me just have a vertical section of my page, just some section of my page that's gonna have some content. And I'm gonna put this inside of a div.


[User] Please transcribe this text

[Assistant] Now this is the first time that we've seen a div in HTML. You can think of a div as just a division of the page, some section of the page that's going to have some content inside of it. And we use divs because it makes it easy to reference a particular div or nest information inside of other pieces of information or just to divide and break up our page into multiple different sections.


[User] Please transcribe this text

[Assistant] Here inside of the body, I'm just gonna have a single div that is going to say something like, hello world.


[User] Please transcribe this text

[Assistant] And now I'm going to add some style to this page in order to control the size of this div, to control the size of this section of my web page.


[User] Please transcribe this text

[Assistant] I could use inline styling, I could factor things out into another file, but since I'm only dealing with one file for now, I'm just going to add a style section to the top of my webpage, just so you can more clearly see how the style of this page is going to map on to the way that we're modifying these HTML elements.


[User] Please transcribe this text

[Assistant] And I would like to style this div in a couple of ways.


[User] Please transcribe this text

[Assistant] One thing I can do is give the div a background color. Let me change its background color to blue for example.


[User] Please transcribe this text

[Assistant] And then I can say, alright, I'd like to give this div a width and a height. Some size information. I can say, go ahead and give this div a width of 100 pixels, and maybe a height of 400 pixels.


[User] Please transcribe this text

[Assistant] I see in a 100 by 400 pixel wide vertical or rectangular section of my page, I see the words, hello world.


[User] Please transcribe this text

[Assistant] And so you might imagine if you have multiple different elements on your page, as your web pages start to get a little bit more complex, you probably want to have some more precise control over how wide or how tall any particular element is.


[User] Please transcribe this text

[Assistant] And these width and height attributes can be very helpful because I can very easily change the width to say like 500 pixels, for example. And now when I refresh the page, now I see that the width of this page, of this div, this section of the page, has actually now gotten a lot wider.


[User] Please transcribe this text

[Assistant] And so we have the ability to control size using CSS.


[User] Please transcribe this text

[Assistant] Go ahead and close some of these pages that I no longer need. And now take a look at some other things that we can do.


[User] Please transcribe this text

[Assistant] In addition to controlling the size, and let me change this color to something a little bit lighter, something like orange, such that now, if I open up size, it looks like this.


[User] Please transcribe this text

[Assistant] I'll make this a little bit smaller. Let's try 200 by 200 pixels. It looks now like this.


[User] Please transcribe this text

[Assistant] You might imagine there are some other changes that I might like to make. Like this hello world, for example, is very close to the edge of this particular div. It's right up against the upper left corner of that div.


[User] Please transcribe this text

[Assistant] I might want to change that by adding what we might call some padding to this particular HTML element. Some space just so that the content of the element isn't so close to the border of the element itself.


[User] Please transcribe this text

[Assistant] So for example, one thing I can do is inside this div, add some padding. Say maybe I want 20 pixels worth of padding on the inside of the element, such that now when I refresh the page,


[User] Please transcribe this text

[Assistant] We see that we have some padding along the outside of the element so that hello world now shows up not right up against the edge of the element but inside a little bit as well.


[User] Please transcribe this text

[Assistant] And if we have a particular HTML element that maybe is too close to the edge of the screen, maybe it's too close to the top of the screen, we can also add space around outside of the element by adding what we call margin to the element as well. So I can say let's give it 20 pixels of margin inside of this div.


[User] Please transcribe this text

[Assistant] And then refresh. And now we see that whereas before this div was very close to the upper left edge of the screen, now we've moved it 20 pixels away from everything. So it's got some space on all four sides of it.


[User] Please transcribe this text

[Assistant] So that's how we can now use margin and padding just to make the page look a little bit nicer to the user. So objects are not too close together or too far apart.


[User] Please transcribe this text

[Assistant] Padding, again, is on the inside of the border of the element. I can add 20 pixels of padding, for example, to make sure that the content inside of the element, in this case the words hello world, just have a little bit of space from the border. And that's padding on the inside of the element.


[User] Please transcribe this text

[Assistant] Margin, meanwhile, is on the outside of the element. We add some margin along the outside of the border to space the element out from other elements that might be nearby it, to make sure that there's enough space between the border of the element from the top of the screen and also from the left and also the bottom and the right, though there's no objects there that we're currently creating space from.


[User] Please transcribe this text

[Assistant] So by combining width and height and margin and padding, we now have the ability, using CSS, to make sure that we're able to lay out our page the way we want to lay out the page, so that elements have the right amount of spacing from each other and are the correct size.


[User] Please transcribe this text

[Assistant] So now let's take a look at some other features that CSS is going to give us.


[User] Please transcribe this text

[Assistant] In addition to just changing where particular elements are, like centering text or adding size and margin and padding, we can also use CSS to change how elements actually look.


[User] Please transcribe this text

[Assistant] We've seen it to change the color of text, changing it from one color like black to another color like blue. But we can also use CSS to be able to change something like the font that we use in order to display text. Modern web pages don't show everything in the exact same font. Usually some designer is choosing what font they want for any particular web page.


[User] Please transcribe this text

[Assistant] So let's experiment with those possibilities. I'll now create a new file that I'll call font.html.


[User] Please transcribe this text

[Assistant] Inside of which will be an HTML page called font.


[User] Please transcribe this text

[Assistant] And inside the body, I'll again just have a div that says, hello world. Same as before. But now, inside of the style,


[User] Please transcribe this text

[Assistant] Tag here, up in the head section of my webpage. I would like to add some font information to this div.


[User] Please transcribe this text

[Assistant] And in particular, there are a number of different font-related CSS properties that I can add to control the font of any particular HTML element.


[User] Please transcribe this text

[Assistant] One thing I can specify is the font family, specifying what font would I like to use in order to display this text. And maybe I want to display it in Arial, for example, which is a common font used on the internet.


[User] Please transcribe this text

[Assistant] Such that now, if I open up font.html, I now see in Arial the words hello world, different from the text that I was using before.


[User] Please transcribe this text

[Assistant] You can also specify multiple different fonts. Not all computers support all fonts, so I could specify that just in case Arial isn't supported, fall back to any sans serif font, any of the fonts that don't have the little glyphs at the edge of each of the characters.


[User] Please transcribe this text

[Assistant] So now if I refresh the page, because my web browser supports Arial, I don't notice anything different, but you might imagine if you're using more complex fonts that not all web browsers have or support, you might add some backups just in case the font you want isn't actually available.


[User] Please transcribe this text

[Assistant] In addition to a font family, I might also specify a font size. How big I want the font to be inside of this div. So I can specify that I'd like the font size of this div to be, you know, 28 pixels, for example. Such that now I refresh it, and now this div appears using larger text.


[User] Please transcribe this text

[Assistant] And I can also, just as like text editors let you specify whether you want it to be normal text or bold text, I can specify a font weight for this div. And say that in addition to being in font ariel and size 28, I would also like for the font to be bold. Such that now I refresh it, and now the font shows up as bold.


[User] Please transcribe this text

[Assistant] And using these CSS style sheets, we're able to selectively apply the styling to only particular parts of the webpage. If I have another underneath this div...


[User] Please transcribe this text

[Assistant] Such that now if I refresh this page, some more text shows up in that same standard default font provided by my web browser and not the custom font that I have specified to apply to only this particular part of the HTML page.


[User] Please transcribe this text

[Assistant] So that now is the ability to add fonts to our page 2.


[User] Please transcribe this text

[Assistant] Another thing that we might want to do is to be able to add some sort of border around our HTML element.


[User] Please transcribe this text

[Assistant] So maybe I want a line to be able to separate this entire part of the page from another part of the page. So I could add a border by going to this div and saying, let me give this div a border. And maybe I want the border to be like a three pixel solid black.


[User] Please transcribe this text

[Assistant] I can specify how big I want the border to be, I can specify whether I want the border to be a solid line or a dashed or dotted line, and I can specify what color I would like that border to be as well.


[User] Please transcribe this text

[Assistant] So now when I refresh this, I now see I have a border around this entire section, around this entire div, inside of my webpage.


[User] Please transcribe this text

[Assistant] And you can imagine these borders being helpful for styling various different parts of my page. So for example, if we go back to that table that we were looking at a moment ago when we were dealing with oceans, where I had an ocean and Pacific Ocean and Atlantic Ocean, this is structured in the format of a table. We have rows and columns.


[User] Please transcribe this text

[Assistant] But it doesn't look great right now. I might like to add some styling in order to improve the way this table looks, for example. So let's give that a try. I'll go ahead and go back into table.html.


[User] Please transcribe this text

[Assistant] That HTML file I was using before where I had this table. And let me now add some style information to this table.


[User] Please transcribe this text

[Assistant] I might say that for this table, I would like to give it a border that is maybe a one pixel solid black border.


[User] Please transcribe this text

[Assistant] Such that now when I refresh the page, I have a one pixel solid black boardroom around the entirety of the table.


[User] Please transcribe this text

[Assistant] Alright, that's great, but I also really wanted to border in between the rows and the columns as well. In particular, every table data item, I might like to have some additional CSS applied to those too.


[User] Please transcribe this text

[Assistant] So I might say for every table data cell, again td stood for table data, and those were the individual cells within my table, I might specify that I would like those to also have a border that is one pixel solid black.


[User] Please transcribe this text

[Assistant] Such that now I refresh the page and now each of my table data cells also has a border around it.


[User] Please transcribe this text

[Assistant] Now this applied to the table data cells in the body of my page, but it didn't yet apply to these cells up in the heading. And that's because those...


[User] Please transcribe this text

[Assistant] And so here we have a couple of options. I could specify, once more, table headers I would like to give a border of one pixel solid black.


[User] Please transcribe this text

[Assistant] But when I do so, you'll see that it does create a border around those table headers. But again, one thing that should be crossing your mind now is that there's a fair amount of redundancy here. Some repeated style code that shows up in multiple different places.


[User] Please transcribe this text

[Assistant] Table data cells in the body of my page? I really want to be styled in a very similar way to table header cells. And so it would be nice if I could somehow consolidate these two different, uh, CSS selectors. These ways of me saying, style table data, style table headers, I'd like to combine them into one.


[User] Please transcribe this text

[Assistant] And you can in fact do this in CSS. There are a number of different CSS selectors, ways of choosing elements. And one of them is just called the multiple element selector. That if I want to select both table data cells and table headers, then I can do so by saying td, comma, th. And delete these three lines down there.


[User] Please transcribe this text

[Assistant] What these three lines are now saying are that I would like to style all table data cells and table headers in the same way. And I could even combine table if I wanted to for good measure. But I'd like to give all of them a border of one pixel solid black.


[User] Please transcribe this text

[Assistant] Such that now I refresh it, and now I see that they all have this border around them.


[User] Please transcribe this text

[Assistant] Now most tables you see on the internet don't have both a table or a border around everything in the table and also a border around each of the individual cells. Usually those are collapsed just into a single line. And it turns out that CSS has an easy way for you to do this as well.


[User] Please transcribe this text

[Assistant] I can add a CSS property to the table called


[User] Please transcribe this text

[Assistant] Border collapse, and just say I would like to collapse all of the borders in the table. Just going to show you there are many, many different CSS properties, far more than we'll be looking at today, but they're easy things to reference. You can easily look up how to collapse borders in a table and then find a CSS property like this that you can then use and apply to your webpage.


[User] Please transcribe this text

[Assistant] So now I refresh that and now I see that I have a border, just a single border, around all of the cells in this particular page.


[User] Please transcribe this text

[Assistant] Next what I might like to do though is like add some space around here. Like it seems like


[User] Please transcribe this text

[Assistant] This text is very tight against the border of this table. So in order to do so, I want to add some spacing.


[User] Please transcribe this text

[Assistant] And recall again, do I want margin or padding? Margin is spacing around outside of the border of a particular HTML element, whereas padding is inside of the border. So if I want some space inside of the border just to space out the text from the border itself, then what I want is padding inside of all of my table cells.


[User] Please transcribe this text

[Assistant] So I can say, let me add five pixels worth of padding inside of all of my table data cells and table header cells.


[User] Please transcribe this text

[Assistant] Refresh the page, and now here's what the resulting table looks like.


[User] Please transcribe this text

[Assistant] Just by adding a little bit of CSS, specifying what border I want around the edge of the page, specifying a little bit of padding inside of each of the cells, my table now looks a whole lot nicer than it did just a few lines of code to go when I just had the HTML structure of the page and not the CSS to describe how I actually want that page to be styled.


[User] Please transcribe this text

[Assistant] And notice again that in doing so we were able to use one of these CSS selectors. I was able to say that I wanted to use the multiple element selector, which is just this comma here, to specify that I would like to apply this styling not just to TDs but also to THs as well.


[User] Please transcribe this text

[Assistant] We'll take a look at some additional examples of CSS selectors in just a moment.


[User] Please transcribe this text

[Assistant] But next, let's turn our attention to some more tricky instances where we might want to apply styling to multiple elements at the same time. Let's imagine, and let's go back to style.html, where we had some style code, where I had one heading. I'll call this heading one. And let's give myself two other headings, heading two and heading three.