How Webpages are Put Together
There are several technologies that can be involved in creating
websites, but there are three major languages that stand out, as you will almost
always need to work with them when creating websites; these languages are HTML,
CSS, and JavaScript. HTML (Hypertext Markup Language) is the language that
describes how a web page is structured and is also what ties everything together.
CSS (Cascading Style Sheets) is the language that is used to design and style the
HTML files (web documents) and is crucial to making your website look visually
appealing. Finally, JavaScript is a front-end programming language that can be used
for adding functionality and features to your website. All three of these languages
have separate tasks but need to be connected together in order to have a
functioning web page. Although, it can be quite confusing for beginners to understand
how this is done, so we’ll be clarifying that here.
The HTML file can be thought as the center of your web page that
holds is all together; in fact, you can even write all your CSS and JavaScript
code inside of a single HTML file. However, I would highly recommend making
separate files for your CSS and JavaScript for the sake of organization. In the
same way that Microsoft Word documents end with the .docx extension, HTML, CSS,
and JavaScript files also have extensions of .html, .css, and .js,
respectively. Here is the file structure
that we will be using (all of our files are in the same folder):
An HTML document is made up of two main parts: the head and
the body. The head is where you put meta tags, which describes information about
the website itself (i.e., the character set that it uses such as UTF-8 or ASCII).
The body contains all of the content of the HTML document. The head is where we
link our CSS to our HTML document. We can do so by writing a link tag like
this:
<link rel="stylesheet" href="styles.css" />
The rel attribute specifies the relationship between the current HTML documents and the linked document and the href attribute specifies the location of the linked file. To link the JavaScript file to our HTML document, we can add a script tag either in the head or body; however, it is more conventionally put it in the body. Here is the tag will look like:
<script src="script.js"></script>
Note that you can link as many CSS and JavaScript files as
you want in a single HTML file. This web page does not actually do anything because
it has no content on it, but it should serve as good demonstration and starting
point to creating web pages.
Thanks for reading!

Comments
Post a Comment