5 How to Structure Text in HTML

5  How to Structure Text in HTML

So now that we understand how the ational boilerplate works and what each line does in it it’s time to move into the body section and start giving our Web site some content because at the moment our Web site is looking a little bit plain. So if we have a look at John Kleinberg Web site the first thing that we want right at the top here is a level one heading that says On name. So let’s head back into Atun. And as a challenge to you at a level one heading inside the body section of your website that contains your name. So this one’s easy and it’s made even easier using the autocomplete features inside atom. All have to write in order to create an H1 tag which is what’s needed to create and level one heading is I just have to write each one and it makes a suggestion asking me Are you looking for a heading level one. And now if I hit enter or if I hit tab I get the H-1 tag inserted automatically opened and closed for me and my cursor gets moved right in between. Exactly the place where I would need to start typing. So now if I hit save and I head back over to my personal site and remember if you close down this tab you can always go into your find your Explorer to open it back up again or you can select the full file path from Atun as well and paste it into here. Now if I hit enter you can see my H-1 my level one heading gets shown up here just like Jon Klein Burk’s and we’re ready to move on to the next thing. Now we want to have a line that shows our title so who it is that we are. So let’s head back to atom and first I’m going to get rid of this little heart because it doesn’t look very professional and I’m going to add another H-2A men under the age one. And this is a good point to talk about how to keep your HMO file neat and tidy. Now most programmers are very serious about how to indent and structure their HMO files. And the reason for it is because having these indents makes it easy for us to see at a glance which tags are inside other ones. So for example if we look at the top level here we’ve got the eight CML tag. And because both the head and the body tags are indented inside these eight Ginnell tags. It shows us at a glance that the head is inside the HMO element and as is the body but the body and the head there are the same hierarchical level. They’re not inside of each other at all. And this is a good structure for us to be able to see at a glance what’s happening in our code. And also when other programs look at our code because we’re used to working with the same structure it’s easy to be able to understand what’s going on at a glance. So you can see that there’s one part of our code that breaks this rule and that’s this line here. Our H1 is contained inside our body element and so it should be indented like so. And you can clearly see that this is now a child or contain inside the body tag. Now if you didn’t want to do that manually every single time. Well we actually installed a package right at the beginning that helps us with this organization. It’s all the little housekeeper if you will. So if you go to packages and go to atom beautify and click on beautify it will automatically beautify your entire fail to make all of the indents for you and to make everything look neat and tidy. So every so often once your code starts getting messy either learn the shortcut or go through it in the menu and reorganize your code file. It’ll make it much easier on the eyes and much easier to read. So now I want to add my title under my H-1 tag. And for this I’m going to use the p tag which is a paragraph tag and the tag format’s text into a paragraph. So they get a new line and the text inside gets grouped together into the same paragraph. So let’s add my title here. And now let’s see what all changes look like. So remember again command as control as to save and head back over to our site and command or control or to refresh or click this button to refresh and there we go. Those are brand new paragraph showing up. Now if we look at John Kleinberg you can see that his title is italicized and ours is not. So how can we make our italicised as well. Well this is where our lessons or documentation is going to come in handy. Let’s go ahead and go to Google and see if you can find out how to italicize your text using H.M. So let’s write publicize HMO MT-NW and let’s hit enter and you’ll see that there’s actually two tags that come up him and the first one that comes up is this one so let’s have a look at it first. Now this is the E-M or the emphasis element and it marks text that has a stress emphasis. Now it looks like this in practice. And the result is that it makes it look italicised. Now you might have noticed back here we also had the eye element or the eye tag and it does the same thing visually. It also makes the text that’s in between the eye tags italicised. But there’s a little bit of a difference here. And the difference is quite subtle. The emphasis tag tells the browser the words that are enclosed between it should be stressed or should be emphasized but the eye tag only italicised is the text. So it only styles the text to make it slanted and it doesn’t confer any of that emphasis. And for this reason it’s good practice to always use emphasis instead of a taluk because it conveys more information and it isn’t just about the style. Remember when writing aged Hamal code we’re more concerned about structuring our text rather than caring about how it looks or how it appears. Now a similar pair is the B tag or the bold tag. And this is equivalent to the e-TAG it makes any text that’s in between. Bolded like so. But instead what you should be using is the strong tag. And that’s because the strong tag again confers meaning. It says that this text has strong importance and therefore it’s displayed in bold rather than merely saying that this should be styled so that it’s darker than the rest of the text. And if you’re interested you can have a read between bold and strong as well as emphasis is strong as well as emphasis and and taluk it makes for some interesting reading and gives you a bit more background information on the different between these two tags. But whenever you’re looking to make something bold in your website you should probably be using the strong tag. And whenever you want to make something italicize you should be using the emphasis tag. So let’s go ahead and make our paragraph this title italicized or emphasized like so. So if you’re a member or we have to do is just to enclose it inside the E-M TYG. Now you can do that for the entire length of the tags or you can simply apply it to just a section of the text. So for example if I wanted to make the part where it says the app brewery bolded then I can simply add a strong tag and have the app brewery not including the full stop inside the strong tag. Now if I hit save and go ahead and refresh then you can see that the entire paragraph is emphasized and the app brewery is bolded. So we’ve done a little bit of formatting for our website. Now let’s move on to the next part. We’re going to add a little bio here and that again is going to be inside a paragraph element and it just tells anybody who’s visiting our personal site who we are and what we’re all about. So once you are ready go ahead and figure out where you should at this and complete the challenge. OK so that wasn’t so hard. All we have to do is just to indent. So we’re in the right position. Inside the body tag we’re going to create a new paragraph element. So this is going to be on a new line from this paragraph. They’re going to be separate paragraphs. And here I’m going to write I am an eyeless and Web developer. I love coffee and brew my own biz. Let’s save and check it out here. All right. Looks pretty good. And we’re getting pretty far ready. So obviously you can put as much or as little as you want here and design your website however you want it to look. Now the next thing I want to add is this horizontal line and we’ve done that previously. So you can go ahead and add that into your code file as a challenge. All right. So Jim how to do that. Well all we need to do is we’re still staying inside the body because we’re creating the content for our Web site and all we need to do is just to create a horizontal rule. So I’m going to use my good friend or to suggest I’m going to write H.R. and hit enter to insert a new horizontal rule. And now it’s looking pretty similar to what we’ve got him. Now the last thing I want to add is a subtitle where I’m going to list all the books and courses that I’m teaching. So go ahead and add a level three heading to your website. Underneath the horizontal rule and call it books in teaching or if you don’t have many books and teaching you can simply call it education and list all the schools that you’ve attended so underneath a horizontal rule. I’m going to add an H3 so level 3 heading and this is going to be the books and teaching. All right. So we’ve already got most of our personal site coded up in the next lesson. We’re going to be diving into H-2 email lists and how we can create these bullet points as well as numbered points and added to our website. So all of that and more. I will see you on the next lesson.

Leave a Reply

Your email address will not be published. Required fields are marked *