Skip to content

Web dev 101

Posted on:March 11, 2023

Quiz & Review

True or False

Web Structuring Section

HTML Section

CSS Section

Set up your dev tools

Create your first website

Set up the files

Hands on time!

Let’s do it fully inside a terminal.

Serving the files

Like we said, we need a browser to see our website. But we also need a server to serve our files.

In this case, we will be starting a server on our computer.

Live Server is a VSCode extension that will serve our files for us.

Hands on time!

HTML

Hands on time!

Now you can see your website in the browser! How cool is that!

A great resource I recommend everyone to use for looking up any HTML tags as well as CSS and JavaScript syntax is W3CSchools

Let’s add more things to the simple web page.

Add a <Image/>

Add a <Button></Button> That says “Press me”

CSS

CSS Selectors

CSS’s syntax is very simple. It’s just a selector followed by a list of rules.

Element selector

p{

  }

Class selector

.this-is-a-class{

  }

ID selector

#id{

}

More selector usage, you can check W3CSchools.

We use different selectors for different abstraction level of our styling.

And how do we apply the styles to the html

<p class="class-a class-b class-c" id="myP1"></p>

An HTML element can have multiple classes, but only one id

CSS Rules

There are tons of CSS rules out there, you don’t have to remember all of them.

Some examples of rules you will see everyday:

background-color: defines the background color of an element.
color: defines the color of an element.
border: a shorthand(collection) of border styles
margin: defines the margin of an element.
padding: defines the padding of an element.

Everything in CSS is a box!

For things that are not shaped like a box like texts, think of it as always having a imaginary box containing it.

Hands on time!

Let’s make a colorful webpage!

JavaScript

JavaScript is the only way (for now) for the client browser to be interactive and can fetch data dynamically.

JavaScript Baaaaasic:

console.log()
alert()
Date()

JavaScript HTML DOM

What makes JavaScript useful is that it can manipulate the HTML DOM. DOM stands for the Document Object Module, which defines what you see on the browser.

How to manipulate DOM?

W3CSchools

Key methods and properties:

document.getElementById(Id)
document.getElementsByTagName(name)
document.getElementsByClassName(name)
element.innerHTML
element.attribute

JavaScript event and event listener:

W3CSchools

Hands on time!

JavaScript Async

Finally, the most important (and probably the hardest) topic of today.

W3CSchools

A important aspect of Web Dev is data fetching, and till now we have not talked about it.

Syncing data, it takes time, that’s why we need to use async functions.

Hands on time!