<?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>Imagination &#187; CSS</title>
	<atom:link href="http://danyifeng.com/category/informatics/web/development/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://danyifeng.com</link>
	<description>Logic will get you from A to B. Imagination will take you everywhere.</description>
	<lastBuildDate>Sun, 01 Jan 2012 05:27:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pure CSS Speech Bubbles</title>
		<link>http://danyifeng.com/2010/03/18/pure-css-speech-bubbles/</link>
		<comments>http://danyifeng.com/2010/03/18/pure-css-speech-bubbles/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 22:01:35 +0000</pubDate>
		<dc:creator>小单</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[after]]></category>
		<category><![CDATA[bubbles]]></category>
		<category><![CDATA[content:]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[hgroup]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://danyifeng.com/?p=10865</guid>
		<description><![CDATA[今天要来学的列是这个《Progressive enhancement: pure CSS speech bubbles。Demo页面在这里。Progressive enhancement渐进增强 在《sliding label》 中有提到。这个概念真是无所不在啊，一定要好好掌握。 先看效果图， 今天学习的方法呢，还是copy html+css源码来分析 看别人是怎么写代码 怎么实现的 HTML5 structure—header, hgroup &#38; h1-h6 在.container 这个div里面出现了 下面的代码 &#60;header&#62; &#60;hgroup&#62; &#60;h1&#62;Pure CSS speech bubbles&#60;/h1&#62; &#60;h2&#62;By &#60;a href=&#34;http://nicolasgallagher.com&#34;&#62;Nicolas Gallagher&#60;/a&#62;&#60;/h2&#62; &#60;/hgroup&#62; &#60;p&#62;The demo page for &#60;a href=&#34;http://nicolasgallagher.com/progressive-enhancement-pure-css-speech-bubbles/&#34;&#62;Progressive enhancement: pure &#60;abbr&#62;CSS&#60;/abbr&#62; speech bubbles&#60;/a&#62;.&#60;/p&#62; &#60;p&#62;For a detailed explanation &#60;a href=&#34;bubbles.css&#34;&#62;view the &#60;abbr&#62;CSS&#60;/abbr&#62; file&#60;/a&#62;. It ]]></description>
			<content:encoded><![CDATA[<p>今天要来学的列是这个《<a href="http://nicolasgallagher.com/progressive-enhancement-pure-css-speech-bubbles/">Progressive enhancement: pure CSS speech bubbles</a>。Demo页面在<a href="http://nicolasgallagher.com/demo/pure-css-speech-bubbles/bubbles.html">这里</a>。Progressive enhancement渐进增强 在《<a href="http://danyifeng.com/2010/03/16/sliding-label/">sliding label</a>》 中有提到。这个概念真是无所不在啊，一定要好好掌握。</p>
<div id="attachment_10866" class="wp-caption aligncenter" style="width: 430px"><a href="http://danyifeng.com/wp-content/uploads/2010/03/basic-css-speech-bubbles.jpg" rel="lightbox[10865]"><img class="size-full wp-image-10866" title="basic-css-speech-bubbles" src="http://danyifeng.com/wp-content/uploads/2010/03/basic-css-speech-bubbles.jpg" alt="" width="420" height="255" /></a><p class="wp-caption-text">图1</p></div>
<p style="text-align: center;">先看效果图，<a href="http://danyifeng.com/wp-content/uploads/2010/03/complex-css-speech-bubbles.png" rel="lightbox[10865]"></a></p>
<div id="attachment_10867" class="wp-caption aligncenter" style="width: 430px"><a href="http://danyifeng.com/wp-content/uploads/2010/03/complex-css-speech-bubbles.png" rel="lightbox[10865]"><img class="size-full wp-image-10867" title="complex-css-speech-bubbles" src="http://danyifeng.com/wp-content/uploads/2010/03/complex-css-speech-bubbles.png" alt="" width="420" height="294" /></a><p class="wp-caption-text">图2</p></div>
<p>今天学习的方法呢，还是copy html+css源码来分析 看别人是怎么写代码 怎么实现的</p>
<h3>HTML5 structure—header, hgroup &amp; h1-h6</h3>
<p>在.container 这个div里面出现了 下面的代码</p>
<pre class="brush: xml; title: ;">
&lt;header&gt;
&lt;hgroup&gt;
&lt;h1&gt;Pure CSS speech bubbles&lt;/h1&gt;
&lt;h2&gt;By &lt;a href=&quot;http://nicolasgallagher.com&quot;&gt;Nicolas Gallagher&lt;/a&gt;&lt;/h2&gt;
&lt;/hgroup&gt;
&lt;p&gt;The demo page for &lt;a href=&quot;http://nicolasgallagher.com/progressive-enhancement-pure-css-speech-bubbles/&quot;&gt;Progressive enhancement: pure &lt;abbr&gt;CSS&lt;/abbr&gt; speech bubbles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For a detailed explanation &lt;a href=&quot;bubbles.css&quot;&gt;view the &lt;abbr&gt;CSS&lt;/abbr&gt; file&lt;/a&gt;. It is heavily commented.&lt;/p&gt;
&lt;p&gt;All examples use simple, semantic &lt;abbr&gt;HTML&lt;/abbr&gt;. No empty elements, no unnecessary extra elements, no JavaScript, no images (apart from that Twitter logo). Have a look at the source code.&lt;/p&gt;
&lt;/header&gt;
</pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">Div 里面出现了header tag， 还有HTML 5的新的元素, hgroup.</span></p>
<blockquote><p>The header element represents a group of introductory or navigational aids.<br />
Note A header  element is intended to usually contain the section&#8217;s heading (an h1–h6  element or an hgroup  element), but this is not required. The header  element can also be used to wrap a section&#8217;s table of contents, a search form, or any relevant logos</p>
<p>header元素代表了一组介绍的和导航辅助信息。</p>
<p>注意这里的header元素通常想要用来做section的标题（1个h1-h6元素或者一个hgroup元素），但是这并不是必须的，header元素也可以包括section的目录，搜索表单，或者任何相关的logo。</p></blockquote>
<p>(来自<a href="http://dev.w3.org/html5/spec-author-view/sections.html#the-header-element">HTML5 (Author Edition)</a>的解释)</p>
<p>hgroup 是一种header的特殊形式，必须包括切且只能包括一组(至少两个)h1-h6。这里有篇文章《<a href="http://oli.jp/2009/html5-structure2/">HTML5 structure—header, hgroup &amp; h1-h6</a>》详细讲，应该怎么用header，hgroup和h1-h6来做文章的结构。</p>
<h3>Drawing a bubble</h3>
<p>先介绍下对应图一的画法</p>
<p>HTML 代码</p>
<pre class="brush: xml; title: ;">&lt;p class=&quot;triangle-isosceles&quot;&gt;这是图一的例子&lt;/p&gt;</pre>
<p>Css的代码</p>
<pre class="brush: css; title: ;">
/* Bubble with an isoceles triangle
------------------------------------------ */
.triangle-isosceles {
	position:relative;
	padding:15px;
	margin:1em 0 3em;
	color:#000;
	background:#f3961c; /* default background for browsers without gradient support */

	/* css3 */
	-moz-border-radius:10px;
	-webkit-border-radius:10px;
	border-radius:10px;
	/* NOTE: webkit gradient implementation is not as per spec */
	background:-webkit-gradient(linear, left top, left bottom, from(#f9d835), to(#f3961c));
	background:-moz-linear-gradient(top, #f9d835, #f3961c);
	background:-o-linear-gradient(top, #f9d835, #f3961c);
	background:linear-gradient(top, #f9d835, #f3961c);
}

/* creates triangle */
.triangle-isosceles:after {
	content:&quot;&#92;&#48;0a0&quot;;
	display:block; /* reduce the damage in FF3.0 */
	position:absolute;
	z-index:-1;
	bottom:-30px; /* value = - border-top-width - border-bottom-width */
	left:50px; /* controls horizontal position */
	width:0;
	height:0;
	border-width:15px 15px; /* vary these values to change the angle of the vertex */
	border-style:solid;
	border-color:#f3961c transparent transparent;
}
</pre>
<p>从上面的代码可以看出， css分为两个部分 .triangle-isosceles用来画bubbles； .triangle-isosceles:after用来画三角。 作者的代码真的写的相当漂亮清晰哈。 用渐进增强的概念，先满足最基本的内容需求，然后加入css3才支持的圆角功能呢，和渐变的背景。然后用伪元素来画三角.</p>
<p>.triangle-isosceles：after的意思是在 triangle-isosceles之后插入内容。</p>
<p>content:&#8221;\00a0&#8243;的意思是插入空格，其实也就是占一个“坑”，至于这个坑长什么样子就要有border-width来决定了</p>
<p>bottom的值是负的（上边界和下边界的宽度和）。这个决定了“坑的位置”，靠近bubble</p>
<p>如果想要标准“坑”是三角的宽度和高度都要取0</p>
<p>上面的这些代码就可以画出下图</p>
<p style="text-align: center;"><a href="http://danyifeng.com/wp-content/uploads/2010/03/bubbles.png" rel="lightbox[10865]"><img class="aligncenter size-full wp-image-10876" title="bubbles" src="http://danyifeng.com/wp-content/uploads/2010/03/bubbles.png" alt="" width="398" height="79" /></a></p>
<p>其他例子可以见demo页面和css文件，自行研究哈</p>
n484]]></content:encoded>
			<wfw:commentRss>http://danyifeng.com/2010/03/18/pure-css-speech-bubbles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Letter press</title>
		<link>http://danyifeng.com/2010/03/15/letterpres/</link>
		<comments>http://danyifeng.com/2010/03/15/letterpres/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:16:56 +0000</pubDate>
		<dc:creator>小单</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[letterpress]]></category>

		<guid isPermaLink="false">http://danyifeng.com/?p=10828</guid>
		<description><![CDATA[今天在做一个网站的时候，想到要用类似Ps的logo这种效果。于是Google一下了解了一下用PS跟CSS分别怎么实现。 先介绍一下letterPress LetterPress在wikipedia上的解释是凸版印刷，SmashingMagazine上有一篇讲2009年web design趋势的文章《Web Design Trends For 2009》。 里面指出，LetterPress在设计中使用的很少，从2009年初开始，在产品设计跟网页设计领域出现了很多这样的设计。 Letterpress的效果，可以用PS跟CSS来实现。 先来看一些例子吧： Ps实现的 Apple的menu the 365 Days of Astronomy podcast CSS实现的 德国的一个设计公司的网站，他们的logo也很不错 我个人还是比较喜欢这个效果的，小细节的质感。 下面讲一下怎么实现 PS 在text的效果里面加上dropshadow，blend mode 调成normal， 颜色白色，透明度50%，角度90，见下图 这个是比较简单的Letterpress的PS实现，以后有空再加一些其他的实现方法。 CSS 用ps实现的网站很多，今天早上看Twitter上有人推madewithlove的网站，看了一下页面，全页面的Letterpress的效果，不太可能是图片替代，就firebug了。 然后发现时用text-shadow来实现的. ﻿&#60;shadow&#62; is defined as [ &#60;color&#62; ? &#60;length&#62;  &#60;length&#62;  &#60;length&#62; ? &#124; &#60;length&#62;  &#60;length&#62;  &#60;length&#62; ? &#60;color&#62; ? ], 前两个length是offset，第三个是blur radius. also applies to ]]></description>
			<content:encoded><![CDATA[<p>今天在做一个网站的时候，想到要用类似Ps的logo这种效果。于是Google一下了解了一下用PS跟CSS分别怎么实现。<br />
<strong>先介绍一下letterPress</strong><br />
LetterPress在wikipedia上的解释是凸版印刷，SmashingMagazine上有一篇讲2009年web design趋势的文章《<a href="http://www.smashingmagazine.com/2009/01/14/web-design-trends-for-2009/">Web Design Trends For 2009</a>》。 里面指出，LetterPress在设计中使用的很少，从2009年初开始，在产品设计跟网页设计领域出现了很多这样的设计。</p>
<p>Letterpress的效果，可以用PS跟CSS来实现。</p>
<p>先来看一些例子吧：</p>
<p>Ps实现的</p>
<p><strong>Apple的menu</strong><br />
<a href="www.apple.com"><img class="aligncenter size-full wp-image-10829" title="apple-menu" src="http://danyifeng.com/wp-content/uploads/2010/03/apple-menu.jpg" alt="" width="726" height="37" /></a></p>
<h3>the 365 Days of Astronomy podcast</h3>
<p><a href="http://365daysofastronomy.org/"><img class="aligncenter size-full wp-image-10830" title="365astronomy" src="http://danyifeng.com/wp-content/uploads/2010/03/365astronomy.jpg" alt="" width="326" height="276" /></a>CSS实现的</p>
<p>德国的一个设计公司的网站，他们的logo也很不错</p>
<p><a href="http://www.madewithlove.be/"><img class="aligncenter size-full wp-image-10831" title="madewithlove" src="http://danyifeng.com/wp-content/uploads/2010/03/madewithlove.jpg" alt="" width="569" height="501" /></a></p>
<p><a href="http://www.showandtellsale.com/"><img class="aligncenter size-full wp-image-10832" title="showandtellsale" src="http://danyifeng.com/wp-content/uploads/2010/03/showandtellsale.jpg" alt="" width="462" height="101" /></a></p>
<p>我个人还是比较喜欢这个效果的，小细节的质感。</p>
<p>下面讲一下怎么实现</p>
<p><strong>PS</strong></p>
<p>在text的效果里面加上dropshadow，blend mode 调成normal， 颜色白色，透明度50%，角度90，见下图</p>
<p><a href="http://danyifeng.com/wp-content/uploads/2010/03/psway.jpg" rel="lightbox[10828]"><img class="aligncenter size-full wp-image-10833" title="psway" src="http://danyifeng.com/wp-content/uploads/2010/03/psway.jpg" alt="" width="499" height="324" /></a>这个是比较简单的Letterpress的PS实现，以后有空再加一些其他的实现方法。</p>
<p><strong>CSS</strong></p>
<p>用ps实现的网站很多，今天早上看Twitter上有人推madewithlove的网站，看了一下页面，全页面的Letterpress的效果，不太可能是图片替代，就firebug了。 然后发现时用text-shadow来实现的.</p>
<p>﻿<em>&lt;shadow&gt; is defined as [ &lt;color&gt; ? &lt;length&gt;  &lt;length&gt;  &lt;length&gt; ? | &lt;length&gt;  &lt;length&gt;  &lt;length&gt; ? &lt;color&gt; ? ],</em></p>
<p>前两个length是offset，第三个是blur radius. also applies to the both::first-line and ::first-letter pseudo-element.</p>
<p>跟上图一样效果的话 是用下面这段代码实现</p>
<pre class="brush: css; title: ;">text-shadow: #EEE 0px 1px 0px;</pre>
<p>text-shadow是在css2中被引入，它并不被所有的浏览器支持，例如IE。 目前只有五类浏览器支持这个属性  Opera 9.5+, Safari 1.1+, Mozilla/Firefox 3.1+, Konqueror 3.4+ and iCab 3.0.3+.</p>
n353]]></content:encoded>
			<wfw:commentRss>http://danyifeng.com/2010/03/15/letterpres/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS&#124; css sprites</title>
		<link>http://danyifeng.com/2009/03/24/css-css-sprites/</link>
		<comments>http://danyifeng.com/2009/03/24/css-css-sprites/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 14:14:09 +0000</pubDate>
		<dc:creator>小单</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Notes]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">http://danyifeng.com/?p=10528</guid>
		<description><![CDATA[如之前所学， css sprites可以减少http的请求次数。 今天遇到以下两种情况利用sprites解决 1. 在form里面的 input type = image 的时候的 sprites（referentce 1.http://blog.josh420.com/archives/2008/07/using-sprite-images-with-input-typeimage-for-hover-effect.aspx） 把&#60;input type = image&#62;的语句放入一个 div中 如下 &#60;div id="submitButton"&#62; &#60;input type="image" src="xxx.png" /&#62; &#60;/div&#62; css 如下 #submitButton { cursor:pointer; /* Give it the hand cursor, like a link */ height:40px; /* Image has a height of 80px, only show the first half */ ]]></description>
			<content:encoded><![CDATA[<p>如之前所学， css sprites可以减少http的请求次数。 今天遇到以下两种情况利用sprites解决</p>
<p><strong>1. 在form里面的 input type = image 的时候的 sprites</strong>（referentce 1.<a href="http://blog.josh420.com/archives/2008/07/using-sprite-images-with-input-typeimage-for-hover-effect.aspx">http://blog.josh420.com/archives/2008/07/using-sprite-images-with-input-typeimage-for-hover-effect.aspx</a>）</p>
<p>把&lt;input type = image&gt;的语句放入一个 div中 如下</p>
<pre><span style="color: #ff0000;"><span class="kwd">&lt;</span><span class="tag">div</span> <span class="att">id</span>=<span class="kwd">"submitButton"</span><span class="kwd">&gt;</span>
  <span class="kwd">&lt;</span><span class="tag">input</span> <span class="att">type</span>=<span class="kwd">"image"</span> <span class="att">src</span>=<span class="kwd">"xxx.png"</span>  <span class="kwd">/&gt;</span>
<span class="kwd">&lt;/</span><span class="tag">div</span><span class="kwd">&gt;</span></span>

css 如下
<span style="color: #ff0000;"><span class="tag">#submitButton</span> {
  <span class="att">cursor</span>:<span class="kwd">pointer</span>;       <span class="cmt">/* Give it the hand cursor, like a link */</span>
  <span class="att">height</span>:<span class="kwd">40px</span>;          <span class="cmt">/* Image has a height of 80px, only show the first half */</span>
  <span class="att">overflow</span>:<span class="kwd">hidden</span>;      <span class="cmt">/* Hide the overflow */</span>
  <span class="att">width</span>:<span class="kwd">200px</span>;          <span class="cmt">/* Width of the image */</span>
}
<span class="tag">#submitButton</span>:<span class="tag">hover</span> <span class="tag">input</span> {
  <span class="att">margin-top</span>:<span class="kwd">-40px</span>;
<span class="cmt">/* Negative height of half the sprite, to push the image up */</span>
}
</span>

<strong>2. 在图片链接做hover的效果</strong>

<span style="color: #ff0000;">&lt;a href='#' class="Button"&gt;&lt;/a&gt;</span>

css如下
<span style="color: #ff0000;">a.wantButton{
    display:block;
    cursor:pointer;
    width:203px;
    height:52px;
    overflow:hidden;
    background:url(XXX.png)；
}</span>

<span style="color: #ff0000;">a.wantButton:hover {
    background-position:-204px 0;
}</span></pre>
n179]]></content:encoded>
			<wfw:commentRss>http://danyifeng.com/2009/03/24/css-css-sprites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

