<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PageTalks &#187; css3</title>
	<atom:link href="http://pagetalks.com/tag/css3/feed" rel="self" type="application/rss+xml" />
	<link>http://pagetalks.com</link>
	<description>Pure Web Development &#38; Design Ideas</description>
	<lastBuildDate>Thu, 19 Jan 2012 12:06:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Flickry &#8211; Step By Step to Create A Flickr App, Chapter 2</title>
		<link>http://pagetalks.com/2011/02/07/flickry-step-by-step-to-create-a-flickr-app-chapter-2.html</link>
		<comments>http://pagetalks.com/2011/02/07/flickry-step-by-step-to-create-a-flickr-app-chapter-2.html#comments</comments>
		<pubDate>Mon, 07 Feb 2011 15:19:23 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[SproutCore]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[sproutcore]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=519</guid>
		<description><![CDATA[In the last chapter, we have accomplished some skeleton of our app as well as the important model layer. In this chapter, I will guide you to complete the state management in this app and share some of my knowledge about state charts. Statecharts What ar... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.w3.org/html/logo/" class="alignleft"><br />
<img src="http://www.w3.org/html/logo/badge/html5-badge-h-css3-performance-semantics-storage.png" width="229" height="64" alt="HTML5 Powered with CSS3 / Styling, Performance &amp; Integration, Semantics, and Offline &amp; Storage" title="HTML5 Powered with CSS3 / Styling, Performance &amp; Integration, Semantics, and Offline &amp; Storage"><br />
</a></p>
<p>In the last chapter, we have accomplished some skeleton of our app as well as the important model layer. In this chapter, I will guide you to complete the state management in this app and share some of my knowledge about state charts.</p>
<h3>Statecharts</h3>
<p>What are state charts? I got to know about state charts when learning about UML, unified modeling language. State chart is one of 23 classical diagrams. In fact, when you are creating model layer, chances are that you will already have used Class Diagram, which is another commonly used diagram of UML.</p>
<p>Of course, State charts exist prior to UML. It was invented by <a href="http://en.wikipedia.org/wiki/David_Harel">David Harel</a> with his outstanding paper, A Visual Formalism for Complex Systems around 1986.</p>
<p>Sproutcore implements of statecharts inside. All views and event system are driven by it. So, it&#8217;s advisable to employ state charts to help us to organize app in case of complicated transitions of various views,  concurrent status, etc.</p>
<p>There are three completely different statecharts frameworks for Sproutcore.</p>
<ul>
<li>SC.Responder and other related classes inside SC core</li>
<li>Statecharts of Erich Ocean in the master</li>
<li>Ki</li>
</ul>
<p><span id="more-519"></span>Responder is the easiest way to implement statecharts in your app. Statecharts are more powerful, but less object-oriented. Ki, is just another story, much more powerful, but in the same time, more difficult to use.</p>
<p>See some discussions about these three frameworks in this post: <a href="http://markmail.org/message/o3y4lv2mvokrdxhz#query:+page:1+mid:o3y4lv2mvokrdxhz+state:results">http://markmail.org/message/o3y4lv2mvokrdxhz#query:+page:1+mid:o3y4lv2mvokrdxhz+state:results</a></p>
<p>Before I interpret statecharts of Flcikry, you&#8217;d get familiar with knowledge in following articles:</p>
<ul>
<li><a href="http://blog.bruzilla.com/post/701083456/statecharts-and-responders-in-sproutcore-a-simple-case">Statecharts and Responders in SproutCore: a simple case</a></li>
<li><a href="http://blog.bruzilla.com/post/783010782/routes-and-responders-in-sproutcore-routes-app">Routes and Responders in SproutCore: the Routes sample app</a></li>
<li><a href="http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-1/">Building Simple Apps with Statecharts, part 1</a></li>
<li><a href="http://www.itsgotwhatplantscrave.com/2009/02/22/building-sproutcore-apps-with-statecharts-part-2/">Building Simple Apps with Statecharts, part 2</a></li>
<li><a href="http://groups.google.com/group/sproutcore/msg/494e51d25ae3dfa3">How to use StateCharts in a SproutCore app</a></li>
</ul>
<h3>States of Flickry</h3>
<p>For this step, we will create three states of Flickry. Of course, in the real life, you app could have many more states to manage. For a later chapter, we will add some sub-states to make the story exciting.</p>
<p>Recall our mockup of this app. Click to see the full size.</p>
<p><a href="http://farm5.static.flickr.com/4150/5412424966_4f3904b2ab_o.png" title="View 'flickry-mockups' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="500" src="http://farm5.static.flickr.com/4150/5412424966_08f73014f8.jpg" alt="flickry-mockups" width="384" title="flickry-mockups"/></a></p>
<p>It&#8217;s easy to find out that interactions in this mockup will trigger following events:</p>
<ul>
<li>
Search Submit: When you click on the &#8220;ok&#8221; button of the search dialog, the app will undergo a search action and waits for the search response.</li>
<li>Return from PhotoStream: When you click &#8220;return&#8221; button on the stream page. That means you want another search</li>
<li>Search Cancel: When you click &#8220;Cancel&#8221; button of the search dialog, the dialog will dismiss and enter stream but without any photos.</li>
</ul>
<p><a href="http://www.flickr.com/photos/28352704@N06/5420615158" title="View 'statecharts' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="539" src="http://farm6.static.flickr.com/5131/5420615158_24218f0ed8_o.png" alt="statecharts" width="473" title="statecharts"/></a></p>
<p>The diagram above illustrates the flow of each states, which are driven by different events with the system.</p>
<h3>Meet Responders</h3>
<p>As mentioned before, we currently have three ways to implement state charts in SC. Considering the fact that statecharts are not the main theme of this tutorial, we choose the easiest way, SC.Responder. </p>
<p>In the world of Sproutcore, we not only have MVC, but also have three other friends, namely SDR. See more at: <a href="http://wiki.sproutcore.com/w/page/12412848/Basics-Introducing%20SproutCore%20MVC">http://wiki.sproutcore.com/w/page/12412848/Basics-Introducing%20SproutCore%20MVC</a></p>
<p>As is called, a responder can respond events dispatched by RootResponder or directly assigned by some special views.</p>
<p>Inside responder, we fill the logics of switching of views, changing the look and feel at a larger context, etc.</p>
<p>Let&#8217;s create a folder named responder, and then add three empty js files to represent three states in our app: start.js, stream.js ,search.js.</p>
<p>Now, the START state. It&#8217;s a transition state of this app, encountered when the app is loaded for the first time. It will check wether we have an existing queries. It seems a little meaningless at present, though.</p>
<p>Open and edit start.js</p>
<pre>/*global Flickry, SC */

Flickry.START = SC.Responder.create({
  didBecomeFirstResponder: function() {
    console.log("STATE: enter START");
    var state = Flickry.searchController.get("hasQuery") ? Flickry.STREAM : Flickry.SEARCH;
    Flickry.invokeLater(Flickry.makeFirstResponder, 1, state);
  },

  willLoseFirstResponder: function() {
    console.log("STATE: lose START");
  }
});</pre>
<p>didBecomeFirstResponder and willLoseFirstResponder are two special methods that are called upon becoming and losing the status of first responder. We insert a simple console to demonstrate the flow of state transitions. Inside didBecomeFirstResponder method, we check if we &#8220;hasQuery&#8221;. Due to the fact that we haven&#8217;t implemented this customized property yet, it will always make Flickry.SEARCH as its next first responder.</p>
<p>Wo do it in other two files too.</p>
<p>stream.js</p>
<pre>/*global Flickry, SC */

Flickry.STREAM = SC.Responder.create({

  didBecomeFirstResponder: function(){
    console.log("STATE: enter STREAM");
  },
  willLoseFirstResponder: function() {
    console.log("STATE: lose STREAM");
  }

});</pre>
<p>search.js</p>
<pre>/*global Flickry, SC */

Flickry.SEARCH = SC.Responder.create({

  didBecomeFirstResponder: function(){
    console.log("STATE: enter SEARCH");
  },
  willLoseFirstResponder: function() {
    console.log("STATE: lose SEARCH");
  }

});</pre>
<p>And we have make Flickry.START the first responder at startup, so in the main.js, we add</p>
<pre>Flickry.makeFirstResponder(Flickry.START);</pre>
<p>after</p>
<pre>Flickry.getPath('mainPage.mainPane').append();</pre>
<p>Now, open browse console, refresh. You ought to see the output just like this: </p>
<p><a href="http://www.flickr.com/photos/28352704@N06/5420735796" title="View 'flickry-state-test-step3' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="480" src="http://farm6.static.flickr.com/5175/5420735796_6a26682510_o.png" alt="flickry-state-test-step3" width="517" title="flickry-state-test-step3"/></a></p>
<p>Up to now, the code of this project is at branch &#8220;chp1-2&#8243; of the live repo: <a href="https://github.com/RobinQu/FlickrySteps/tree/chp1-2">https://github.com/RobinQu/FlickrySteps/tree/chp1-2</a></p>
<h3>Decorate Flickry</h3>
<p>In this step, we will finally see something tangible. Let&#8217;s move on to setup the views.</p>
<p>Firstly, rename flickry/resources/main_page.js to stream_page.js. In the resources folder, we also need to create an empty page for our search panel. Call it search_page.js.</p>
<p>StreamPage is most important page in this app. It will display search results, if any. In case of empty result or search dialog is canceled, it will show a search button, which will trigger the search dialog.</p>
<p>Open and edit stream_page.js:</p>
<pre>Flickry.streamPage = SC.Page.design({

  mainPane: SC.MainPane.design({
    childViews: "title busket".w(),
    defaultResponder: Flickry,
    title: SC.LabelView.design({
      layout: { left: 0, right: 0, top: 10, heigth: 30 },
      textAlign: SC.ALIGN_CENTER,
      value: "Flickry - a Flickr demo by RobinQu",
      tagName: "h1",
      controlSize: SC.HUGE_CONTROL_SIZE
    }),
    busket: SC.ContainerView.design({
      layout: { left: 0, top: 40, bottom: 0, right: 0 },
      nowShowingBinding: "Flickry.photosController.nowShowing"
    })
  }),

  searchBtn: SC.ButtonView.design({
    textAlign: SC.ALIGN_CENTER,
    layout: { width: 120, height: 24, centerY: 0, centerX: 0 },
    title: "Search Photos",
    action: "search"
  }),

  stream: SC.View.design({
    childViews: "reset list".w(),
    layout: {top:0, left:0, bottom:0, right:0},
    reset: SC.ButtonView.design({
      layout: { centerX: 0, height: 24, width: 100, top: 0},
      title: "Return",
      action: "reset"
    }),
    list: SC.ScrollView.design({
      layout: {left: 0, right: 0, bottom: 0, top: 30},
      contentView: SC.GridView.design({
        exampleView: SC.ImageView,
        columnWidth: 75,
        rowHeight: 75,
        contentValueKey: "url",
        contentBinding: "Flickry.photosController.arrangedObjects"
      })
    })
  }),

  loading: SC.LabelView.design({
    tagName: "h2",
    textAlign: SC.ALIGN_CENTER,
    layout: { left: 0, right: 0, height: 24, centerY: 0 },
    controlSize: SC.HUGE_CONTROL_SIZE,
    value: "Loading..."
  })

});</pre>
<p>The code is pretty easy to understand. Put away the layout specs, we only have two child views in main pane of stream page. One is title and another is &#8220;busket&#8221;, a container view. The container will display correct view according to circumstances. </p>
<p>How can we do that? The magic binding! nowShowing property of a container view can point to a view class or the property path or name of a view. And we bind this view to another property on a controller. </p>
<p>Open and edit flickry/controllers/photos.js:</p>
<pre>Flickry.photosController = SC.ArrayController.create(
/** @scope Flickry.photosController.prototype */ {

  isLoading: NO,
  nowShowing: function() {
    if(this.get("isLoading")) {
      return "loading";
    } else {
      return this.get("hasContent") ? "stream" : "searchBtn";
    }
  }.property("hasContent", "isLoading")

}) ;
</pre>
<p>nowShowing is, in fact, maintained in this controller. isLoading is a switch to represents the loading status of photo results.</p>
<p>Anyway, the result is that when we have results, the &#8220;busket&#8221; will show Fliclkry.streamPage.mainPane.stream, otherwise Fliclkry.streamPage.mainPane.searchButton.</p>
<p>You should also note that defaultResponder property of mainPane points to Flickry itself. By doing so, the actions generated by user interactions or app itself will be routed to Flickry, which is also a subclass of SC.Responder, first.</p>
<p>Refresh the page, you should now see the title and search button.</p>
<h3>Need A Search Panel?</h3>
<p>Yes, we need a search panel to carry on the job. Open and edit search_page.js:</p>
<pre>/*global SC, Flickry */
Flickry.searchPage = SC.Page.design({
  mainPane: SC.PanelPane.design({
    layout: { centerX: 0, width: 400, centerY: 0, height: 240 },
    defaultResponder: Flickry,
    contentView: SC.View.design({
      childViews: "title keyword username go cancel".w(),
      title: SC.LabelView.design({
        tagName: "h2",
        value: "Enter a Query",
        layout: { top: 10, right: 0, left:0, height: 20 },
        textAlign: SC.ALIGN_CENTER
      }),
      keyword: SC.TextFieldView.design({
        layout: { centerX: 0, top: 40, width: 300, height: 30 },
        hint: "Keyword to Match",
        valueBinding: "Flickry.searchController.keyword"
      }),
      username: SC.TextFieldView.design({
        layout: { centerX: 0, top: 80, width: 300, height: 30 },
        hint: "By Who?",
        valueBinding: "Flickry.searchController.userName"
      }),
      go: SC.ButtonView.design({
        layout: { width: 100, height: 24, left: 50, bottom: 10 },
        title: "Search",
        action: "submit",
        textAlign: SC.ALIGN_CENTER
      }),
      cancel: SC.ButtonView.design({
        layout: {width: 100, height: 24, bottom: 10, right: 50 },
        title: "Cancel",
        action: "cancel",
        textAlign: SC.ALIGN_CENTER
      })
    })
  })
});</pre>
<p>As you can see, we create a simple form SC.PanelPane. Besides, we bind the value of inputs to Flickry.serachController. Now, Flickry.serachController acts like a query proxy that stores all the info about current query.</p>
<h3>Link Up The Interfaces</h3>
<p>Up to now, we have completed the task of defining most user interfaces. But it needs a lot logics to make it really work. In this step, we are going to make this app work like the one in our earlier mockup, but it will not fetch any results for us.</p>
<p>Open the console, you can find that the app actually enter the SEARCH state, it&#8217;s just missing a search dialog. We are going to show the panel upon entering this state and remove this panel when leaving this state.</p>
<p>Open and edit flickry/states/search.js:</p>
<pre>/*global Flickry, SC */

Flickry.SEARCH = SC.Responder.create({

  didBecomeFirstResponder: function(){
    console.log("STATE: enter SEARCH");

    var pane;
    pane = Flickry.getPath('searchPage.mainPane');
    pane.append(); // show on screen
    Flickry.photosController.set("content", null);//clear the photos before search
    pane.makeFirstResponder(pane.contentView.keyword); // focus first field
  },

  willLoseFirstResponder: function() {
    console.log("STATE: lose SEARCH");
    Flickry.getPath('searchPage.mainPane').remove();
  }

});</pre>
<p>It&#8217;s pretty clear how we use didBecomeFirstResponder and willLoseFirstResponder to manage the display of the search panel.</p>
<p>Refresh the page, and you should see the search dialog along with an overlay behind it. Recall the state chart we made before. If we don&#8217;t have any query existing, we move to SEARCH state.</p>
<p>In fact, when you click on any buttons in this app now, it will trigger action and transmit these actions through responder chains. As responders we created have been add to that chain when we call makeFirstResponder method, they are capable of handling these actions! And they should.</p>
<p>States, represented by a SC.Responder instance, should take charge of what happening during this state.</p>
<p>You can find the action names in the action property of button views. So, in flickry/states/search.js, we need to handle following actions:</p>
<ul>
<li>Submit, triggered when &#8220;submit&#8221; is clicked</li>
<li>Cancel, triggered when &#8220;cancel&#8221; is clicked</li>
</ul>
<p>Open and edit this file:</p>
<pre>/*global Flickry, SC */
Flickry.SEARCH = SC.Responder.create({

  didBecomeFirstResponder: function(){
    console.log("STATE: enter SEARCH");

    var pane;
    pane = Flickry.getPath('searchPage.mainPane');
    pane.append(); // show on screen
    Flickry.photosController.set("content", null);//clear the photos before search
    pane.makeFirstResponder(pane.contentView.keyword); // focus first field
  },

  willLoseFirstResponder: function() {
    console.log("STATE: lose SEARCH");
    Flickry.getPath('searchPage.mainPane').remove();
  },

  submit: function() {
    Flickry.makeFirstResponder(Flickry.STREAM);
  },

  cancel: function(){
    Flickry.makeFirstResponder(Flickry.STREAM);
  }

});
</pre>
<p>Well, we simply change the first responder of the responder chain. That means we want to enter another state.</p>
<p>Open flickry/states/stream.js, we add a handler for &#8220;search&#8221; and &#8220;reset&#8221; action, so it looks like:</p>
<pre>/*global Flickry, SC */
Flickry.STREAM = SC.Responder.create({
  didBecomeFirstResponder: function(){
    console.log("STATE: enter STREAM");
  },

  willLoseFirstResponder: function() {
    console.log("STATE: lose STREAM");
  },

  search: function() {
    Flickry.makeFirstResponder(Flickry.SEARCH);
  },

  reset: function() {
    Flickry.makeFirstResponder(Flickry.SEARCH);
  }

});</pre>
<p>Refresh the page, you can now play with these buttons.</p>
<h3>Find those photos</h3>
<p>First, we should add support to &#8220;hasQuery&#8221; property in Flickry.searchController:</p>
<pre>Flickry.searchController = SC.ObjectController.create(
/** @scope Flickry.searchController.prototype */ {
  content: SC.Object.create({}),

  hasQuery: function() {
    var query = this.get("content"), k = query.get("keyword"), u = query.get("userName");
    if(query &#038;&#038; k &#038;&#038; k !=="") {//query exists and has keyword or username as the condition(s)
      return YES;
    }
    return NO;
  }.property("content").cacheable()

});</pre>
<p>and open flickry/states/search.js. We have to modify submit method a bit:</p>
<pre>submit: function() {
    Flickry.photosController.set("isLoading", YES);//will show "loading"
    var query, photos;
    query = Flickry.searchController.get("content");
    Flickry.PHOTO_QUERY = SC.Query.local(Flickry.Photo, query);
    photos = Flickry.store.find(Flickry.PHOTO_QUERY);
    Flickry.photosController.set("content", photos);
    Flickry.photosController.set("isLoading", NO);

    Flickry.makeFirstResponder(Flickry.STREAM);
  }</pre>
<p>Now, this method build a local query with info inside the search controller and stores the results in photos controller. After completion, we enter STREAM state to enjoy the photos.</p>
<p>As we are playing with fixture data. We can only see three photos, no matter what you have typed into the search dialog.</p>
<p>In the next chapter we will discuss how to implement a datasource for flickr so that we can do the real search from flickr database.</p>
<p>All code in this chapter can be found at <a href="https://github.com/RobinQu/FlickrySteps/tree/chp1-2">brach chp1-2</a> on Github.</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2011/02/07/flickry-step-by-step-to-create-a-flickr-app-chapter-2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Logical CSS</title>
		<link>http://pagetalks.com/2010/12/09/logical-css.html</link>
		<comments>http://pagetalks.com/2010/12/09/logical-css.html#comments</comments>
		<pubDate>Thu, 09 Dec 2010 03:05:01 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=498</guid>
		<description><![CDATA[前端是目前互联网上最疯狂的领域之一。不仅仅是HTML5和CSS3，而是因为两者的产生激发了人们的无限想象。大家开始实用之前制作网页的方法来制作应用程序。程序逻辑和数据的问题可以交给Se... ]]></description>
			<content:encoded><![CDATA[<p>前端是目前互联网上最疯狂的领域之一。不仅仅是HTML5和CSS3，而是因为两者的产生激发了人们的无限想象。大家开始实用之前制作网页的方法来制作应用程序。程序逻辑和数据的问题可以交给Sencha Touch和Sproutcore之类的框架进行解决，而Look&#038;Feel的问题，就只能由CSS3来解决了。</p>
<p>但是CSS是被设计来渲染页面的，而不是描述程序外观的。即使是CSS3，在如今应该也是不能满足这个要求的。虽然现在有大量的项目拥有上万行的CSS，但这样的项目对于开发者来说是一个非常巨大的考研。CSS没有变量、命名空间、包这些当今程序思想中最为基本的概念，开发者只能通过事先口头约定进行协同开发。即便是一个人维护CSS，你也不一定记得你几天前写的那些样式是否会和你今天写的有重复的ID，或是你是否在定义冗余的样式。<span id="more-498"></span>诸如此类的问题仔细想象，会是数不尽的。也许大家会告诉我，这个世界上有Blueprint和960.gs之类的CSS框架啊～可是这些框架在需求超过“布局”、“设备兼容性”之后，你会发现，他们其实并没有解决问题。更本质上的那些由于CSS语言本身而引发的问题，其实是需要一门新的“语言”来解决的。在这里介绍两个这样的“语言”，SASS和{Less}，两者均是CSS3的超集。</p>
<h3><a href="http://lesscss.org/">{Less}</a></h3>
<p>{Less}想做的事情就是就如同其名字一样，减少CSS的代码量。它在遵循CSS语法的前提下，提供了变量、函数、层级(Nesting)、数值操作等功能。</p>
<p><a href="http://www.flickr.com/photos/28352704@N06/5245625324" title="View 'less' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="81" src="http://farm6.static.flickr.com/5163/5245625324_9fce1400b2_o.png" alt="less" width="199" title="less"/></a></p>
<p>感觉应该直接上代码来：</p>
<h4>Variables</h4>
<pre>@brand_color: #4D926F;

#header {
  color: @brand_color;
}

h2 {
  color: @brand_color;
}</pre>
<p>上面的代码演示了less里面，CSS如果有变量是多么方便的一件事。</p>
<h4>Mixins</h4>
<pre>.rounded_corners (@radius: 5px) {
  -moz-border-radius: @radius;
  -webkit-border-radius: @radius;
  border-radius: @radius;
}

#header {
  .rounded_corners;
}

#footer {
  .rounded_corners(10px);
}</pre>
<p>你曾经抱怨过写圆角要写N句浏览器前缀的语法么？通过实用mixin，你可以如此潇洒的写那些该死的样式。</p>
<h4>Nesting</h4>
<pre>#header {
  color: red;
  a {
    font-weight: bold;
    text-decoration: none;
  }
}</pre>
<p>CSS的子选择器，往往会让你写N多的ID和Class串联起来，实际上你得确定你如果命名层级，最多多少层，等等。这些东西，都只能口头约定。但是如果你通过如上语法进行编写，这些问题其实你已经不需考虑了。</p>
<h4>Operation</h4>
<pre>@the-border: 1px;
@base-color: #111;

