Uncategorized

How to Code a Website

YOU ARE READING: How to Code a Website AT Vccidata_En

Would you like to learn how to create a website with HTML and CSS?

You’ve come to the right place. In this guide, we’ll show you all the steps to go from a blank screen to a working website that’s optimized and looks pretty good at the same time.

Reading: How to quickly create a website using html and css

But first, what are HTML and CSS?

Well, you could just look up both terms in Wikipedia, but those definitions aren’t very reader-friendly. Let’s simplify things a bit:

  • HTML (Hypertext Markup Language) defines the structure and content of a web page – where things go, how they are arranged and what is on the page
  • CSS (Cascading Style Sheets) defines the styling/appearance of a web page and the elements on it

See this one really doesn’t work without the other – the two work together to create the final website, its design and the content on it.

Note; When we say “a web page” we mean a single HTML document – a single page that is part of your website. Whereas “a website” is the whole thing – your entire website with all of its individual web pages.

If you think this is overly complicated, we recommend you either build a website with WordPress or a of website builders to choose from.

Before you start, gather your resources:

So, the first thing you need even before you start building a website with HTML and CSS is a Web server (hosting). But no worry; You don’t have to buy your own machine. Many web hosting companies will sell you a basic hosting service on their machines. Just google “web hosting” and pick something that isn’t too expensive, or check out our web hosting reviews.

Once the server is sorted, the next thing you need is a domain name. The domain name is what identifies the website on the web. For example, the domain name of this website is websitesetup.org.

If you have both a domain name and a server, you can connect the two.

To clarify, no problem for you , we recommend signing up with a company like Bluehost.

They will do all the setup for you. That is, they will: (a) set up a hosting account for you, (b) register a domain name on your behalf, (c) > configure everything to work together, and (d) give you access to an easy-to-use dashboard.

Get started and sign up with one of the web hosting services , good, wait. When you’re back and have your web server configured and up and running, scroll down to the next step.

P.S. If you just want to experiment with an HTML website on your computer and don’t intend to make it public, use local web server software. The one we recommend and like to use is called XAMPP. It has versions for Mac and PC and is easy to use. Here is how to install it on your computer.

1. Learn the basics of HTML

The main element of an HTML structure is an HTML tag.

For example, a tag looks like this:

SOMETHING

Here we are dealing with a tag. This makes a piece of text bold that is between the opening tag () and the closing tag (). In this case, that text is SOMETHING.

But there are other tags, to name a few:

  • will den Italicize text between the opening and closing tags
  • is underlined
  • is a paragraph of text

  • is the main heading on the page

Besides these simple tags, there are also more complex tags. For example, if you want to create a list like this:

  • Item 1
  • Item 2
  • Item 3

… this works with the following HTML code:

  • Point 1
  • Point 2
  • Point 3

Or if you want to add a link to another page, like this one:

This is a link to our home page

… you can do that with this piece of code:

This is a link to my home page

Read this for the full list the HTML tags. It will be useful when you create a website with HTML and CSS.

2. Understanding the Structure of HTML Documents

Imagine your HTML page as if it were built out of Lego bricks. You put different building blocks on top of each other to end up with a certain larger structure.

But instead of Lego bricks, you get HTML tags…

Here is the most basic HTML document structure:

Hello world!

Hello world!

My first website.

You can take the above code, copy and paste it into a new file, save the document as index.html , and it will be a perfectly valid HTML page.

Let’s explain each part of this code:

  • – the initial declaration of the document
  • – another declaration; says that an English HTML document will be written next
  • – marks the beginning of the head section; All the basic parameters of the page are located in the head area. most of these are off-screen; they just define what’s going on under the hood
  • – defines what charset is used to write the document; no need to spend too much time on it; just use this declaration as is
  • Hello, world! – the title of the page; that’s what people see in their browser’s title bar, e.g. e.g.:
  • – marks the beginning of the body section; all the content of the page goes here; it is the body of an HTML document; Let’s emphasize this, in this section you will put all the content that should appear on the page
  • Hello world!

    – the main heading on the Page

  • My first web page.

    – a simple text paragraph

  • – the closing tag of the whole HTML document

Here is an important note. Working on an HTML file in a simple text application or a complex word processor like MS Word is not a good experience. To make things easier for yourself, install an HTML editor called Sublime Text. There are versions for Mac and PC and it’s free.

