22 June 2012

CSS ? - Cascading Style Sheets, CSS3?



HTML5 Powered with CSS3 / StylingBack to 10 years ago, it never been an important knowledge for web backend developer to know how CSS work. When I was a developers years back in a company who have a designer team setup, there are a guy called “Ah Beng” who always work  out lots of design template for me. And I always work very closely with him on getting web site up with colourful and nice design.

Then people realize that getting CSS to control on the web layout using DIV tag is better, CSS become an important for backend developer to know how to get the web site display dynamic way as like template setup with CSS styling. I had some lecture from “Ah Beng” as well, he was generous in term of guiding me on how to get used with CSS technology but not meal. I always pay the bill.

Here is some of the CSS code example: - 

1
2
#column1 {float: left; width: 100px; padding: 10px; }
#column2 {float: left; width: 100px; padding: 10px; }

Some of developers are not sure on when CSS was started, Styles were added to HTML 4.0 to solve a problem. It became quite important for developer to know how it plug into a web site and get it styled.
External Style Sheets is always a common thing for developer nowadays as can save a lot of work and are stored in CSS files.

Then CSS allow web developer to work out on printing layout as this is because some of the people would like to have their printing format differently. example:-

1
2
3
4
5
6
7
<style type="text/css" media="print">
label {
float: left;
display: block;
width: 3cm;
}
</style>

With multiple size of screen come into picture as tablet and mobile phone are able to surf internet and access web site they like, CSS further enhance it standard to enable developer to detect user agent screen size, this allow developer to style their web accordingly. 


1
2
3
4
<style type="text/css">
@media screen and (max-device-width: 480px) {
}
</style>

Story come more interesting when HTML5 is in picture. CSS3has become part HTML5, it allow developer to make the web site look more interesting with more animation allowed.

There are lots of web site that provide some tools to generate CSS3 like http://www.css3maker.com/http://css3generator.com/ and so on. You can get it from searching through google.com

Sad to say that CSS3 is still need sometimes because some of the browsers still working on their capability to support the standard. you can check on the css3 supported browser at caniuse.com. hopefully browser provider can speed up their development on supporting these features. 

I have to agree that with CSS web site been look more interesting.


20 June 2012

HTML5 with Modernizr


There are still lots of issue when come to build a web site to shoot every browsers, as we still see some of the outdated browser like IE7 and IE8 is still used by various company. which I think it can be a headache for people who try to build their web site using HTML5 and CSS3. 

HTML5, it been a good start to have some features supported by some of the browser and if it is not, you will have to work out with some of some polyfill and fallback. In this post I am going to share on how to use Modernizr to detect if bowser is support the HTML5 features.

Ok, What is Modernizr?

Modernizr is a small JavaScript library that detects the availability of native implementations for next-generation web technologies, i.e. features that stem from the HTML5 and CSS3 specifications. Many of these features are already implemented in at least one major browser (most of them in two or more), and what Modernizr does is, very simply, tell you whether the current browser has this feature natively implemented or not.


Some of you might wonder how we want to use Modernizr to detect HTML5 feature, I will share with you on how it work with some simple example, let say web worker. For those who not sure how Web worker work, you can refer to link http://www.html5rocks.com/en/tutorials/workers/basics/ for some basic briefing on it. 

Let's check on this example below:-

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
  <meta charset="utf-8">
  <title>Testing Modernizr For HTML5 Web Worker</title>
  <script src="http://modernizr.com/downloads/modernizr-latest.js"></script>
</head>
<body>
<script>
      if(Modernizr.webworkers){
          alert("Browser supports Web Workers");
        }
        else{
          alert("Web Workers not supported");
        }   
   </script>
</body>
</html>


With this code you will get alert to check if the browser support HTML5's Web Workers feature.

Google Chrome having a positive test on this features and it supported HTML5's Web Workers feature:
 Firefox is giving the green light on this feature as well:-


IE9 is obviously not support Web Workers.


Theory behind  Modernizr is it adds a large number of classes indicating the browser's capabilities into the html tag with no-js class added beginning of the code.

you can have a check on firebugs for firefox, it will show this:-


if you interested to check out what are the features that can be detected, please go to the link below:-
http://modernizr.com/docs/#features-html5

And please go to Download page to build your production copy, and you can choose what to include on the build itself.

10 June 2012

I love Webkit! And you should too…


Have to say that people are moving from bring the big laptop to smartphone and tablet when they wish to have an electronic device that can surf the internet while relaxing at the chair of some known café.

Smartphone and tablet's OS been nominated by mobile provider, Apple IOS, Google’s AndroidResearch in Motion’s Blackberry, and Microsoft’s Windows Mobile. Off cause some of the players like Symbian and Baba from Samsung. Eventually that each of these different operating systems has its own way of developing and deploying “native” apps.

With mobile and tablets is the focus, people will start to focus on mobile users market, you might spend many thousands dollars to get one apps to run on Iphone IOS, and have to spend little more thousand more to get it run at Google’s Android, and give an impression that people would like tablet version, you have to pour out few thousand for tablet’s version and there are few tablet with different resolutions.

Inside smartphone and tablet’s technology, some of them have 1 thing in common which is they are using webkit-base browser. You can have a research on it and WebKit-based browsers run on nearly all of the major smartphone and tablet operating systems.

With Webkit, business owner can have 1 cost on 1 web apps to cover every single type of device. Developer can just focus on HTML, CSS and Javascript on 1 apps that really make life easier. and now they are bringing HTML5 supported for tablet and mobile.

With Webkit-based browser, mobile will no need to get a notification from “store” and updates every time the native apps out of date. This seriously 1 thing that always annoying me a lots nowadays and I always have like 45 outstanding updates to run!

In fact, Web is always the best way to go for with Webkit in mind. So, we can have our data store in web cloud storage and switch tablets and smartphone.