Introduction: Web Designing Basics (HTML and CSS)

About: An aspiring artist. Visit me at https://www.instagram.com/erilyth_art/
I am learning HTML and CSS and am soon going to get certified in it as well, and I thought that it would be a good idea to give out a tutorial on how to start designing your own website using HTML and a little bit of CSS...

HTML is an abbreviation for Hyper Text Markup Language.
CSS is an abbreviation for Cascading Style Sheets.

HTML is actually used to create the webpage and the content that it has, like the images and writing.
CSS is used to design the webpage and tell the writing and images to be in a certain place, like an image on the top of the page, another in the center etc...

"Anything on the internet can be modified, deleted or added just with the use of HTML and CSS! Even on instructables.com!"


The best thing is...

All you need is a computer!

So lets get started on our journey into web designing...





Step 1: What Is a Website Made Of?

If you are surfing the web and find any website interesting and cool, and want to find out what and how it was made, or to find out what HTML coding they used, then all you need to do is,

  • Right click on any blank area on the webpage.

  • Click view page source

  • This will open up a new window or a tab according to your settings showing the HTML code that the website runs on.


NOTE : Some websites like instructables, google, youtube etc use a lot of Javascript in their coding, so don't get scared...after reading this instructable, you will be easily able to understand what HTML and CSS are and the fundamental tags.

Step 2: HTML, What Is It?

HTML as I said before is

Hyper Text Markup Language...


Everything in HTML works by the use of 'Tags' , Tags are elements in an HTML document that give commands to the writing or images or audio or video files what to do, where to be placed etc in a website...

In HTML, tags always have "<" before and ">" after the tag...
ex-<b> (This tag makes the text bold)

All HTML documents start and end with 

<HTML>
</HTML>


These tags tell the browsers that this file is a webpage and not just an ordinary text file...

Step 3: What Do You Need?

To start making webpages, all you need is :

A word editor...like notepad.

Many people making websites out there use programs like 'Dreanweaver' and 'Microsoft Frontpage' as they make it easier to make websites and help in the coding.

But the best way to learn HTML is to use the basics...Notepad and then once you have learnt the basics, then you can move on to the editing programs...


Step 4: Basic Structure of an HTML Document

All HTML documents have a "Head" and a "Body" tag...

So all HTML documents have a structure similar to this...

<HTML>(Starting the html document)
<HEAD>(Starting the head tag)
</HEAD>(Ending the head tag) 
<BODY>(Starting the body tag)
</BODY>(Ending the body tag)
</HTML>(Ending the html document)

NOTE : HTML tags are not case sensitive, this means that it does not matter if you write them with capitals or small letters...

Every HTML tag, has an opening and a closing tag, and any content between those tags, gives that content the property the tag commands...ex: <b>...</b> (This is to bold the text)
Some HTML tags have the opening and closing tag in the same tag...ex: <br /> (This is to break line) 

Whatever is in the body tags, is directly shown on the webpage, and whatever there is in the head tags, they define and give information about the webpage that is not seen when you view the page on a web browser.

Step 5: HTML Heading Tags

In HTML there are 6 sets of tags used for headings...
These tags all go in the body tags...

<h1>This is the largest heading</h1>
<h2></h2>
<h3></h3>
<h4></h4>
<h5></h5>
<h6>
This is the smallest heading</h6>

NOTE:Most people make a mistake on using these tags to make the text bigger or smaller, and that should not be done, as search engines define the page by these headings to find out which parts of the page is what...and just using it for font size would not give a good definition for the page by the search engines...

Step 6: Text Elements (Tags) in HTML

In HTML, there are about 5 tags which define text in the webpage.
These tags go in the body section of the HTML document.

<p>Everything in here will be set out as a new paragraph</p>
<br />
This adds a line break (Its like pressing "Enter" on the keyboard while typing)
<hr />This adds a line wherever placed in the document (Horizontal Rule)
<pre>Everything in here will be shown just as it is typed...all spaces and "Enters" when we type will be shown on the webpage</pre>


The most common tags out of these are the <p></p> and <br /> tags as they are used in almost any and every webpage...
The pre tag is great if you are lazy and just want the spaces and enters to be as you will instead of adding the other text elements, but then it will be hard again for browsers and search engines to analyze your page...

Step 7: Logical Styles for Text in HTML

These elements go in the body tags again as they define text that is shown on the webpage...
There are 3 main logical styles for text in HTML....

<em>Text in here is emphasized</em>
<strong>
Text in here is strong</strong>
<code>
Computer code is put in here</code>


The emphasis tag just makes the text italic, but a little more bent than normal italic font...
The strong tag makes the text bold, but also makes it a little more closer, as the letter spacing is reduced.
The code tag defines computer code that is needed to show on the webpage, it has a different font and the spacing and size of the font are small...