Why is it better? Among other things, it colors the syntax of an HTML file. That is, it visually distinguishes your HTML tags from text content, tag parameters, and other values. Basically everything becomes readable. This is what our simple HTML structure looks like in Sublime Text:

Sublime syntax is great when building a website with HTML and CSS

Okay, back on topic. You can take this new index.html file from you, copy it to your web server’s root directory, and then view this page by navigating to it from a web browser. Don’t get too excited though; this page will be pretty ugly (see below).

this page is ugly

Okay, so the page is ugly, how not to do it?

3. Meet CSS selectors

Just as HTML has its tags, CSS has selectors.

Selectors describe how a given element behaves in terms of appearance should. Here is an example CSS selector:

p { font-size: 18px; }

This selector specifies that all HTML

tags within the document have a font size of 18 pixels.

However, a more practical way to use CSS selectors is to not restricting all tags from a to giving a certain style a certain type, but instead creating different “classes” and assigning tags to them one by one.

For example, a class selector in CSS looks like this:

. normal-text { font-size: 18px; }

Note the period (.) in front of the class name (plain text). Now that the “plain text” class is defined, we can assign this class to the specific HTML tags that we want to resize to 18 pixels.

For example:

This text will be 18 pixels tall.

Let’s take another minute to explain all the elements of this CSS code above:

  • .normal-text – class definition; everything after the name of the class and between the opening and closing brackets {} defines how the elements assigned to this class will look like
  • font-size – an example of a CSS property
  • 18px – a value assigned to the property

There are a lot of CSS properties apart from the font size above. Here’s the full list if you’re curious.

4. Composing a CSS Stylesheet

An HTML document is very structural – each element has its place, and the order of the elements is crucial to the final layout and appearance of the webpage in question. A CSS document is much less so.

CSS documents are often referred to as style sheets. Basically, a CSS style sheet is a list of all class definitions used in the corresponding HTML document. The order of the class definitions isn’t that critical most of the time (at least for simple designs).

The way you put together a CSS style sheet is to define each class individually and then test that the result in your page design is what you wanted.

It sounds like tedious work, and it is.

But we make it easy for you and don’t force you to learn HTML and CSS design by hand. Instead of teaching you everything from scratch, we’re going to take a living organism and dissect its elements.

This is where a thing called Bootstrap comes in.

5.Download/Install Bootstrap

Bootstrap is an open source toolkit for creating a website using HTML and CSS.

In plain language: Bootstrap takes care of the basic structure of an HTML document and CSS -Style sheet for you. It provides a framework that ensures that the main body of your website is ready and optimized for further development.

Basically, with Bootstrap you can’t start from scratch and instead go straight to the fun part. This eliminates the need to work with HTML and CSS in the often tedious early stages of creating a website.

There are two routes you can take:

  • Option (a): Learn Bootstrap – go to the Bootstrap home page, download and build on the Bootstrap main package.
  • Option (b) : Take a shortcut – Get a Bootstrap starter pack with a nice looking theme and a demo website already built.

Option (a) might have There is a bit of a learning curve at first, but it’s by no means a bad way to build a website using HTML and CSS. Once you master the core Bootstrap structure, you may find it easier to create new pages and make them look exactly how you want them to. The Bootstrap documentation is a great place to start on this path.

We will choose option (b) for this guide. We do this for a number of reasons, the main being:

Starting with a ready-made structure saves a lot of effort trying to figure out the basic necessities of an HTML document. This allows you to focus on the interesting things, such as B. the layout of content and how it looks pleasing.

In short, if you learn things this way, you’ll get a better-looking result faster, which we think is what you want.

p>

6. Choose a Theme

If you’re building a website using HTML and CSS, you can use any Bootstrap template you like. They should all work similarly enough.

See also: How to write a good resume

However, for this tutorial we’ll be using one of the Start Bootstrap templates. They have a nice selection of free templates that are optimized, work flawlessly and are also very well designed.

The theme we are going to use is called Creative. The final effect we are aiming for looks something like this:

final start page after creating a website with HTML and CSS

To start the theme template, click the enabled Free Download button on the right (on this page) and save the ZIP package to your desktop.

Unzip the package and move its contents to the root directory of your local web server or web hosting account.

Now open this location via your web browser. You will see the default version of the template:

start bootstrap template

It’s already looking pretty good, but now it’s time to learn how to make it exactly how you want it using HTML and CSS.

7. Customize your website with HTML and CSS

