Welcome!

In this class we'll be learning about HTML, CSS, Javascript, and Bootstrap! Over the course of the next few weeks, you'll go from making very simple, introductory websites, to eventually making your own content rich websites. If we have time, we'll be able to eventually develop our own dynamic websites!

Welcome!What you will need:Getting Started - What is the Web?The InternetWeb BrowsersWeb DevelopmentHow do we create Websites?HTML - Structuring Websites:Structure of an HTML Page:Formatting TextParagraphs and DivsItalic Lettering:Bold Lettering:UnderliningHeadersHorizontal LinesSuperscripts and SubscriptsCode and PreformatLinksImagesLists:Unordered Lists:Ordered Lists:TablesAttributesStyleColorFont SizeText AlignmentBordersPadding and Margin

What you will need:

Now, onto the fun stuff:

 

Getting Started - What is the Web?

The Internet

The internet is a system of computer networks that are all connected. Originally used by the US Military and Academic Universities, the internet has changed the way the world shares news, information, and ideas. The internet allows your Computer, phone, iPad, etc, to connect to servers located all over the world.

The internet has revolutionized the way the world communicates, does business, and shares information.You can upload and download files from the internet. When you watch a movie on Netflix, you're on the internet! When you play a video game over XBox Live, you're on the internet! If you're reading this webpage, you're on the internet! Your parents might even use the internet to check their bank account and do work.

Most people connect to the internet via their Internet Service Provider, also known as an "ISP". Your ISP could be a mobile telecommunication company - like Sprint or T-Mobile, a cable company - like Spectrum, or even a dial-up internet company, like AOL.

 

Web Browsers

A web browser is an app which runs on your Computer or mobile device which allows you to access websites on the internet. Some example web browsers are:

 

Web Development

Web development is the process of designing and creating a Website for the internet. Websites can be simple pages with text, images, and links:

Website can also be complicated, dynamic pages where content is streamed, uploaded, and always changing:

 

How do we create Websites?

With code! Specifically, websites are usually created with languages such as: HTML, CSS, and Javascript. We will be spending most of our time learning HTML and CSS, as they are the most basic building blocks to build any website, and will provide a solid foundation to go on and build more complicated software systems.

 

HTML - Structuring Websites:

HTML (Hyper Text Markup Language) is the primary way of creating static webpages. When you think of coding, you probably don't think of HTML in the same way you think of a more complex language like javascript. Markup languages are languages that help us render documents! HTML helps us render documents with elements and attributes (and a whole lot more). Our web browsers download the HTML code, and render the code on our own computers! We'll be going from the very basics of HTML all the way to the newest version: HTML 5 in the coming couple weeks!

You may have noticed that at the beginning of our HTML code, we have:

<!doctype html> is not an element! It is something for our web browser to read to know that we're rendering an HTML page!

 

Structure of an HTML Page:

You can boil almost all of HTML down to elements (sometimes called tags) and attributes! Elements are any html code that we call with angled brackets:

 