Step 8: Physical Styles for Text in HTML

There are only 2 common physical styles used for text these days in HTML....
These tags are also inserted into the body part of the document.

<b>This text is bold</b>
<i>
This text is italic</i>


These tags are very very common as everyone used them even in text editing programs like microsoft word...
The bold tag make the text more thick and wider and a little longer...
The italic tag makes the text bent a little to the right.

Step 9: Adding Images in HTML

This is one of the simplest things to do in HTML...
This tag is inserted in the body section of the document as well...

<img src="xxxxxxx.jpg"> 

The above tag adds an image to your page...and if you want to align it then all you need to do is add :

align="right"
align="letf"
align="center"


Add either one of those right after you close the quotes and before the greater than sign

Note: The image you are adding should be in the same folder that your HTML document is saved in, or else you need to specify the file path to the image...

Step 10: Lists in HTML

In HTML, there are 2 types of lists:
1) Bulleted or unordered
2) Numbered or ordered

These again go in the body part of the document.

Each item in the list is specified with the <li>List Item</li> tag.

<ol>
<li>
First list item</li>
<li>
Second list item</li>
<li>
Third list item</li>
</ol>

<ul>
<li>
First list item</li>
<li>
Second list item</li>
<li>
Third list item</li>
</ul>


The first one is an ordered list which shows the list with numbers from 1,2,3 and so on...
The second one is an unordered list which shows the list with bullet points...

Step 11: Links in HTML

In HTML, there are 3 main types of links,
1) Ordinary link, to link to a different online website or to link to another webpage on your computer.
2) Images link, to use an image itself as a clickable link.
3) Mailto link, to make a link that opens up an email client.

These tags also go into the body tag of the document

An ordinary link :
<a href="http://www.google.com">Jump to Google</a>

An image link :
<a href="http://www.google.com><img src="image file name or url of image"></a>

A mailto link :
<a href="mailto:email address">Send email</a>

<a> defines an anchor, it is used in all links and inline links as it makes an anchor wherever it is inserted in the code.
The property "href" in the <a> tag tells the anchor to link to which website or another anchor itself in some cases...

Step 12: Anchor Linking in HTML

Have you seen those cool websites which have an index linking to different parts of their page? like Wikipedia?

http://en.wikipedia.org/wiki/HTML (Look at the contents part)

To make those, we use the anchor tags and link 2 anchor tags together,
These tags are also used in the body part of the document...

<a name="Step 5">Step 5</a>
<a href="#
Step 5">Jump to step 5</a>


The first tag tells that the text Step 5 is anchored to the document with the name of "Step 5"
The second tag is the link tag which makes the text "Jump to step 5" a link that links to the Step 5 anchor we made before...

Using this tag is an absolute necessary for websites which state lots of information like Wikipedia :)

Step 13: Tables in HTML

Tables are main parts if your website is based on stats and details....the tables sort of look like Microsoft Excel tables but you can make them look more interesting by editing them in CSS which we will cover later in this instructable...

Tables consist of 3 things...or more like 3 tags...

<table></table> 
<tr><tr>
<td><td>

All these tags go into the body section of the document as well...

The table tags tell the document where the table starts and ends
The tr tags add a row to the table (Table Row)
The td tags add cells to the table (Table Description)

Have a look at the images to get a better understanding at how tables work...as tables are one of the hardest parts in HTML...

Step 14: Frames and IFrames in HTML

Frames and IFrames are the same thing, as they are used to show a webpage in a box like thing inside another webpage....

IFrame is used when you only have one webpage you want to show on your webpage in a little box...

<iframe src="http://www.google.com"></iframe>
This will show www.google.com in a small frame in your website...

<frameset>
<frame src="
http://www.google.com"></frame>
<frame src="
https://www.facebook.com"></frame>
</frameset>


Frames always are inside a <frameset> and </frameset> tags as these tags group the frames...<frame></frame> do the exact same thing as <iframe></iframe> but they are used when you have more than 1 frame (webpage) you want to show and are grouped by <frameset> tags...How many ever frames you insert, those are shown in the same browser window and they are split equally...

When using frames, you cannot use the <body></body> tags so all you can do is display more than 1 webpage in a browser window...Adding the <body></body> tags will stop the <frame> tags from working

An easy way to remember which is which, iframe is for single frames as "I Frame" sounds like "Independent Frame"
These tags are not very common in most of the websites..but some websites still do use these tags...

Step 15: HTML Common Entities

In HTML, if you want to insert text like < or > © etc then you often use HTML entities to show the symbols so that they do not get mixed up with tags in the document.

All the entities start with an & sign...