Let’s work on the home page theme first. This will show us how to replace the graphics, text, and optimize everything in general.

We briefly talked about the head section of an HTML document above. Let’s take a closer look here.

If you open your Bootstrap site’s index.html file in Sublime Text, you’ll see a head section like this (we all have non-essential stuff from this code for clarity *):

Creative – Launch Bootstrap Theme

* Aside from the above, there was also code to load Google Fonts, Font Awesome icons, and a lightbox module for the images displayed on the page.

Most of the explanations have we already know here, but there are a few new ones:

  • First of all, everything between the brackets is an HTML comment. It doesn’t show up on the last page.
  • – it is one of Bootstrap’s own declaration tags. It defines the size of the site’s viewport.
  • – this line loads and contains the CSS stylesheet of the creative template also Bootstrap’s default stylesheet.

Let’s change that last declaration – the line that loads the CSS – to make it easier to work with later.

Change this line to :

This is just a minor difference – it will use the untruncated version of the same CSS sheet loaded. This version is just easier to modify.

Now scroll all the way down in the index.html file. Just before the closing body tag you will see the following lines:

They are responsible for loading JavaScript files that handle some of the more visual interactions of the theme. For example, clicking the About link in the top menu takes you seamlessly to the About block on the same page — one of the ways it does this is through JavaScript. We don’t need to bother to understand this code now. Let’s leave that for another time.

Let’s work on adding our own content to the site instead:

8. Add content and images

First thing to do is change the title of the page.

1. Change the title

Locate the title tag in the head section and replace the text between the tags with something of your own:

My HTML site

2. Customize the hero area

We call this block the hero area:

Hero section

It would be cool to have our own content in it. To change this block, go back to your index.html file and locate this section:


This whole block of code controls what goes in the hero section.

There are some new ones here Tags:

  • – this is a tag that defines that this entire section is the header of the page; This tag has a few brothers and sisters in the form of the

    tag and the

    tag
  • – is a generic CSS tag that indicates that what follows is a separate section is (aka division) in the HTML document; using it makes it easier to visually distinguish individual sections on the page

You’ll also notice that some of the other tags (that we already know about) look a bit more complex, with multiple CSS assigned to them -classes. For example:

The classes assigned to the

tag here are uppercase text -white font-weight-bold.

These classes were created by Bootstrap and the creative theme developer. The good news is that you too are free to use them if you’re building a website using HTML and CSS.

Honestly, you can customize any tag you add to your page’s structure by adding it assign any number of classes.

If you want to see the full list of available classes, you can open the main creative.css file, located in the css subdirectory of the creative theme.

Get an overview All these classes can seem intimidating at first, but it’s actually a lot easier than it looks.

For example, one of the classes assigned to some paragraphs in our index.html file is font- weight-light . If you jump into the creative.css file and search Ctrl+F for that class name, you’ll see that the font-weight parameter is simply set like this:

.font-weight-light { font-weight : 300; }

Changing the default texts in the index.html file is very easy. Just find the tag you want to edit and change the content between the opening and closing tags.

For example, to change the main heading, just change:

Your favorite…

To something like this:

Admire my HTML website!

You can do the same with all the paragraphs and other tags on the page.

Importantly, you can also add new paragraphs freely. For example, we can take the paragraph already on the page, make a copy of it and paste it just below the original paragraph; like this:

Bootstrap can start …

Paragraph 2

Now that we’ve taken care of the texts, let’s replace the image in the background.

p>

This is a bit more complicated as we need to go into the CSS stylesheet file and make the change there. As you can see in the HTML of the masthead section, no tag would indicate that an image would be inserted into the page in any way. This is all done through CSS.

If you look back at the entire block of code that handles the “Masthead” section, you’ll see that it’s assigned to a class called “Masthead”. This line of code handles the class assignment:

The masthead class is the one that puts an image in the background of the whole block.

Let’s open it Recreate the creative.css file and look for the masthead class:

header.masthead { padding-top: 10rem; padding-bottom: calc(10rem – 72px); Background: linear-gradient(to bottom, rgba(92, 77, 66, 0.8) 0%, rgba(92, 77, 66, 0.8) 100%), url(../img/bg-masthead.jpg” ) ; background position: center; background repeat: no repeat; background attachment: scroll; background size: cover; }

This code does all sorts of fancy things to our image (like adding an overlay, shading, etc.), but the important part is here this: url(../img/bg-masthead.jpg”). This is the line that tells where to find the background image. It is located in the img subdirectory.