Elements have a very special syntax (i.e. they're written in a very special way):

All elements start with <element-name>All elements end with </element-name>Most elements have their own special functions!
<html></html>HTML elements are where we put all of the HTML code
<head></head>This is where we put special 'header' elements, like page titles, styles, scripts, and other metadata. The head is where the site's brains live
<body></body>The body is where we put the content that renders on the page!
<div></div>This is a div element, which is kind of a catch-all block element (which we'll talk about more)
<p></p>Paragraph elements where a lot of people put their text content!
<a></a>Anchor elements are where we place our links (both internal and external)!

 

If your HTML element has both an opening and closing tag, you can nest other tags inside! It's a good idea to indent to show the nested structure of the tags.

 

Some HTML tags don't require a closing tag. That's because we don't really need to put text between the opening and closing tags:

Empty HTML ElementsEmpty HTML Elements Have Their Functionality Too!
<br />When you write HTML, if you need to write a new line without creaing a whole new section, use this break.
<hr />Sometimes you want a break. Horizontal rule will create a nice little line on the page.
<img />The internet would be an extremely boring place without pictures! This image tag lets us place images on our page!
<link />You saw the anchor element up above, that's used a lot for internal links. The link element is often used for external links (like say if you wanted to send somebody to google!)

 

You can nest empty HTML elements inside of other HTML elements.

 

These are just a small handful of the elements we'll be using throughout the coming weeks!

And remember ALWAYS CLOSE YOUR ELEMENTS

Now that you've seen all the elements, let's get a look at what an HTML page looks like! Below is the most basic html page you'll ever come across:

Play with this code here:

While you're playing with the code, try placing text in the head!

 

Formatting Text

So far, we've learned how to display plain text with HTML. Now, let's learn how we can better organize and style our code! When we format our HTML, we want it to ultimately look just like any other text that you'd make in MS Word.

 

Paragraphs and Divs

Keeping Content together is a big part of writing your site! Both paragraphs and divs are meant to be containers. Both <p> and <div> put a space after themselves. Like paragraphs in books, we want to keep them separated. The only major difference between them is that people often use <div> as a catchall and write special classes for it in CSS, which we'll get to soon!

To see how these work, take a look at the lorem ipsum placeholder text:

 

Did you notice that when the code was rendered, the second line of our <div> didn't actually show up as a second line? That's because no matter how many line breaks we enter on our keyboard, HTML will not render a line break. For that we need to add a <br />. Check it out:

The <br /> gives us a new line!

 

Italic Lettering:

To emphasise or stress words in your HTML, you can use italics! <i> and <em> both look like italics, but <i> shows greater emphasis to a screen reader than does <em>. Take a look at the code:

 

Bold Lettering:

To boldly letter something in our code, we need to use the <strong> or the <b> elements. They both look the exact same to us, but for screen readers for visually impaired people <strong> shows a little bit less emphasis. Take a look and how this code renders:

 

Underlining

Sometimes bold and italics don't get the point across as much as we'd want, that's when we'd want to start underlining our text! To do this, we use the <u> element. This Underlines all text between the <u> and </u>. Check out how underlining works:

 

Headers

Paragraphs and divs are great and all, but how should we title them? Luckily, we can do that with our header elements! Headers range in size from <h1> to <h6>. H1 headers are the biggest, and H6 headers are the smallest. Take a gander:

Headers get consecutively smaller as the numbers go! Be sure not to go too small, or you might end up with a header smaller than your actual text!

 

Horizontal Lines

Sometimes you might need to visually differentiate parts of your websites. One way to do this is with the <hr /> tag. Notice that it does not have a closing tag, that is because nothing goes inside of it!

 

Superscripts and Subscripts

Suppose you wanted to properly format some math on your site? You can do that with superscripts <sup> and subscripts <sub>! Look at that beautiful math:

 

Code and Preformat

We're getting pretty thick in the weeds for formatting, so this is it for the time being. The last two we have are for when we want to display 'code' or 'preformatted' text! Code <code> will render our font to look more like a monospaced text (programmers love this!), and preformat <pre> will render our text with the spaces and new lines EXACTLY as we left them! The main difference is that <pre> is a block element that makes its own section, while <code> is an inline element, like all of the previous formatters. Check out how it renders:

 

Links

If you need to connect one webpage to the other, you can use a link (aka a hyperlink). When someone viewing a website clicks on a link, it can open a new webpage. Anchor elements <a> can use an href to point to a link! Why don't you click on THIS link!

 

You can also link to other portions of the webpage you are currently on using the anchor tag with an ID <a href='#anchorID'></a>. Our webpages aren't big enough yet for this to be suer useful, but it will be nice to know once we start writing much larger webpages:

 

Images

When you want to include an image on your website, you'll need the <img /> tag. Just like the anchor tag, the image tag will need an href attribute that points to the image you want to display. Take note, the image tag is a self closing tag, as there is no need to render text inside of the image tag. There are multiple ways to upload an image to your site, but for now, let's just grab a link. We need to place the link as a value for the source attribute, like below! See the code in action!

 

Not all images are the same size. If you need to resize your image, you can scale it yourself! Check it out:

 

Lists:

So, we just listed all of those really cool things we want to do above! How would we actually write a list of things we like on our about me pages? How about a list?

 

Unordered Lists:

Unordered Lists are bulleted lists. This is where we will introduce the concept of an attribute (don't worry, we'll go into a lot more detail later). Attributes let us further customize our code!

Take a look at this default unordered list:

By using attributes, we can start changing things up in our lists (we'll go into how attributes work in detail after this section!):

Check out how these attributes change the list:

 

We can do what we did above, but, that's a lot of work to write type='square' on each single list item <li>. What we can do instead, is write it on top, at the unordered list <ul> level, and the type='square' will fall through down to the list items. Check out how much easier that was to write:

 

The types we can use for unordered lists are:

 

If one list is not enough... you can make lists of lists! Just like the other HTML tags we've learned, you can nest one <ul> inside of another <ul>

 

Ordered Lists:

Ordered lists are just like unordered lists, but, well, they're ordered! They're numbered/lettered in some way that gives order to the list! EXCITING! They work in the exact same way of unordered lists, but instead of using the unordered list <ul> we use the ordered list <ol>. Check it out:

 

Just like unordered lists, we can use attributes to change how we're listing things:

Here are the types of ordered lists we can use!

You can also nest Ordered lists inside of Un-ordered lists. And vice-versa!

 

Tables

Sometimes we need to display data that doesn't quite fit in either an ordered list, or an un-ordered list. A Table is a very popular way to display a large amount of data. If you've ever used Microsoft Excel (or Google Sheets), the concept of a table should feel very familiar.

Tables (<table>) consist of rows (<tr>), columns (<td>), and optionally, headers (<th>).

 

You may have noticed that that table did not have anything visibly dividing each row and column. If you want to add a border around each cell, apply the border attribute.

 

Attributes

This is a good a time as any to introduce attributes! So far we've only seen the type attribute, but from here on out, we'll be using attributes regularly! There are a ton of attributes. There is absolutely no need to memorize them all, but it is good to know the most used ones off the top of your head!

Style

By using the style attribute, we're allowing for what's called 'inline' styling. That means that we're styling a specific element within our code. This is good to know that we can do (and we will do it for now), but once we learn CSS styling, we won't be doing much inline styling!

Generally, you can apply a style attribute like this

If you need to apply multple style properties to the same tag, seperate each pair of property:value with a semicolon ;

 

Color

We can change the color of an attribute by giving it a value! We can change the text color with just color, and background color with background-color. Take a look and see these busy colors

Notice that not only are we using color names, we're also using hex code! You can find more out about what colors to use by taking a look at the web colors wikipedia page.

 

Font Size

We don't always want to have the same sizes of font in our paragraphs! We might want some containers with larger fonts, and others with smaller! We can do that with font-size! Take a look:

So, not only can we control exactly what our font-size is by way of using pixels, we can also use a percentage of what our font is (with reference to what it already was) with % and em (em is just equal to the current font size).

 

Text Alignment

Just link in Microsoft Word, we can tell our webpage where to display text. Sometimes we want it on the left side of the screen, sometimes we want it on the right side, and we can even align in right down the middle!

 

Borders

A lot of time, we want to cordon off some content! We can easily do that with a border! Borders are a little weird though (and we'll explore borders more when we work with CSS). Borders have an interesting syntax, when we call border, we need to call it with border: 'size' 'type' 'color', like border: 1px solid black or border: 1px dotted red. Check it out:

 

Padding and Margin

Padding and Margins helps us add some space around our content! Padding makes the space inside the element bigger, while margin makes the area outside the element bigger! Take a look at the way that margin and padding render:

You may have noticed that we didn't remove the borders! You can add as many styles as you want, just so long as they're broken up by semi-colons!

 

So, now you've gotten a crash course in web development, try making your own website! Next week, we'll begin learning CSS.