Full Stack Web Devlopar - Part 006 _HTML&CSS-EP1

Full Stack Web Devlopar - Part 006 _HTML&CSS-EP1

By DR-9 | How To Start Making Websites | 23 Mar 2020


Creating more content for our website

Today we are going to add some more elements in our website.

And you are going to learn how to create website like in 2001 haha.

Don't worry, as I write this blog the websites will get fancier.

This is just for you to understand the basics well.

 

Open up VSC and our website in browser

At first we shall remove everything

we have in our HTML and CSS so 

we start with empty document.

Like this:

351665157-579b7ba657a0520f413deb4581b4e584edc1db141a2c91797f7ce452d534a70b.png351665157-57a45a0a3b62334c6392af496812a17ab48dabd928f99e0ddb84080cbf582953.png

(first pic is html and second is css)

 

Creating containers for our content

Ohh, this is getting interesting.

To create a block where we can place our content

let's use this tag: <div></div>

It's short for divider.

Now let's create 4 of them under each other.

To do it quickly type div*4 and press enter in VSC.

Then we have this:
351665157-3df64f3665c59b4457b9d5dda1ed2859448d9abccd3300b1fdd6b70d2e077aa0.png

 

Now let's give them all ID's.

ID is used when we want to target one element specifically.

If we want to target more we would give them CLASS.

Then if we change something in CSS for class 'yellow' all elements with that class will change.

In CSS we target ID with #idhere and class with .classNameHere.

So here goes our HTML and CSS so far:

351665157-c15daea7c5edff113a6ce1ae7ef8ee46bd73eebae50cb528718d2475ea5dc9f6.png

351665157-e455273e727934cec7ded97b6fca74dbc1c3f6eed836d619aec7967aba740899.png

 

Styling our containers

Let's give them some dimension and background color.

To set width, height and change color we do this:

351665157-7206f2498cb2b31d62542222b3f2c9c8d94f2540de7954ff85aab06befc3b5fc.png 

 

And now HTML:

351665157-dde45b85e7513014d8ef56449dc594d046c49f13c323971c10009c9cb5b16c6b.png

 

To target all divs I targeted just div in CSS.

And pushed the content inside, which created 20px bigger container.

So to my original 400px it added 20px = 420px.

So next I had to subtract those 20px from 400 to make it the original size.

 

Then I chose color for the containers

and added float: left; which makes

the content of the block go to left.

You can play with it and use right.

 

In HTML I then created some 

paragraphs, and headings of different levels.

 

So in the end my website looks like this:

351665157-3c800ccfd18f6c9ee3e3c6fb6950e2a7646c260fbf5ec139cabf674ec4434b05.png

So now, yours might look different.

Depending on the size you chose for blocks

and different background colors.

And obviously text.

You also might use percentage 

for sizing the boxes.

To make them full width

you would use 100%.

 

That's all from me today,

try play with it and discover new things.

If you are stuck or don't understand something leave me a comment

or google haha.

 

I'm out! 

How do you rate this article?

0


DR-9
DR-9

Hi all. My name is Daniel.


How To Start Making Websites
How To Start Making Websites

So you decided to create websites... I will tell you where to start, what documentation / resources helped me personally and a lot more.

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.