# systemctl start httpd
In Ubuntu:
# service httpd start
Once done, visit http://localhost/. It should be ready to go. If you followed A Patchy Apache, it should read:
If you didn't, it should display some boring filesystem. If you want it to disply our fancy "Hello World!," just edit your /srv/http/index.html to read:
<html>
<title>Welcome</title>
<body>
<h2>Hello World!</h2>
</body>
</html>
To show some variation to the language, you could imagine changing the "Hello World" example to read "Welcome to KeroCG.com!" in the title and "Today we are learning about HTML. Care to join us?" in the subtext by using the following alterations:
<html> <title>KeroCG.com</title> <body> <h1>Welcome to KeroCG.com!</h1> Today we are learning about HTML. Care to join us? </body> </html>
If you copy this to your /srv/http/index.html, your http://localhost/, should look like this:
<html>
<title>KeroCG.com</title>
<body>
<h1>Welcome to KeroCG.com!</h1>
Today we are learning about HTML. Care to join us?
<p><i>italics</i>
<p><b>bold</b>
<p><u>underlined</u>
<p><font color = "blue">Blue</font>
<p><font face = "courier">Courier</font>
<p><a href="kerocg.blogspot.com">The best place to learn to code</a>
</body>
</html>
This will change your http://localhost/ to read:
And we are well on our way to working with some real html code. Imagine you wish to change the background, this can be done by adding the following tag of code: <background="backgroundimage"> for example, if you wanted to make this image (full credit to ringosdiamond from deviantart.com) your background, you would save it in your /srv/http/ directory and add the following line to your code: <background="Wallpaper____TARDIS_by_ringosdiamond.png"> after your body tag. You can manipulate this background by adding in a few variables, such as "bgcolor=color" or "bgproperties="fixed."" remember that your chosen color can be a hexadecimal code.
Now, we will probably come back to HTML later (after working a little with web.py), but for now, we will just work a little on tables and framesets. Firstly, tables. Tables in HTML use the <table> tag. They also use the <tr> and <td> for manipulating table rows and table data respectively. For example, if you wanted to create a simple table with 2 colums and 3 rows (along with the aforementioned background image), you could add the following lines to your code:
<html>
<title>KeroCG.com</title>
<body background="Wallpaper____TARDIS_by_ringosdiamond.png">
<h1>Welcome to KeroCG.com!</h1>
Today we are learning about HTML. Care to join us?
<p><i>italics</i>
<p><b>bold</b>
<p><u>underlined</u>
<p><font color = "blue">Blue</font>
<p><font face = "courier">Courier</font>
<p><a href="kerocg.blogspot.com">The best place to learn to code</a>
<p><table border="1">
<tr>
<td>cell1</td>
<td>cell2</td>
</tr>
<tr>
<td>cell3</td>
<td>cell4</td>
</tr>
<tr>
<td>cell5</td>
<td>cell6</td>
</body>
</html>
Which provides:
Now, let's say you want to have two (or more) partitions to your site, to allow a navigation bar or something on the side with a host of links. This can be done by creating frames, which are like tables, except they take up the whole screen. We could split the screen directly down the middle and add content to both dies individually by adding this to our code:
<frameset cols="50%,50%">
<frame>
<frame>
</frameset>
You can manipulate the contents of the frames by linking in other sites. Be sure these sites are saved to the appropriate directory. To do this with http://localhost/, use the cp command to copy your current index to another file, say index2.html.
# cp index.html index2.html
And then save the following to index.html:
<frameset cols="50%,50%">
<frame name="index" src="index2.html">
<frame>
</frameset>
If you did so, you should see a site that looks like this:
But that's not quite aesthetically pleasing. Instead, let's create a sidebar, side.html:
<html>
<title>KeroCG.com</title>
<body bgcolor="333333">
<font color = "white">HTML</font>
</body>
</html>
And then change index.html to this:
<frameset cols="10%,90%">
<frame name="index" src="index2.html">
<frame>
</frameset>
And there you have it, a simple guide to HTML. We can come back to it later if there is enough support
As always, thanks for reading, and be sure to check out Ringosdiamond at deviantart.com,
-Leios
No comments:
Post a Comment