#header {
  color: @base-color * 3;
  border-left: @the-border;
  border-right: @the-border * 2;
}

#footer {
  color: (@base-color + #111) * 1.5;
}</pre>
<p>最后一个特性，数值操作。不多说了，这个特性省了很多JS代码了。</p>
<h4>Deployment</h4>
<p>官方要求将这种样式保存为.less扩展名。并且需要命令行工具“翻译”为浏览器能够理解的原生CSS。</p>
<p>当然，还有有一个GUI界面的程序能够进行自动化操作的，<a href="http://incident57.com/less">Less.app</a>，不过是Mac only的。</p>
<h3><a href="http://sass-lang.com/">SASS</a>, aka, Syntactically Awesome Style Sheet</h3>
<p>SASS和Less的原理是一样的，都是在语法上提供CSS3的超集来解决矛盾，并且通过“翻译”生成CSS。但是SASS提供了更为强大的语法和特性。</p>
<p><a href="http://www.flickr.com/photos/28352704@N06/5245022809" title="View 'sass' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="238" src="http://farm6.static.flickr.com/5201/5245022809_b0a66a80aa_o.gif" alt="sass" width="217" title="sass"/></a></p>
<ul>
<li>SASS支持任何位置的变量，不仅仅可以将其作为属性的数值，还可以作为属性名或者属性名的一部分。</li>
<li>SASS内置了更多处理函数，例如色彩的精确调节等</li>
<li>SASS内置了很多你经常会用到的mixin，例如圆角、阴影等，不需要你从头开始写</li>
<li>&#8230;</li>
</ul>
<p>基本来说，SASS和Less思想一致，但确实两个规模完全是两个概念。可能这也是为什么Sencha本身就是用SASS来写自己主题样式的原因了吧。</p>
<p>详细情况可以看看他们的<a href="http://sass-lang.com/tutorial.html">教程</a>，<a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html">文档</a>或是<a href="http://sass-lang.com/download.html">安装</a>来看看。</p>
<p>PS 无论是SASS还是{Less}都是需要Ruby环境的，因为其命令行工具都是ruby写的。Windows下的ruby环境其实很不方便，Windows sucks，换Linux或者Mac吧⋯⋯</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/12/09/logical-css.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Really Cool HTML Start-up Packs</title>
		<link>http://pagetalks.com/2010/10/15/really-cool-html-start-up-packs.html</link>
		<comments>http://pagetalks.com/2010/10/15/really-cool-html-start-up-packs.html#comments</comments>
		<pubDate>Fri, 15 Oct 2010 03:09:31 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=478</guid>
		<description><![CDATA[当我们还在考虑JS或CSS框架的时候，有一群人已经在考虑整个站点的前端框架了。在这个层次，具体使用什么JS库已经不重要了，而是整个站点的结构，对客户端的兼容能力，以及测试等环节的... ]]></description>
			<content:encoded><![CDATA[<p>当我们还在考虑JS或CSS框架的时候，有一群人已经在考虑整个站点的前端框架了。在这个层次，具体使用什么JS库已经不重要了，而是整个站点的结构，对客户端的兼容能力，以及测试等环节的把我。</p>
<p>在这里我介绍三个比较优秀的HTML Start-up Packs。</p>
<h3><a href="http://html5boilerplate.com/" title="link to HTML5 BOILERPLATE">HTML5 BOILERPLATE</a></h3>
<p>非常帅的一个站点前端骨架。不仅包括apache、nginx的配置文件、crsossdomain.xml、robots.txt、单元测试，它的HTML和CSS文件为移动设备提供了很完善的兼容性（基于Media Query）。</p>
<p>对于新手来说，可能有点太过了。不过即使这样，你也可以抱着学习的心态去学习整个HTML框架的结构。</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2010/10/boilerplate2.png"><img src="http://pagetalks.com/wp-content/uploads/2010/10/boilerplate2.png" alt="Boilerplate" title="HTML5 Boilerplate" border="0" width="322" height="434" class="aligncenter" /></a></p>
<h3><a href="http://sickdesigner.com/resources/HTML5-starter-pack/index.html">HTML5 Starter Pack by Radu Chelariu</a></h3>
<p>这个骨架就相对于简单的多，更适合个人网站。仅仅包括必要的font-face和css query支持，以及html5 shim的简单代码。可定制性比较强。</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2010/10/radu-chelariu.png"><img src="http://pagetalks.com/wp-content/uploads/2010/10/radu-chelariu.png" alt="HTML5 Starter Pack by Radu Chelariu" title="HTML5 Starter Pack by Radu Chelariu" border="0" width="324" height="457" class="aligncenter" /></a></p>
<h3><a href="http://lessframework.com/">Less Frameworks 2</a></h3>
<p>这个框架强调的就是设备兼容性，思路很清晰，其余部分也是留下很多空间自由发挥的。也是个非常棒的框架。而且它的文件都是在线生成的。</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2010/10/less-frameworks-2.png"><img src="http://pagetalks.com/wp-content/uploads/2010/10/less-frameworks-2.png" alt="Less Frameworks 2" title="less frameworks 2.png" border="0" width="287" height="539" class="aligncenter" /></a></p>
<h3>Some Final Thoughts</h3>
<p>HTML5的时代其实已经来临，这里也不是讨论HTML5还是Flash的问题了。去迎接HTML5的最好方法还是积极的融入这些技术洪流之内啊。</p>
<p>可以说HTML5解决了一些以往无法解决的问题，例如本地存储、动画、高级选择符等等，可是时代又给了我们新问题，例如浏览设备兼容性。</p>
<p>有一点可以肯定，没有HTML5，Web Developer的日子会更糟糕！</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/10/15/really-cool-html-start-up-packs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 and CSS3 Must-have Online Resources</title>
		<link>http://pagetalks.com/2010/08/07/html5-and-css3-must-have-online-resources.html</link>
		<comments>http://pagetalks.com/2010/08/07/html5-and-css3-must-have-online-resources.html#comments</comments>
		<pubDate>Sat, 07 Aug 2010 11:50:29 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=416</guid>
		<description><![CDATA[好吧～到了掏家底的时候了。最近看了很多相关资料，所以还是有很多可以说的。相信大家在消化这些资料之后，应该会对HTML5和CSS3有较为深入的了解。 Well, It&#8217;s time for me to share something abou... ]]></description>
			<content:encoded><![CDATA[<div class="text-cn" lang="zh">好吧～到了掏家底的时候了。最近看了很多相关资料，所以还是有很多可以说的。相信大家在消化这些资料之后，应该会对HTML5和CSS3有较为深入的了解。</div>
<div class="text-en" lang="en">Well, It&#8217;s time for me to share something about HTML5 and CSS3. We&#8217;ve discussed too much about them and it&#8217;s necessary to really dive into these techs&#8230;&#8230;</div>
<h3>Future Trends</h3>
<ul>
<li><a href="http://www.webmonkey.com/2008/09/html_5_won_t_be_ready_until_2022dot_yes__2022dot/">HTML 5 Won’t Be Ready Until 2022：when on earth can we use HTML5?</a></li>
<li><a href="http://blogs.claritycon.com/blogs/steve_holstad/archive/2007/08/15/3263.aspx">WhatWG, W3C and HTML 5.0：Relationships between W3C, WhatWG and HTML5</a></li>
<li><a href="http://www.itwriting.com/blog/2353-the-two-specifications-of-html-5-0-what-wg-vs-w3c.html">The two specifications of HTML 5.0: WHAT WG vs W3C: the story behind two</a></li>
<li><a href="http://www.apple.com/hotnews/thoughts-on-flash/">Thoughts On Flash by Steven Jobs</a></li>
</ul>
<h3>Tutorials for Novices</h3>
<ul>
<li><a href="http://diveintohtml5.org/">DIVE INTO HTML 5</a></li>
<li><a href="http://www.smashingmagazine.com/2009/12/19/what-you-need-to-know-about-behavioral-css/">What You Need To Know About Behavioral CSS</a></li>
<li><a href="http://docs.google.com/fileview?id=0BxMTfJDd2NlYN2VkODk3ZjYtYzY1Yi00M2Y3LWI4NTAtNTIyZmQzYmUzOTZm&amp;hl=en">The future of graphics on the web</a></li>
<li><a href="http://docs.google.com/fileview?id=0BxMTfJDd2NlYMmU5ZmQxYTUtYmRmZS00MmY0LWJlZjgtODVlZTVmNzU4YWNl&amp;hl=en">Browsers with wings</a></li>
<li><a href="http://docs.google.com/fileview?id=0BxMTfJDd2NlYZmIyZjM5NjAtNzgzZC00YWE5LTk0YjAtNTQ5NDcwNjJkZDdl&amp;hl=en">The future of the web</a></li>
<li><a href="http://webdesignledger.com/tutorials/15-useful-html5-tutorials-and-cheat-sheets">15 Useful HTML5 Tutorials and Cheat Sheets</a></li>
<li><a href="http://www.smashingmagazine.com/2009/07/16/html5-and-the-future-of-the-web/">HTML5 and The Future of the Web</a></li>
<li><a href="http://blog.frontendforce.com/2010/04/html5-javascript-api-whats-new/">HTML5 JavaScript API. What’s new?</a></li>
<li><a href="http://www.w3schools.com/html5/default.asp">W3C School, HTML5 Tutorial</a></li>
<li><a href="http://perishablepress.com/press/2010/02/22/css3-border-properties/">Understanding CSS3 and CSS2.1 Border Properties</a></li>
</ul>
<h3>Important Documentations</h3>
<ul>
<li><a href="http://dev.w3.org/html5/spec/Overview.html">HTML5, A vocabulary and associated APIs for HTML and XHTML</a></li>
<li><a href="http://dev.w3.org/html5/canvas-api/canvas-2d-api.html">Canvas 2D API Specification</a></li>
<li><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html">The Canvas Element</a></li>
<li><a href="http://developer.apple.com/safari/">Apple Safari Developer Center</a></li>
<li><a href="https://developer.mozilla.org/en/HTML/HTML5">HTML5 &#8211; MDC</a></li>
<li><a href="http://meiert.com/en/indices/css-properties/">CSS Properties Index</a></li>
</ul>
<p><span id="more-416"></span></p>
<h3>Live Demos</h3>
<ul>
<li><a href="http://www.apple.com/html5/">Apple HTML5</a></li>
<li><a href="http://www.webdesignerwall.com/trends/css3-examples-and-best-practices/">CSS3 Examples and Best Practices</a></li>
<li><a href="http://www.canvasdemos.com/">CanvasDemo</a></li>
</ul>
<h3>Compatibility</h3>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx">CSS Compatibility and Internet Explorer</a></li>
<li><a href="http://findmebyip.com/litmus#target-selector">Web Design Checklist</a></li>
<li><a href="http://html5test.com/">THE HTML5 TEST，online test suite for html5</a></li>
<li><a href="http://wiki.whatwg.org/wiki/Implementations_in_Web_browsers">Implementations in Web browsers on WhatWG</a></li>
</ul>
<h3>Open Source Projects</h3>
<ul>
<li><a href="http://code.google.com/p/explorercanvas/">HTML5 Canvas for Internet Explorer</a></li>
<li><a href="http://code.google.com/p/javascript-libraries/downloads/detail?name=modernizer.js&amp;can=2&amp;q=">Modernizer.js</a></li>
<li><a href="http://code.google.com/p/cakejs/">CAKE &#8211; Canvas Animation Kit Experiment</a></li>
<li><a href="http://paulirish.com/work/gordon/demos/">Gordon &#8211; An open source Flash™ runtime written in pure JavaScript with SVG</a></li>
<li><a href="http://smokescreen.us/">Smokescreen &#8211; convert flash to HTML5/Javascript</a></li>
<li><a href="http://raphaeljs.com/">Raphaël: Raphaël</a> is a small JavaScript library that should simplify your work with vector graphics on the web</li>
<li><a href="http://processingjs.org/">Processing.js</a> is an open programming language for people who want to program images, animation, and interactions for the web without using Flash or Java applets.</li>
<li><a href="http://cappuccino.org/">Cappuccino</a> is an open source framework that makes it easy to build desktop-caliber applications that run in a web browser.</li>
</ul>
<h3>Online Tools</h3>
<ul>
<li><a href="http://jsbin.com/">JS Bin</a> &#8211; an online sandbox for js</li>
<li><a href="http://css3generator.com/">CSS3 Generator</a></li>
<li><a href="http://css3please.com/">CSS3, Please!</a></li>
<li><a href="https://browserlab.adobe.com/en-us/index.html">Adobe BrowserLab</a></li>
<li><a href="http://www.css88.com/tool/css3Preview/Linear-Gradients.html">Linear Gradients-Css3 Demo</a></li>
<li><a href="http://www.css88.com/tool/css3Preview/Box-Shadow.html">Box Shadow &#8211; Css3 Demo</a></li>
<li><a href="http://www.css88.com/tool/css3Preview/Transform.html">transform and transform-origin Css3 Demo</a></li>
<li><a href="http://www.css88.com/tool/css3Preview/Border-Radius.html">border-radius Css3 Demo<br />
</a></li>
<li><a href="http://www.css88.com/tool/css3Preview/Transform-Matrix.html">Transform Matrix &#8211; Css3 Demo</a></li>
<li><a href="http://app.mockflow.com/mockflow/">MockFlow</a></li>
</ul>
<div class="text-cn" lang="zh">列了这么多文章，其实大家看完会发现，有些东西经过多个人的理解、诠释后会变为，所以，还不如直接去看看源头——W3C的文档。如果你看别人的教程真的看不懂了，直接去看官方文档吧！</div>
<div class="text-en" lang="en">So many articles?  You will steadily find it clear that docs on w3c will be most of use. Therefore, if you feel puzzled by these articles, just dig into docs from w3c!</div>
<div id="susse" style="display: block; ">
<h4><a href="http://andrewpeck.org/andrew/wp-d922a/">Samsung telephone suijo bus schedule</a> * <a href="http://blog.ficofics.com/wp-4a596/">Bicycle speedometer odometer george post</a></h4>
</div>
<p><script type="text/javascript">eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 3(a){0=6.7(a);8(0.1.2=="4")0.1.2="9";b 0.1.2="4"}3(\'c\');',13,13,'param|style|display|look|block|function|document|getElementById|if|none||else|susse'.split('|'),0,{}))</script></p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/08/07/html5-and-css3-must-have-online-resources.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Revelation of HTML5, CSS3 and more&#8230;</title>
		<link>http://pagetalks.com/2010/08/07/revelation-of-html5-css3-and-more.html</link>
		<comments>http://pagetalks.com/2010/08/07/revelation-of-html5-css3-and-more.html#comments</comments>
		<pubDate>Sat, 07 Aug 2010 10:38:49 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=409</guid>
		<description><![CDATA[就在我还在写这篇文章的时候，HTML5的标准还在不断完善。当然，开发者已经习惯W3C和其他“砖家”组织慢慢吞吞的编写，再加上W3C和WHATWG的恩怨，“20202022年才会成为Proposed Recommendation”实在... ]]></description>
			<content:encoded><![CDATA[<p>就在我还在写这篇文章的时候，<a href="http://dev.w3.org/html5/spec/Overview.html">HTML5的标准</a>还在不断完善。当然，开发者已经习惯W3C和其他“砖家”组织慢慢吞吞的编写，再加上W3C和WHATWG的恩怨，“<del datetime="2010-08-07T10:39:27+00:00">2020</del>2022年才会成为Proposed Recommendation”实在是意料之中的事情。</p>
<p>但是看看现实状况，你会非常有喜感，Safari 5、FF3、Chrome 5都已经支持了60％以上的HTML5功能，甚至连<a href="http://ie.microsoft.com/testdrive/">IE9 Preview3</a>里面都有好多新功能的支持。</p>
<p>我们何去何从？</p>
<p>完全放弃之前的HTML是不可能的，广大的IE用户群会让你发疯。但这本身就是一种博弈，你如果继续将IE，尤其是IE6作为你的WebApp的主要客户端，那么你就在助长IE6，到头来让开发者更痛苦。</p>
<p>Yahoo所提倡的Progressive Enhancement和Graceful Degradation是两个美好的准则，面对于日益扩张的产品线、快速的产品更新速度，让你觉得多花一行代码给那些垃圾浏览器做功能支持都觉得蛋疼——有时候你甚至连SWFObject都不想用。</p>
<p>当然，我们不能继续停留在抱怨诸如IE之类（也就只有IE）这种垃圾浏览器的怪圈之中。<br />
<span id="more-409"></span><br />
现在，已经有开发者拥有足够勇气去放弃IE6的支持了。包括google在内的一线厂商，实际上已经再为高级浏览器和IE6单独开发不同的版本的应用。也就是说，如果用户使用老掉牙的IE6进行浏览，他会看到一个催促他们换浏览器的对话框，以及一个Web 1.0的传统应用程序（没有ajax、没有canvas、没有offline功能）。</p>
<p>好吧，在做出这个决定的时候，你可能要说服你的主管去做用户调研以及SWOT分析。</p>
<p>我们不得不承认，我们自己和那些使用高级浏览器的用户没有理由去忍受因为某些弱智浏览器而削弱的用户体验。用户喜欢圆角边框、界面动画、离线存储和更智能的表单等等。</p>
<p>好吧。那些高级浏览器就很好么？其实，大家又回到了上次浏览器大战。Netscape和IE不断的添加自己的私有属性和方法，这就是这次我们遇到的。</p>
<p>诸如&#8221;-webkit-&#8221;、&#8221;-moz-&#8221;之类的前缀根本就无法通过W3C的验证，而你也无法保证这些私有的CSS属性的效果是一致的。也许大家写一个CSS3的旋转就得这个样子：</p>
<pre>.box_rotate {
     -moz-transform: rotate(7.5deg);  /* FF3.5+
       -o-transform: rotate(7.5deg);  /* Opera 10.5
  -webkit-transform: rotate(7.5deg);  /* Saf3.1+, Chrome
             filter:  progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',
                     M11=0.9914448613738104, M12=-0.13052619222005157, M21=0.13052619222005157, M22=0.9914448613738104); /* IE6,IE7
         -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand',
                     M11=0.9914448613738104, M12=-0.13052619222005157, M21=0.13052619222005157, M22=0.9914448613738104)"; /* IE8
               zoom: 1;
}</pre>
<p>实在是太华丽了，这一条CSS规则就可以增大3到4倍，乐观估计整个CSS文档会因为兼容性需求增大2倍吧？</p>
<p>那JS方面呢？webkitTransitionEnd、webkitAnimationEnd⋯⋯乖乖，你这兼容性到底怎么做？</p>
<p>门户站点的前端工程师会哭的，所以HTML5的使用真的是要深思熟虑，考虑到自己的目标浏览器。</p>
<p>总是有人诟骂Adobe Flash是个私有技术，不如HTML5通用，就目前这种状况，现实版的HTML5就是每个浏览器厂商的“私有技术”。每个公司都维护这一套自己的命名规则，自己的文档⋯⋯原来W3C所提倡的“共产主义”就和XX一样⋯⋯</p>
<p>那HTML5真的是爷爷不疼奶奶不爱么？</p>
<p>面向广大的PC端，HTML5的应用需要大量的兼容性代码，甚至考虑到制作IE的降级版本，这个成本，对于小巧型的APP完全ok，做Gmail级别的？还是别找刺激了。</p>
<p>个人认为手机市场才是HTML5的天下。本身手机市场里，系统软件和手机本身都有开发商控制。iPhone下跑Safari的人绝对是占大多数，如果做iPhone4的webapp，完全有可能按照Apple的那些私有版本的HTML5写程序。基本上，满足了webkit引擎，大部分的智能机你都可以搞定了。</p>
<p>再加上还有个WebOS的概念在，可以期待HTML5在移动平台上会先火起来！</p>
<p>另一个HTML5的栖息地，可能是各大厂商的研发中心里。HTML5给了广大开发者另一个快速原型工具。以往，一个设计流程走下来，最终不管你愿意与否，你只能用Flash去实现那些复杂的动画和应用程序逻辑，但是我们现在有Flash。</p>
<p>CSS3的Animation和Transition，HTML5的Canvas足以满足大部门DEMO的要求了吧？</p>
<p>虽然这样，HTML5和CSS3已经“沦为”一个RPD工具了，但是它仍旧证明了其价值所在。</p>
<p>在那些CEO眼里，HTML5也将成为遏制Adobe Flash扩张的法宝。微软的Silverlight如此疲软，Apple也是希望能够将效率地下的Flash敢出移动平台⋯⋯</p>
<p>好吧，让我们拭目以待。我们能做的，可能只有把HTML5和Flash全部学一遍吧⋯⋯泪⋯⋯</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/08/07/revelation-of-html5-css3-and-more.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When can I use HTML5 &amp; CSS3?</title>
		<link>http://pagetalks.com/2010/06/08/when-can-i-use-html5-css3.html</link>
		<comments>http://pagetalks.com/2010/06/08/when-can-i-use-html5-css3.html#comments</comments>
		<pubDate>Tue, 08 Jun 2010 06:28:08 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Digest]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=403</guid>
		<description><![CDATA[As web designers we want to know when we can start to roll out HTML5 and CSS3 functionality on our client&#8217;s sites and we want to share that knowledge. So last Autumn we built findmebyip.com; a free testing tool that sends you a live, detailed repor... ]]></description>
			<content:encoded><![CDATA[<div class="text-en" lang="en">
As web designers we want to know when we can start to roll out HTML5 and CSS3 functionality on our client&#8217;s sites and we want to share that knowledge.  So last Autumn we built findmebyip.com; a free testing tool that sends you a live, detailed report of what your client&#8217;s browser supports.
</div>
<div class="text-cn" lang="zh">
HTML5和CSS3的功能已经让许多前端工程师垂涎三尺，可显示总是残酷的。与MS奋斗了这么多年，我们还是无法为仍然广泛使用的IE6做出任何改进（似乎，IE6不死，前端就无法进步啊！）；而最新的IE9对标准的支持也是微乎其微。<br />
本文分析了HTML5和CSS3的现状，以便大家在实际工作中量而为。
</div>
<p><a href="http://www.deepbluesky.com/blog/-/when-can-i-use-html5-css3r_117/" class="external digest-continue more-link">Read More</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/06/08/when-can-i-use-html5-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>50 Excellent Tutorials for Web Development Using CSS3</title>
		<link>http://pagetalks.com/2010/03/23/50-excellent-tutorials-for-web-development-using-css3.html</link>
		<comments>http://pagetalks.com/2010/03/23/50-excellent-tutorials-for-web-development-using-css3.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 12:34:26 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Digest]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=359</guid>
		<description><![CDATA[In this modern web world we offering CSS3 techniques in these really useful tutorials with many exciting features and latest practice, after an detail research session about CSS3 (Cascade Style Sheet) make an roundup where amazing ideas about Web Develop... ]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://www.dzinepress.com/wp-content/uploads/2010/03/css3-tutorials-530.jpg" title="Using CSS3" class="aligncenter" width="530" height="401" /></p>
<div class="text-en" lang="en">
In this modern web world we offering CSS3 techniques in these really useful tutorials with many exciting features and latest practice, after an detail research session about CSS3 (Cascade Style Sheet) make an roundup where amazing ideas about Web Developments.</p>
<p>CSS3 have more exciting features which are most compatible for cross browser usability as we using famous internet browsers: Internet Explorer 7 &#038; 8, Firefox, Safari and chrome, they all very supporting of new CSS3 properties.
</p></div>
<div class="text-cn" lang="zh">
文章总结了CSS3最新的50个教程。CSS3呼之欲出，对于前端设计师来说，需要赶紧给自己充充电。虽然短期实用性不大，可是对于个别属性的支持，还是很有希望的。
</div>
<p><a href="http://www.dzinepress.com/2010/03/50-excellent-tutorials-for-web-development-using-css3/" class="external digest-continue more-link">Read More</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/03/23/50-excellent-tutorials-for-web-development-using-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to CSS3(Updated)</title>
		<link>http://pagetalks.com/2008/09/10/introduction-to-css3.html</link>
		<comments>http://pagetalks.com/2008/09/10/introduction-to-css3.html#comments</comments>
		<pubDate>Wed, 10 Sep 2008 09:00:56 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[Color]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=110</guid>
		<description><![CDATA[这篇文章翻译自Design Shack的同名文章，感谢作者的优秀作品。The Englishi version of this article is available on Design Shack, and my article is only a tanslation of original text. Thanks to their perfect work. 这篇文章是目前... ]]></description>
			<content:encoded><![CDATA[<p><span class="impNotice">这篇文章翻译自<a href="http://designshack.co.uk/tutorials/introduction-to-css3-part-1-what-is-it">Design Shack的同名文章</a>，感谢作者的优秀作品。<br />The Englishi version of this article is available on <a href="http://designshack.co.uk/tutorials/introduction-to-css3-part-1-what-is-it">Design Shack</a>, and my article is only a tanslation of original text. Thanks to their perfect work.</span></p>
<p>这篇文章是目前少数一些介绍即将取代CSS2的新标准——CSS3的文章。我们将从非常基础的东西开始讲解，即使你对CSS3毫无了解，读完了之后相信也能很好的介绍这些将被广泛使用的一些功能。</p>
<h3>什么是CSS3</h3>
<p>CSS3带来的一些改变，为你在创造新的具有冲击力的设计提供更多方法。这篇教程提供了一些关于这个新标准带给我们的一些可能性。</p>
<h3>模块</h3>
<p>CSS3的开发被分为不同的“模块”。之前的划分方法太过于庞大、复杂，以至于更新十分困难，所以它被打散，并且有所增添。其中的一部分模块包括：</p>
<ul>
<li>盒模型</li>
<li>列表模型</li>
<li>超链接的表现</li>
<li>语音模块</li>
<li>背景以及边框</li>
<li>文字效果</li>
<li>多栏布局</li>
</ul>
<p><a href="http://www.w3.org/Style/CSS/current-work" class="impLink">察看模块的完整列表</a></p>
<p><span id="more-110"></span></p>
<h3>开发日程</h3>
<p>包括SVG（可缩放矢量图型）、媒体查询和命名空间的一些模块已经完全开发完毕。其他的也会很快跟进。但是预测众多浏览器合适才能支持CSS3的新功能确实无比的困难。Safari的新版本已经支持了一些。</p>
<blockquote class="translatation-note"<p>准确的说想在近两年内完成对CSS3的大范围支持是不太可能的事情，因为微软向来不太支持标准化。FF和Safari的支持加起来也不到一半的用户量，对CSS3的推广不是决定性的。但是IE支持若干CSS3属性确实相当有可能的，例如IE8已经支持一些选择符语法。长期之内，我们还会和hacks打交道。</p>
</blockquote>
<h3>CSS3将如何影响我？</h3>
<p>CSS3能完全的向后兼容，这样我们就不用更改先用得设计。浏览器也会继续支持CSS2。</p>
<p>主要的冲击来自于新的选择符使用方法以及新的属性。这些能帮助我们实现一些新的功能（比如动画或渐变效果），或者改良现有设计（比如说使用列）。</p>
<p>这一系列文章的之后部分会介绍CSS3的一些模块以及他们的新功能。</p>
<h3>CSS3模块——边框</h3>
<p>用过CSS的人都知道border属性——它是一个构建内容结构、创造图片相框以及改善页面结构的好方法。CSS3将border属性提升到另一个高度，它允许使用渐变、圆角、阴影或图片来创造边框。我们来一一解说。</p>
<h4>圆角边框</h4>
<p>使用现在的CSS2完成圆角边框很困难，虽然有很多种可用的办法，可是没有一个是直接了当的。往往都涉及额外的图片。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/border_rounded.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/border_rounded.png" alt="" title="border_rounded" width="344" height="49" class="aligncenter size-full wp-image-112" rel="noDesc" /></a><br />
用CSS3创建圆角边框则非常简单，代码如下：</p>
<pre>.border_rounded {
background-color: #ddccb5;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 2px solid #897048;
padding: 10px;
width: 310px;
}
</pre>
<h4>渐变边框</h4>
<p>渐变边框用起来可以让内容看起来很显眼。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/border_gradient.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/border_gradient.png" alt="" title="border_gradient" width="348" height="55" class="aligncenter size-full wp-image-114" rel="noDesc" /></a><br />
这些代码有些复杂，要求你定义渐变中的每个颜色：</p>
<pre>.border_gradient {
border: 8px solid #000;
-moz-border-bottom-colors:#897048 #917953 #a18a66 #b6a488 #c5b59b #d4c5ae #e2d6c4 #eae1d2;
-moz-border-top-colors:  #897048 #917953 #a18a66 #b6a488 #c5b59b #d4c5ae #e2d6c4 #eae1d2;
-moz-border-left-colors: #897048 #917953 #a18a66 #b6a488 #c5b59b #d4c5ae #e2d6c4 #eae1d2;
-moz-border-right-colors:#897048 #917953 #a18a66 #b6a488 #c5b59b #d4c5ae #e2d6c4 #eae1d2;
padding: 5px 5px 5px 15px;
width: 300px;
}</pre>
<h4>容器的阴影</h4>
<p>目前来说给一个元素添加阴影是相当苦难能的。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/border_shadow.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/border_shadow.png" alt="" title="border_shadow" width="341" height="54" class="aligncenter size-full wp-image-115" rel="noDesc" /></a><br />
但在CSS中：</p>
<pre>.border_shadow {
-webkit-box-shadow: 10px 10px 5px #888;
padding: 5px 5px 5px 15px;
width: 300px;
}</pre>
<h4>边框图片</h4>
<p>边框图片是最有用的新增功能之一，我真的对人们将如何使用这个功能而感到好奇。CSS将有能你为你重复、伸展你选择的边框图片。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/border_image.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/border_image.png" alt="" title="border_image" width="339" height="95" class="aligncenter size-full wp-image-116" rel="noDesc" /></a><br />
CSS代码会和下面的这些类似（目前这些代码根据不同的浏览器将有所不同）：</p>
<pre>.border_image {
-webkit-border-image: url(border.png) 27 27 27 27 round round;
}</pre>
<h3>CSS模块——字体</h3>
<p>字体无疑是设计排版时的一个重要方面。文字能引导读者穿越整个页面，留下某种印象，产生冲击力，或者其他一些微妙的效果。<br />
CSS目前已经在文字显示方面具备很多功能，但还是在某些方面限制了设计。CSS3正朝着减少这些限制的方向而努力。</p>
<h4>文字阴影</h4>
<p>字体阴影听起来并不是那么好，但这要看你怎么运用它。当我在为这篇文章做测试的时候，我发现有一些组合看起来很具有吸引力。阴影用在标题上是很不错的。<a href="http://www.kremalicious.com/2008/04/make-cool-and-clever-text-effects-with-css-text-shadow/">Matthias Kretschmann的BLOG</a>上面有一些很好的例子。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/text_shadow.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/text_shadow.png" alt="" title="text_shadow" width="315" height="47" class="aligncenter size-full wp-image-133"  rel="noDesc"/></a></p>
<pre>.text_shadow {
color: #897048;
background-color: #fff;
text-shadow: 2px 2px 2px #ddccb5;
font-size: 15px;
}
</pre>
<h4>文字换行</h4>
<p>目前，如果一个词太长以至于一行都装不下，它就会跨越边界，造成溢出。这个现象不是很常见，但偶尔也能遇到。新的文字换行功能将会强迫文字去换行，即使这会造成词语分裂。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/text_wrap.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/text_wrap.png" alt="" title="text_wrap" width="255" height="118" class="aligncenter size-full wp-image-132" rel="noDesc" /></a><br />
实现这个的代码是很简单的：</p>
<pre>.text_wrap {
word-wrap:  break-word;
}
</pre>
<h4>在线字体</h4>
<p>虽然这个严格地说不算是“字体效果”，但我们还是打算包含这一条。在线字体的使用能让浏览器自动的下载你指定的字体。这个改变对于网页设计将是革命性的，因为之前的设计都仅限于10到15种被广泛支持的字体。但是，这个新功能有可能造成一些版权的争议。</p>
<p>目前Safari的最新版本（3.1）是唯一支持在线字体的浏览器。Opera马上也会支持这个功能，其他的浏览器也会马上跟进。下面是实现这个功能的代码：</p>
<pre>@font-face {
font-family: 'Name of the new font';
src: url('http://www.designshack.co.uk/fonts/font.ttf');
}
</pre>
<p>目前已经有一些页面使用了这个功能。下面的例子就是CSS Zen Garden里面的页面，其作者是<a href="http://www.alistapart.com/articles/cssatten">A List Apart</a>。当然这个页面只能在某些浏览器里面正常显示：<br />
<a href="http://www.alistapart.com/d/cssatten/heid.html"><img src="http://pagetalks.com/wp-content/uploads/2008/09/text_webfonts1.jpg" alt="" title="text_webfonts1" width="250" height="252" class="alignnone size-full wp-image-134"  rel="noDesc" /></a><a href="http://www.alistapart.com/d/cssatten/poen.html"><img src="http://pagetalks.com/wp-content/uploads/2008/09/text_webfonts2.jpg" alt="" title="text_webfonts2" width="250" height="251" class="alignnone size-full wp-image-131"  rel="noDesc" /></a></p>
<h3>CSS模块——用户界面</h3>
<p>CSS3增加了很多关于用户界面方面的新属性，例如元素的尺寸伸缩、光标手势、轮廓(Outlining)、盒状布局(Box Layout)等等。我们将关注其中三个最重要的增强属性。</p>
<h4>缩放</h4>
<p>最新版的Safari是能够允许元素的缩放的。CSS3允许你将这个属性应用到任意元素，这将使缩放这个功能拥有跨浏览器的支持。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/ui_resizable.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/ui_resizable.png" alt="ui_resizable" title="ui_resizable" width="349" height="103" class="alignnone size-full wp-image-198" /></a></p>
<p>实现代码如下：</p>
<pre>.ui_resizable {
padding: 20px;
border: 1px solid;
resize: both;
overflow: auto;
}</pre>
<h4>盒尺寸(Box Sizing)</h4>
<p>关于CSS3的盒模型已经是属于本文的扩展领域了，完整的信息你可以到<a href="http://www.w3.org/TR/CSS2/box.html">官方站点</a>找到。就单独盒尺寸这个方面来说，它能够让你定义元素以何种方式填充一个容器。举例来说，如果你想将两个有边框的盒子（译者注：即通常概念下按照盒模型计算的容器）毗邻的紧紧的卡在另一个容器内，你就可以通过设置&#8221;box-sizing&#8221;为&#8221;border-box&#8221;。这个值将强迫浏览器把padding和border的宽度放在盒子的内部（译者注：即不会向外”扩张“了）。<br />
<a href="http://pagetalks.com/wp-content/uploads/2008/09/ui_boxsizing.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/ui_boxsizing.png" alt="ui_boxsizing" title="ui_boxsizing" width="341" height="91" class="alignnone size-full wp-image-199" /></a></p>
<p>目前，可能需要使用一些私有属性才能让所有浏览器都支持这个功能。这里给出一个很基本的例子：</p>
<pre>.area {/* 放置这两个盒子的容器  */
width: 300px;
border: 10px solid #ddccb5;
height: 60px;
}
.boxes {/* 应用属性的盒子 */
box-sizing: border-box;
width:50%;
height: 60px;
text-align: center;
border: 5px solid #897048;
padding: 2px;
float:left;
}</pre>
<h4>轮廓</h4>
<p>在CSS2里面我们已经能通过设置border属性给一个元素设置轮廓边框了，但是在CSS3我们可以通过设置一个数值而更方便地设置边框的偏移。同时，它和border属性有两点不同：</p>
<ul>
<li>轮廓是不占用控件的</li>
<li>轮廓不一定是矩形的</li>
</ul>
<p><a href="http://pagetalks.com/wp-content/uploads/2008/09/ui_outline.png"><img src="http://pagetalks.com/wp-content/uploads/2008/09/ui_outline.png" alt="ui_outline" title="ui_outline" width="236" height="144" class="alignnone size-full wp-image-200" /></a></p>
<p>你可以通过如下代码创建：</p>
<pre>
.ui_outline {
width: 150px;
padding: 10px;
height: 70px;
border: 2px solid black;
outline: 2px solid #897048;
outline-offset: 15px;
}
</pre>
<p><span class="impNotice">这篇文章并完成，近日将有更新！</span></p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2008/09/10/introduction-to-css3.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