&lt = < (Less than symbol)
&gt = > (Greater than symbol)
&#169 = © (Copyright symbol)
&nbsp =  (Non-Breakable Space) (HTML deletes any extra spaces you add in your writing, so in a <p> tag if you have 10 spaces, only 1 space will be seen as the rest are deleted...if you want all of those to be seen then you add the &nbsp entity to your <p> tag and that will add 1 permanent space to your <p> tag...

There are 2 ways you can write an entity, one is with the character code like the first 2 examples, and the other way is with the number code, like the third example...(Number entities have "#" before them)

These entities are essential if you want your HTML document to display everything as you want and not mix up < or > etc with the tags...

Step 16: Quote and Blockquote Tags

These two tags are used to show quotations...

The <q>Quotation</q> tag is used to show short quotations.
The <blockquote>Quotation</blockquote> tag is used to show long quotations

The <q> tag adds quotes before and after its content ( "Content" )
The <blockquote>Quotation</blockquote> tag separates the text from the surrounding by making it into a block and indent it a little, like we do it in essays to block long quotations in a different paragraph

THIS TEXT HAS BEEN BLOCK-QUOTED (This is a block-quote)

The <blockquote> tag is quite useful as it indents the content, but the <q> tag is not that useful as we could just add quotes ourselves but it makes the text more organized...

Step 17: Title the Webpage in HTML

For a change, this tag is added in the <head> section of the document, this tag tells what the title of your document is, that is what will appear on the tab or page title of your webpage....have a look at the images to get a better understanding.

<head>
<title>
THIS IS THE TITLE OF THE PAGE!</title>
</head>


This is not an optional element of a webpage, every single webpage has to have a title or else the file name will be shown as the tile...

Step 18: Meta Tags in HTML

This is another head element...
It gives description of what your site is to the internet.

<meta name="description" content="What does the website give, do, show etc" />
<meta name="
keywords" content="Keywords that describe your webpage" />


The first tag is a description meta tag and the content describes your website...
The second tag is a keyword meta tag and the content gives keywords about your website...

There are other meta tags out there used for different things like "meta author" etc but these are the most common ones...

NOTE: Search engines and website ranking softwares look for the meta tag to understand what the website is about and what cateogary does it belong to...

Step 19: CSS, What Is It?

CSS as I said before stands for Cascading Style Sheets
These styles that we apply decide how to show and place the HTML elements.

There are 3 ways we can apply styles to our HTML document :
1) External style sheet
2) Internal style sheet
3) Inline styles


CSS was introduced because HTML was created only to note the information down with tags like <p> <br /> etc...
CSS was supposed to give HTML all the styles it needed...

Commands in CSS are called "rules" like "tags" in HTML documents...


Step 20: Syntax in CSS

Every CSS rule has 2 parts in it,

1) Selector (Each rule can only have 1 selector) 
2) Declaration
(Each rule can have more than 1 declaration)

Selector is the actual HTML tag that you want to style and edit, so if you want to change the look of a <h1> tag, then

Selector = h1
Declaration = color:purple   font-weight:bold

(These declarations are used if you want to make anything contained in the <h1> tag to be in purple color and be seen in bold)

In declarations, the first part is the property, "CSS property" (color, font-weight) and the second part is the "value" (purple, bold)

Step 21: Adding Comments in CSS

If your CSS file contains lots of rules, then to make which rule is for what clearer, you can use comments to write in anything you want and it will not be shown or interrupt the CSS rules...

/*comment*/

This is how a comment is added in CSS, much simpler than HTML ( <!--comment--> )

You can type in what some rules do if you are not sure, then you can look it up online, and then add a comment saying what that specific rule does...

Step 22: CSS ID and CLASS Rules

Lets say you want to make a box on the right of your page where you can insert text...then you would need to make your own tag and define it via CSS in order for it to do so....

We use ID and CLASS selectors to get the job done for us...

We use them like this :

HTML file

<div id="MYFIRSTDIVID">
<p>
This content goes into the box on the right hand side of the page </p>
</div>


CSS file

#MYFIRSTDIVID
{
float:right;
height:100px;
width:100px;
border: 2px solid black;
}


To style div id's that you make, you <span style= “background-color: #FFFF00″>use the "#" sign</span> in the CSS file...
To style div classes that you make, you <span style= “background-color: #FFFF00″>use a "." (period)</span> in the CSS file

IDs are used when you are making it like a whole different tag like in the example above, but CLASSES are used when you want to style things inside another tag, like

HTML File

<p> This <div class="MYFIRSTDIVCLASS"> text </div> is styled by div class...</p>

CSS file

.MYFIRSTDIVCLASS
{
font-style:italic;
font-weight:bold;
font-color:yellow;
}


