HTML 5: Part 1 – Getting Started

Hola Amigos!

Before i work with the elephant in the room; lemme tell you HTML 5 specs aint REC ready (Candidate Recommendation – W3C stage for stamping the spec to be ready for use). If Apple dint care waiting for 802.11g spec to stabilize for use in their products…then why should we.. 😉 ..jsssst kidding

So, first of all i recommend (estoy recomiendo) you get Chrome. You can have FF or Safari as well. bt not IE guyz not IE… Just open your browser and go to ( you will kno y… 😛

1. To start with all you need is to have a proper HTML DOCTYPE tag. HTML5 docType:

“Aah! so simple…”. Yup its simple guyz…bt therez a whole lot going in the back.. i will explain them in detail in my upcoming posts..

Worried about getting chrome & all… You know…You can also use a shim file to get HTML5 up and running in your browser.

So you jst need to add this script reference into your html and then start using html5 tags…

For those of you who want CSS Reset, you can get it here:

 They work pretty decently from what i have tried… donno if it cracks…

2. From now on you write the following codes happily… 🙂

a. No need for type..language….blah blahs..default is javascript 🙂

b. No need for type here… default is css 🙂

c. < input type=”email” > — No need for self closing tags… 🙂 also. u hav internal validations for ■search■tel■url■email■datetime■date■month■week■time■datetime-local■number■range■color

d…loads more… lets not get excited…. 😛

3. HTML5 page sections:

We had to fight with div and css to design our websites… bt now.. html5 has given us some containers that you can use efficiently..chk below


You can start using these tags instead of the traditional divs. You can see the nesting done inside the <section>.

So Guyz… Lemme wind up for now b4 my manager winds me up… i will get back with the more on html5 background, serialization, specs and then we will delve into html5 demos slowly… 🙂

Post your comments and views here… & Feel free to blast me left-right-center*.. if u find any mistakes.. 😛 [*Conditions apply]

Until nxt time…

goodbye n godspeed… 🙂

Concept of cascading in CSS

Most of us know that Cascaded Style Sheet abbreviates to CSS . But why is it called so? What is the cascading happening out in the stylesheet. Well the concept is pretty simple, but powerful.

You might come across scenarios wherein, you want to override a css class of a third party add-in, but still not able to apply your styles. Well the reason is nothing but the concept of cascading coming into play. Let me get into a bit theoretical  here.

Stylesheets are divided into three types:

  1. Author StyleSheet – Stylesheet created by the author of the webpage
  2. User StyleSheet – StyleSheet are set by the user of the Web page. These allow the user to have more control over how the pages display.
  3. User Agent StyleSheet – StyleSheet defined by your browser.

The order of precedence is Author with the highest priority, User and then User Agent StyleSheet. Again, the exception would be the !important rule, wherein the StyleSheet  with selector carrying properties with !important will be given precedence over any other.

You might wonder, then a scenario can come with conflicts in using this property. Yes, such scenarios arise. In that case, the order of precedence is given to the Author Stylesheet, followed by User and then the User Agent one.

Cascade Conflict Resolution:

To resolve conflicts, Web browsers use the following sorting order to determine which style has precedence and will be used:

  • First, look for all declarations that apply to the element in question, and for the assigned mediatype.
  • Then look at what style sheet it’s coming from. As above, author style sheets come first, then user, then user agent. With !important user styles having higher precedence than author !important styles.
  • The more specific a selector is, the more precedence it will get.

For example, a style on “ p” will have a higher precedence than one just on the “p” tag.

  • Finally, sort the rules by the order they were defined. Rules that are defined later in the document tree have higher precedence than those defined earlier. And rules from an imported style sheet are considered before rules directly in the style sheet.

Hope this article was useful.

CSS shortcuts

Using shortcuts in css, makes your CSS look neat, clean and compressed. It should be always taken into account that, you cannot simply play around with shortcuts. Different browsers, behave differently to the shortcuts.

Following are some of the simple and effective shortcuts that i use in my css:

Using Zeros :You need not mention any units with zero’s, be it pt, px, em or any other measurement types.

Normal Method – #spcborder{ border:1px 0px 0px 2px;}

Shortcut Method – #spcborder{ border:1px 0 0 2px;}

Value Shortening : This is normally done with hex color codes.

Normal Method – h1{ color:#333333; border-color:#335577;}

Shortcut Method – h1{ color:#333;border-color:#357;}

One line coding : I would recommend this approach for selectors with atmost 3 properties and non lengthy.

Normal Method




font-size : 12px;


Shortcut Method – h1{ color:#333;border-color:#357; font-size : 12px;}

Property Grouping : This can be used mostly when you use the grouped properties in css, like border, background,margin, padding etc.

Normal method – div.main{padding-top:2px; padding-right:3px; padding-bottom:2px; padding-left:3px;}

Shortcut method – div.main{padding:2px 3px 2px 3px;}

Further compressing – div.main {padding:2px 3px;}

Another scenario

Normal method – div.main{padding-top:2px; padding-right:3px; padding-bottom:2px; padding-left:3px;}

Shortcut method – div.main{padding:2px 3px 2px 3px;}

Further compressing – div.main {padding:2px 3px;}

The trick here is to use:

  • TOP RIGHT BOTTOMLEFT approach on any such grouped properties, if there are 4 values grouped.
  • TOP & BOTTOMRIGHT & LEFT approach on any such grouped properties, if there are 2 values grouped.
  • In case of 3 valued groups, keep in mind the cyclic order of  TOP RIGHT BOTTOMLEFT . The one missing would take the value of the respective pair, in the grouping.

padding:2px 3px 5px; would imply a padding:2px 3px 5px 3px; The last value (left) is implicit and equals to the value of right.

These shortcuts work easily independent of any browser. It would be good if you use these css shortcuts in your stylesheet.

Relative positioning to control absolute positioned elements

Trust me! Initially I  had a big time, figuring out what’s with this positioning of relative and absolute.  Before i move into the details of this article, let me take a quick tour through the positioning css offers us.

CSS Position types:

Absolute : To position the elements absolutely or perfectly, with respect to a parent whose position can be anything other than static.

This would imply that you need some good parent who is positioned relatively or fixed or with inherited positioning. Top, right , bottom, left properties control the positioning here.

Relative : To position an element with respect to itself. Top, right , bottom, left properties control the positioning here, but they are with respect to the normal positioning of the element.

This would imply, you relatively position an element with itself. Kind of shifting the element, from its current position.

Fixed : To position an element absolutely, with respect to the browser window.

This would imply, you can position an element, with respect to your browser window. A simple scenario would be an always visible popup at the bottom right corner of your browser window.

Static : It is the default positioning property. This guy ignores any top, right, bottom, left property values.

Inherit : This guy blindly inherits the property of its own parent.

So now, let me come to the point here.

In most of the scenarios you might want to use an absolute positioned element inside a relative positioned element. Take a look at the scenario below:

Here the parent is relatively positioned. Look at the children. They are forced inside the parent, unless you give a negative value and forcefully move it out. But still, it will be under the control of the parent.

Lets see what would happen, in case you forget the relative positioning of the parent:

It might not look a big deal out here. But trust me, it can be catastrophic in various other scenarios. Here what happened was that, the children elements, skipped the parents boundary and decides to position with respect to the body of the page. So if the browser window grows, that one in the bottom left is going to stick with the browser window, not hang back inside like his well behaved brother from the first image.

Well once you get your head fixed to this concept (rim-shot), you will be able to find the application of this everywhere. Let me give you some good head start.


A “close” button you always want positioned in the upper right of a box (to replicate an operating system window).
A “home” button placed in the upper left of the window so that your users never feel too lost
A reminder on a sign up form to remind users that if they are already members to sign in above.
“Back to top” links to be placed in the lower right of each big block of text.

Another example would be an always visible popup, like the one below:

Go ahead and explore to the widest of your imaginations. Hope you enjoyed this article.

CSS Menu Stepdown Issue

Normally when floating objects you can count on them lining up vertically until they break. That is, you could if you weren’t using IE 6. IE 6 appends a line break effect after each floated block element which will cause “stepdown”.

The fix here is to make sure the line-height in the parent element is set to zero (0), or that the elements being floated are inline elements.

If you are familiar with the concepts of “floats”, you know that if you float a page element to the left, that the next page element will move up next to that element on the right, if possible. But have you ever seen your floated elements “stepdown”?

This is a fairly common problem you can run into when creating a horizontal menu. Like most menus, you create an unordered list:

<ul id=”menu“>
<li><a href=”#”>My</a></li>
<li><a href=”#”>Little</a></li>
<li><a href=”#”>Menu</a></li>

You want the menu items to be large clickable blocks, so you write CSS like this:

ul#menu li a {
display: block;
width: 130px;
text-align: center;
font-weight: bold;
float: left;
color: white;
font-size: 1.2em;
text-decoration: none;
background: #600;

Those blocks are floated the left, so they should all line up in a row, right? Nope, that’s gonna get you some stepdown action. The problem is the list elements wrapping the anchor elements. These are also block-level elements but they are not floated. This confuses things, because block elements naturally have a break after them (like an invisible <br />). That pushes the next one down whatever the current line-height is, which is what causes the stepdown.

Here is the remedy:

ul#menu li {
display: inline; /* Prevents “stepdown” */

So the possible solutions for this problem are:

  • Setting those list elements as inline will take away those breaks and make sure your menu stays nice, happy, and straight!
  • Also, the problem is disappear if make line-height:0 to li elements
  • Another option would be to float the li elements instead of the links. This will also give you a little more control over the positioning/spacing of each li.

NB: This post is  simplified version of the post from Please refer the original site for more information.

CSS and Browser Compatibility Chart

We have a lot of browsers poping up every year. Not to mention the versions they come in. At times it can prove difficult to check if the website you have designed would look good in all browser. Browser compatibility has always been a web designers nightmare. Taking into account of this, i thought it would be useful to have a look at the various selectors and declarations used in the CSS 2.1 and CSS 3.

I would suggest you stick to CSS 2.1 as of now and use the advanced selectors judiciously based on your client browsers.

Let us check the compatibility charts of CSS and the popular browsers in the market. Most of the other browsers you get to see in the net will be using one of the layout engines used by the browsers in chart. Hence i feel the chart would suffice the needs of browser compatibility factor for your site.

It would be wise to keep note of this chart before you design your CSS.