To change this background image, take any image of your own, copy it to the img subdirectory, and then copy its name and paste it in place of the original bg masthead .jpg -File. In short, change this: url(../img/bg-masthead.jpg”) to this: url(../img/YOURFILE.jpg”).

3. Adjust the other blocks on the page

If you go through the index.html file, you’ll see that there are already many different sections on the page. We have a section for Navigation and About a Block, Some Services, Portfolio, Call to Action, Contact Block and Footer.

While there is different content in all of these sections, the sections are themselves are structured similarly. They all have roughly the same HTML tags – they’re just assigned different CSS classes.

The best way to customize the page to suit your needs is to go through the blocks one at a time and experiment with changes around .

Besides changing the texts, you can also move entire sections (the parts between the

tags). Granted you have to do this by hand (cutting and then pasting elements), it’s still easy.

That being said, there are two fairly basic modifications we’ve made. not talked about it yet. Let’s cover those next:

9. Fine tuning colors and fonts

Changing colors or fonts is very easy in HTML and CSS. The easiest way is to apply inline styling to an HTML tag. For example:

Red text

In HTML, colors are represented by their hex values; “#FF0000” is red. Here is a table of all other default colors.

Colors are better assigned via the CSS style sheet. For example, to achieve the same effect as the code above, we could add this to our CSS stylesheet:

