Monday, 20 June 2011

HTML: Tables

Okay, so, for formatting a page, getting it to look how you want, you'll probably need to use tables. Simple!
The <table> tag starts us off, and this has a bunch of attributes you can apply to it, such as:

align                        (center, left, right)
background             (for a file)
bgcolor                   (for a flat background color)
border                    (thickness)
cellpadding             (this is to leave room between the edges of the cell and it's contents)
cellspacing              (this one is to leave room between separate cells)

Once you have your table, you'll want to put rows and columns in, presumably. To put in a new row, use the <tr> tag, while adding columns to the row is accomplished using the <td> tag.

To have a td cell span multiple columns or rows, use the attribute colspan="#" or rowspan="#"

Play around with some stuff and get comfortable, below is an example.

<table cellspacing="1" cellpadding="1" border="1" bordercolor="red">

<td>      This is the contents of the first cell!        </td>
<td colspan="2">   ...and this is the second, spanning 2 columns. </td>
<td rowspan="2">   Getting messy with 2 rows   </td>

<td> Stuff!           </td>
<td> More stuff!   </td>
<td>  Last cell!     </td>


turns out like this:

This is the contents of the first cell! ...and this is the second, spanning 2 columns. Getting messy with 2 rows
Stuff! More stuff! Last cell!

Thursday, 16 June 2011

Just so it's clear, I know my writing style kind of sucks, so feel free to ask for any clarification in the comments etc, and I'll try to answer them all.

Monday, 13 June 2011

HTML: Tags

HTML stands for HyperText Markup Language, and it's primarily used for building websites. It's composed of tags and attributes.

A tag is noted by being inside angle brackets, such as <a> or </p>, most of these need to be opened and closed around what they're affecting. For instance, if I wanted to started a paragraph that simply contained "This is a paragraph", I would type:

<p> This is a paragraph </p>

which shows up as:

This is a paragraph

Simple, right? Some tags don't need ending tags coupled with the starting one, such as the break tag, <br>, which simply inputs a new line, so a beginning and end doesn't make sense.

To start an html document, you can simply use notepad, but make sure your document starts with <html> and ends with </html>, and is saved as a .html so you can run it in a browser. Try playing around with your own page, testing various tags on text, here's what I was playing around with.

bold:    <b>
italics:    <i>
underline:    <u>
strikethrough <strike>

Don't forget to end your tags. Next up is attributes. These are parts of a tag, to give substance to the tag itself. For instance, there's the <font> tag, which is pretty boring on it's own. But you can add an attribute for size and color to it,

<font color="red" size="+1"></font>

Note that the attributes do not affect the closing tag. The +1 in the size tag just means 1 size up from the default, and for specific shades of red, or some other color, you can replace "red" with the 6 digit hexadecimal (base 16) value, starting with #.

For example,


The numbers denote values above 9, going to a maximum of F, with each set of 2 characters referring to the color values Red, Green, Blue.

So, have fun playing with this stuff, and I'll see you next time.

Monday, 6 June 2011

In the beginning...

So I decided I'd learn how to code, good for me.
Luckily for you guys, I'm here to let you take part in my journey.
I'll be starting with some html, then moving on to either Java or Python.
If all goes well, starting next week, I'll have new posts every Monday, so keep a look out.