Thursday, 24 March 2011

Letting go of bad habits

So I've been reading up on the difference between HTML and XHTML, and found this lovely article that gave some clear guidelines to follow:

The good news is... I am and always have been a very anal writer of HTML. I made sure every line, every tag was alined to the perfection I demanded, and would rummage through searching for any bits of code that even though they worked, weren't "correct" according to my coding standards.

The bad news? I was learning this all through HTML, and the habits I had imposed on myself - and now, I need to learn how to change those habits into XHTML habits!

For example: According to the article - "Tags and Attributes must be written in the lower case".
Easy enough, and sure, I always made sure all my code was in the lower case... except for some reason, I always felt that the <BR> tag, HAD to be in upper case... this is wrong. It is not XHTML standards. There is no reason for the <br> tag to be in upper case, and I will need to stop myself from doing so.

Another example, which also affects the <br> tag, as well as <img> tags and others, is that - "Empty elements must be terminated". Now this one is definitely news to me, and now I know why the automatic codes generated in online forms put the little "/" at the end of the <img> tags and <br> tags. I actually used to go through pages of code removing them because I thought they were useless extras!

Of course, some of my previous habits were good ones, and in line with XHTML standards, such as nesting my elements in the right order, and quoting all my attribute values.

Whatever the case, I'm glad now to have a proper standard to adhere to, and hopefully, I will be able to change my bad anal habits into good ones in accordance with XHTML standards! :)

Wednesday, 9 March 2011

The power of CSS

In DMT class this week, I was amazed to find out what css could actually do, especially when shown the wonderful CSS Zen Garden site that beautifully captures its "powers".

It wasn't that I hadn't heard of or used css before, but I had always thought of it as just something that could set the basic visual elements of a page, such as overall background colour, or the font of the text on the page unless stated otherwise in the html. I also knew that css was able to layout a page, but had no idea how that could possibly work.

With learning about XHTML, a new concept of web design was introduced to me, that being the ability to separate content into the html coding, and layout into pure css. The css can be used to control separate elements on a page through tagging it with an id that will have a corresponding css command setting its style. This means that every element can essentially be styled, positioned and visually refined through css.

I'm very excited about this idea, and very much look forward to actually being able to create pure css defined layouts on a website. For now, I feel I have a lot to learn on how to use css beyond the basic full page elements. In an attempt to find out more, I came across http://www.w3schools.com/css/default.asp, which seems to be a useful tutorial on starting and learning css (it also has tutorials on javascript, xhtml and html5, which should come in handy through-out this semester of learning also!).

So second week, and I'm already able to answer questions I've been asking for the past seven years or so! Things are going well!