So now that we understand how the HTML boilerplate works and what each line
does in it,
it's time to move into the body section and start giving our website some
content cause at the moment, our website is looking a little bit plain.
So if we have a look at Jon Kleinberg's website,
the first thing that we want right at the top here is a level one heading that
says our name. So let's hit back into Atom and as a challenge
to you, add 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 auto complete features
inside Atom. All have to write in order to create an h1 tag,
which is what's needed to create a level one heading, is I just have to write
h1 and it makes a suggestion asking me,
are you looking for heading level one? And now if I hit enter, or if I hit tab,
I get the h1 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 Finder or your Explorer to open it back up again
or you can select the full file path from Atom as well and paste it into here.
Now, if I hit enter, you can see my h1,
my level one heading gets shown up here just like John Kleinberg'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.
Let's head back to Atom. And firstly,
I'm going to get rid of this little heart because it doesn't look very
professional
and I'm going to add another HTML element under the h1.
And this is a good point to talk about how to keep your HTML file neat and tidy.
Now,
most programs are very serious about how to indent and structure their HTML
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 and we've got the HTML tag and because both the
head and the body tags are i dented inside these HTML tags,
it shows us at a glance that the head is inside the HTML element and as is
the body. But the body and the head they're at 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 programmers 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 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 contained 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 our 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 code file 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 h1 tag.
And for this, I'm going to use the P tag,
which is a paragraph tag and the P tag formats 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,
1: yeah.
0: And now let's see what our changes look like. So remember again,
command +s or control + s to save and head back over to our site and command + r or
control + r to refresh or click this button to refresh. And there we go.
There's our brand new paragraph showing up. Now, if we look at Jon Kleinberg,
so you can see that his title is italicized and ours is not.
So how can we make ours italicized as well? Well, this is where our lessons
on documentation is going to come in handy.
Let's go ahead and go to Google and see if you can find out how do to italicize
your text using HTML.
1: Go on.
0: Let's write italicize HTML MDN
and let's hit enter.
And you can see that there's actually two tags that come up here
and the first one that comes up is this one. So let's have a look at it first.
Now this is the em 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 italicized.
Now you might have noticed back here,
we also had the i element or the i tag
and it does the same thing visually.
It also makes the text that's in between the i tags italicized.
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 i tag only italicizes 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 italic
because it conveys more information
and it isn't just about the style.
Remember when we're writing HTML 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 i tag.
It makes any texts 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 and strong,
as well as emphasis and italic.
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. If you remember,
all we have to do is just to enclose it inside the em tag.
Now you can do that for the entire length of the text,
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 this 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're ready,
go ahead and figure out where you should add this and complete the challenge.
OK. So that wasn't so hard. All we have to do is just indent,
so we're in the right position,
we're inside the body tag. And we're going to create a new paragraph element.
So this is going to be on a new line from this paragraph.
They are going to be separate paragraphs and here I'm going to write
I am an iOS and web developer.
I love coffee
and brew my own beers.
Let's save and check it out here. All right. It looks pretty good
and we're getting pretty far already. 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.
1: Go on.
0: All right. So do you remember 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 website.
And all we need to do is just to create a horizontal rule.
So I'm going to use my good friend autosuggest and I'm going to right hr and
hit enter to insert a new horizontal rule.
And now it's looking pretty similar to what we've got here. 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. Go ahead
and add a level three
heading to your website underneath the horizontal rule and call it books and
teaching. Or if you don't have any books and teaching,
you can simply call it education and list all the schools that you've attended.
1: Okay.
0: All right. Underneath the horizontal rule, I'm going to add an h3
so a level three 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 HTML lists and how we can create these bullet
points as well as numbered points and add it to our website.
So, all of that and more, I'll see you on the next lesson.