So classes are used when you have the specific div class inside another HTML tag (Excluding HTML, Body and Head tags)
Pre-defined elements like (h2, p, h1, br, em, i, b etc...) are edited using the div class function because they are repeated a lot of times in the document, and therefore it has to be a class div...
Div IDs are used when you are going to use the styles element only once in the HTML document...

Step 23: 3 Types of Style Sheets...

If you are using an external style sheet for CSS, then you will need to link the style sheet to the HTML document in the head tag using 

<head>
<link rel="stylesheet" type="text/css" href="
mystyle.css" />
</head>


The "href" attribute should have the file name of your CSS file....and all external CSS files must end with the filetype ".css" 
CSS files should not contain any HTML tags like <h1> <h2> <p> etc...

If you are using an internal style sheet, then you write the following in the head tags :

<head>
<style type="text/css">

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</style>
</head>


The xxxxxxxx should have everything that your external style sheet had in it...so it should have all the rules in it...

If you are using an inline style then you will need to do the following :

If you want to style the <h1> tag with an inline style,
Then you need to add an attribute "style" and all your rules go in there...

<h1 style="color:pink;margin-left:20px">This is a heading.</h1>

NOTE : Inline styles should be used as least as possible because CSS was created so that there is no styling in the HTML document, so if there are inline styles everywhere in your document, then its a waste as your HTML document has styling in it...

Step 24: CSS Text Styles

There are a couple of text styles that you can allocate for texts in any tags...

Color of text :

ex: 
p {color:black;)
p {color:#000000;)


The above examples will make all text in the paragraph tags appear in black color.

Text decoration :

ex:
p {text-decoration:none;}
p {text-decoration:underline;)


The first example will remove underlines, over-lines etc and makes the text appear normally...this is useful if you do not want links to have an underline...
The second example adds an underline to any text in the <p>This text is underlined</p> tags.

Text indentation :

ex:
p {text-indent:30px;)

This will indent the first line of the <p> tag by 30 px...

Text Transformation :

ex:
p {text-transform:uppercase;)

This will make all the text in <p>This text is in uppercase</p> tags uppercase.

Step 25: Font Styles in CSS

If you want to change the font of text in a tag, then you use the font-family selector...

ex:

p {font-family:Arial;}
p {font-family:Verdana;}


In the first example, all text in the <p></p> tags will be in Arial...
In the second example, all text in the <p></p> tags will be in Verdana...

Style of font :

ex:

p {font-style:italic;}
p {font-style:oblique;}


In the first example, the text in the <p></p> tags will be in italics...
In the second example, the text in the <p></p> tags will be in oblique (oblique font is very similar to italic font)

Font size :

ex:

p {font-size:16px;}
p {font-size:1em;}


In the first and second example, the size of font in the <p></p> tags is 16px...

1em = 16px
"em" was introduced because of a re-sizing problem with Internet Explorer.


Step 26: CSS Background Styling

Your background can either have an image or just a color as a background...

Give your background a color :

ex:

body {background-color:#000000;}
body {background-color:black;}


Both of the examples give your background a black color

Set an image as the background :

ex:

body {background-image:url(animals.jpg);}

The example above will set the "animals.jpg" image as the background and repeat it as many times as needed to fit the background...


Step 27: Review, Summary and Finishing Up

I will attach 2 notepad files which have summaries of CSS and HTML, I searched and collected all the information and edited it to make a good summary...

In this instructable, I covered topic of HTML 4.01 and not HTML 5.0 because it is still under development and a lot of the tags are still being changed, removed etc...so I decided to teach you the more stable HTML 4.01
I covered CSS 3.0 as it is the latest version and is quite stable...

If you have any questions, then post them in the comments, I will be happy to clarify your doubts...
If  you are actually going to make a website, then once you do make it, post a comment with the code :) I would like to see what sorts of cool websites you make!

I learnt HTML from acouple of websites and in school...

http://htmldog.com/
http://www.littlewebhut.com/
http://www.w3.org/
http://www.htmlgoodies.com/
 

W3C is the World Wide Web Consortium, they set all the web standards for HTML and all the tags and their values
w3.org is their website as mentioned above

What Next?

  • Now that you know the basics of HTML and CSS, you can research online for more advanced tutorials (YouTube has some very good tutorials).Once you think you have mastered these languages, you can go ahead and apply for a certification...and then once you are certified, you can make your own websites and make yourself a living...if you become a website designer....lets call it "webmaster"...
  • Start learning Javascript or another scripting language to make your website more interactive
  • Start learning AJAX, PHP etc...to start collecting information from users, like logins etc...
  • Go for the more hard and advanced C, C++, Java or other powerful programming languages to become a program desginer and not just a web designer.