p.red { color: #FF0000; }

And then use the following HTML code in the main document:

Red text

This second method is basically the same as in Bootstrap .

To change the color of text on the page, first find the tag that is responsible for styling this text, and then go to the style sheet and change the appropriate class or create a new class .

Here is an example; Suppose you want to change the color of the header that says “At your service”. It’s currently black, and this is the code that handles it:

At your service

To change its color, the best way is For example, a new class to create is called .text-orange and sets the color value there as follows:

.text-orange { color: #f4623a !important; }

* The !important ensures that this color setting will override any other previous color setting.

Now we can go back to our header and change its code to:

At your service

With these changes, the header is now orange:

orange h2

See also: 39 Ways to Increase Traffic to Your Website

To change the font and its size, you can do something very similar. But first, an example of what a font definition block looks like in CSS:

.SOMECLASS { font-family: “Merriweather”, Roboto, sans-serif; Font size: 18px; }

  • load the fonts Merriweather, Roboto and a system default sans serif font (read this to learn more about web safe fonts)
  • set the font size to 18 pixels

This type of definition can be placed in any CSS class, just like the color definition.In fact, font and color definitions are often found in the same class declarations.

Coming back to our previous example, to change the font size for the “At your service” heading, we could first create a class like this:

.text-xxl { font-size: 50px; }

And then assign this class to the header:

At your service

When changing colors or fonts When using your Bootstrap-built template, first look in the CSS style sheet for classes that may already provide you with alternative sizes or colors. Use where available.

10. Create Additional Pages

Now that you’ve customized the home page, it’s time to work on some additional pages and then associate them with the home page.

When creating a website using HTML and CSS , you can create as many subpages as you want and then link them all together.

Here are some of the common pages that most websites need:

  • About page
  • Contact
  • Portfolio
  • Products/Services
  • Team
  • Policies (Privacy Policy, Terms of Use, etc.)

1. Start with the layout

When you create a new website, the first thing you have to decide is what the layout should look like.

If you create a website with HTML and CSS, nothing prevents you to create the layout you want. The only difficulty is actually putting it together.

HTML and CSS can be tricky to work with when you’re starting from a blank screen, so we’ll use Bootstrap here too. First, we’ll show you some principles for creating a layout, and then demonstrate how to do it with Bootstrap.

You can think of the layout of your web page as looking at it as a sequence of individual blocks – one above the other. Something like this (note the four different blocks):

 the layout when building a website with HTML and CSS

What’s great about Bootstrap is that it takes care of the basic layout principles and appearance details for you, so you can just focus on fitting those blocks into the right ones Make.

In this section of the guide, we’ll create a new “About” page.

First, we’ll just create a very simple project of the layout. Something like the above.

  • There is a navigation menu at the top,
  • a full-width header block below the menu,
  • the main menu content section in the Center, boxed in the middle of the screen (not full width),
  • and a footer.

Now let’s create this layout in HTML.

2. Creating a New Page

The easiest way to start working on a new page is to duplicate an existing page and use it as a template. That’s what we’re going to do.

Make a copy of the “index.html” file and rename it to “about.html”.

Just for the pages at this early stage easier to tell apart Edit the new about.html file and change the content of the tag. For example <title>About Me.

Now let’s go through the file line by line, deciding what to leave and what to remove:

  • That Navigation menu (below ). You probably want to keep this section intact just to make navigation consistent across pages.
  • The Main Hero section (below ). We will not need these according to our layout project. You can go ahead and delete the entire section.
  • The about section (under ). We will reuse this section as our main heading block.
  • The Services section, Portfolio section, Call to Action strong>- Section and Contact section (everything between and ). We don’t need these sections at all. You can go ahead and delete them.
  • The Footer section and everything below it (below ). We need to keep that.

This makes our current code quite simple. It’s basically just this:

What we’re missing here is the main content area. To create it we will reuse the About section.

Go ahead and make a copy of the About section. This one:


Now change the first two lines as follows:

Since we need the

header there and the


element we don’t, let’s just remove them. The only thing left in this whole block is a paragraph of text. Something like this:

A paragraph of text.

If you save the file and navigate to it via your browser, you’ll see that you basically have two very similar blocks one below the other, with the same colored background:

about page head

It would be better to have a white background in the main content area. To change it, all we have to do is remove the bg-primary class from the main

tag. In other words, make the tag:

This is better:

about page head 2

Let’s add some dummies to the page -Added paragraphs to fill it out a bit more, plus maybe a subtitle:

Lorem ipsum dolor sit amet, consectetur adipiscing elit…

Proin fermentum, felis tempor pharetra lobortis, magna quam hendrerit dolor…

Subhead

Lorem ipsum dolor sit amet, consectetur adipiscing elit…

This is what it looks like on the page:

about ver 1

If you don’t want the text to be zen simply remove the text t-center class from one of the

tags.

about ver 2

If you want to add some flair to these blocks of text, you can (as before) create new CSS classes create and assign them to paragraphs in the block. Or you can take a look at the current style sheet and see what classes already exist for this purpose. Here are the ones we assigned to the

and

tags:

Lorem ipsum dolor sit amet…

Proin fermentum, felis tempor pharetra lobortis, magna quam hendrerit dolor…

Subhead

And here is the effect:

about ver 3

Another thing we’re going to do here is add an image somewhere on the page.

This is what a sample image tag looks like in HTML:

Pretty simple, right? The only parameter there is the path to the image file. To keep things clutter free, you can put your image back into the img directory (just like you did with that background a while ago). In such a case, the image tag is:

The image tag is quite limited in this particular configuration. To refine it a bit, let’s assign it some bootstrap classes. In particular:

These two classes give your image rounded corners and also ensure that the size of the image does not change the size of the block it’s in.

You can now add a tag like this anywhere in the main content area of ​​your about page. For example here:

Lorem ipsum dolor sit amet…

Proin fermentum, felis tempor pharetra lobortis, magna quam hendrerit dolor…

Subtitles

And here is the final effect on the page:

about version 4

Here is our about page in all its glory:

about page complete

3. Link to New Page

Now that the new page is ready, let’s link it from the home page (the index.html file).Of course, it is best to paste this link in the navigation menu (under ).

Look for this line in particular:

About

We will change it to:

About

We haven’t talked about that yet, but the tag is a link tag in HTML. With it, you can link to any web page by providing the address of that page in the href parameter. The text of the link—the clickable part of the link—is the text between the opening and closing tags.

If you refresh the home page now, you’ll see your new link, the links to the About page.

For More Reading

At this point you have basically created a simple website that consists of two pages – a home page and an about page .

What you should do now is flush and iterate by creating new pages, optimizing them, adding content to them, and then linking everything from the navigation menu.

Other things that are worth doing as you go through these steps is to continue learning HTML and CSS principles, going through the checklist, and learning about Bootstrap and its structures and classes. Some resources for this:

  • HTML5 Cheat Sheet
  • CSS Cheat Sheet
  • Javascript Cheat Sheet
  • Bootstrap Tutorial
  • Bootstrap Cheat Sheet

Mastering Bootstrap, most likely the best way currently available to create optimized and beautiful websites using HTML and CSS.

If you what do you have? If you have any questions about creating a website with HTML and CSS, don’t hesitate to ask them in the comments.

See also: Step 1: Get Started

.

See also  How to Create a New Gmail Account

Related Articles

Leave a Reply

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

Back to top button