Archive for the ‘业界相关’ Category

CSS 妙用(The Skinny on CSS Attribute Selectors)

by: Chris Coyier


CSS has the ability to target HTML elements based on any one of their attributes. You probably already know about classes and IDs. Check out this bit of HTML:

<h2 id="title" class="magic" rel="friend">David Walsh</h2>

This single element has three attributes: ID, class, and rel. To select the element in CSS, you could use and ID selector (#first-title) or a class selector (.magical). But did you know you can select it based on that rel attribute as well? That is what is known as an attribute selector:

h2[rel="friend"] { /* woohoo! */ }

There is a lot more to attribute selectors though, so let’s look closer at all the different options and try to cover some “real world” scenarios on when they might be useful.


Attribute Exactly Equals Certain Value

In the example we used above, the attribute of the h2 element was “friend”. The CSS selector we wrote targeted that h2 element because it’s rel attribute was exactly “friend”. In other words, that equals sign means just just what you think it does… an exact match. See another basic example:

<h1 rel="external">Attribute Equals</h1>
h1[rel="external"] { color: red; }

A great real world example of this is styling a blogroll. Let’s say you had a list of links to friends sites like this:

<a href="">Jeff Starr</a> <a href="">David Walsh</a> <a href="">Richard Felix</a>

Then you wanted to style each link slightly differently. The traditional way would probably be to give each link a class name in which to target, but that requires additional markup which is always a nice thing to avoid (semantics and all). Another way might be to use :nth-child, but that requires their order to never change. This is the perfect use for attribute selectors… the links already have a unique attribute in which to target!

a[href=""] { color: red; }

I believe the most common use of regular attribute selectors is on inputs. There are text, button, checkbox, file, hidden, image, password, radio, reset, and submit (did I miss any?). All of them are <input>’s, and all of them are very different. So doing something like input { padding: 10px; } is a bad idea most of the time. It’s very common to see things like:

input[type="text"] { padding: 3px; } input[type="radio"] { float: left; }

It’s really the only way to get your hands on certain types of inputs without screwing up the others and without adding extra markup.

Note on Quotes: You can usually get away without using quotes in attribute selectors, like [type=radio], but the rules for omitting quotes are weird and inconsistent across actual browser implementations. So, best practice, just use quotes, like [type=”radio”]. It’s safer and always works.

Attribute Contains Certain Value Somewhere

This is where it starts getting more interesting. The equals sign in attribute selectors may be prefaced by other characters which alter the meaning a bit. For example, “*=” means “match the following value anywhere in the attribute value.” Look at this example:

<h1 rel="xxxexternalxxx">Attribute Contains</h1>
h1[rel*="external"] { color: red; }

Remember that classes and ID’s are attributes too, and can be used used with attribute selectors. So let’s say you were writing CSS for a site where you couldn’t control the markup and a sloppy developer had three DIVs you need to target:

<div id="post_1"></div> <div id="post_two"></div> <div id="third_post"></div>

You could select them all with:

div[id*="post"] { color: red; }

Attribute Begins with Certain Value

<h1 rel="external-link yep">Attribute Begins</h1>
h1[rel^="external"] { color: red; }

A real world example of using this would be, say, that you wanted to style every single link to your friends site different than other links. Doesn’t matter if you are linking to their homepage or any subpage, any links to them you want to style up.

a[href^=""] { color: red; }

That will match a link to their homepage, but also any other subpages as well.

Attribute Ends with Certain Value

We can select based on how attribute values begin, why not end?

<h1 rel="friend external">Attribute Ends</h1>
h1[rel$="external"] { color: red; }

Honestly I struggle a bit to find the perfect real world example of using this, but I do like that it exists. Perhaps you could use it to look for links that end in characters that will likely have no significant effect:

a[href$="#"], a[href$=?] { color: red; }

Attribute is within Space Separated List

You probably already knew that you could apply multiple classes to elements right? Well if you do that, you can still use .class-name in CSS to target any one of them. Attribute selectors aren’t that easy. If your rel attribute has multiple values (e.g. values in a space separated list) you’ll need to use “~=”:

<h1 rel="friend external sandwich">Attribute Space Separated</h1>
h1[rel~="external"] { color: red; }

You might be thinking, why would I use this when *= would also match this and be more versatile? Indeed it is more versatile, but it can be too versatile. This selector requires the spaces around the value where as *= would not. So if you had two elements one with rel=home friend-link and one with rel=home friend link you are going to need the space-separated selector to target the second one properly.

Attribute is the start of a Dash Separated List

This will select if the start of a dash-separated list of attribute values matches the selector. Not particularly useful, since [attr^=value] also does that.

<h1 rel="friend-external-sandwich">Attribute Dash Separated</h1>
h1[rel|="friend"] { color: red; }

Multiple Attribute Matches

Vital to note is that you can use multiple attribute selectors in the same selector, which requires all of them to match for the selector itself to match.

<h1 rel="handsome" title="Important note">Multiple Attributes</h1>
h1[rel="handsome"][title^="Important"] { color: red; }

Browser Support

Every single example above works in all modern browsers: Safari, Chrome, Firefox, Opera, and IE. Internet Explorer has perfect support for all of these down to version 7, but zero support in 6. To test in your browser, see the test page. If the line/selector style is in red, it works.






重点是它完全使用ActionScript写的。除此之外它所用的ITVs现存的在他们的.com网站(上用的视频播放器,是用flex写的(有点小改动,例如控制器等)。我非常肯定在Android OS都还不存在的时候这个播放器就原创出来了而且它还可以用!


他们仅仅需要一个,也就是Flash Builder 4.5。



用Flash你可以建立从banners到复杂的手机引用到实时流媒体视频播放器到在LCD上的大型集团银行业务应用程序。除此之外,现在运行flash/air的设备数量数不胜数!三星的Smart TV运行的是AIR应用!更不用说设置盒子了。和最新的TV项目比如YouView一样是在Google TV的核心位置。我非常肯定将来会有更多设备和平台。


微软再出新招 Xbox360云游戏存储上线

微软游戏业务日前再出新招,该公司本周正式宣布推出其最新的Xbox 360云游戏存储功能,该功能最先是在2011年的E3游戏大展上首次公开展示的。微软全新推出的Xbox 360云游戏存储功能可以让用户通过云账户在云端服务器存储自己的游戏进度,从而实现在任何一台Xbox 360上访问自己游戏进度的目的,当然此前提是Xbox 360必须联网。

据透露,微软的Xbox 360云游戏存储功能目前已经正式推出,并且部分特定的Xbox Live Arcade游戏已经可以支持此功能,想想可以在任意一台Xbox 360游戏机上访问自己存储的游戏进度,这是不是相当令人兴奋呢?还记得曾经需要游戏卡、记忆卡以及SUB驱动器存储并携带游戏进度的日子吗?如今这一切即将结束,未来的游戏玩家将可以漫步云端轻装上阵。

微软未来数个月之内即将推出其全新的用户界面升级,而在本次升级之后,预计全新的Xbox 360云游戏存储功能将会针对整个Xbox 360游戏平台推出,届时此功能将覆盖全系列游戏。除了Xbox 360云游戏存储功能之外,未来微软游戏点,好友以及成就等内容也将支持存储到云端服务器,从而让用户可以更为方便地访问读取自己的游戏数据,总之未来的Xbox 360将会更方便更实用。

对于本次Xbox 360功能更新,微软方面发言人表示,“我们正致力于让您在任何时间于任何主机上更为方便地登入Xbox Live账户,并且访问您的游戏进度以及全部的资料。需要进行‘gamertag recovery’的日子已经一去不复返了,如今您所需要做的全部事情就是登入自己的云账号,不管您在哪里。”


微软在2月份的MWC 2011大会上曾表示,Windows Phone 7将支持Xbox 360体感外设Kinect,但是关于如何实现两者的整合 以及什么时候可以实现却没有做出过多的解释。今天,我们为大家带来一则微软提供的新视频,视频中演示了Windows Phone 7芒果与Kinect 的协作。


首先,视频中演示了“live tv”功能,当用户在Xbox 360上使用Windows Media Center观看直播电视的时候,Kinect会在一个节目即将结束时弹出一个通知:念出“Xbox Schedule”来获得收看提醒。当用户通过语音下达了“Xbox Schedule”的指令后,Kinect会将节目单添加到Windows Phone 7日历中,让你不会错过下一次的直播。

第二,视频演示了一种交互式广告。例如,当一则关于日本丰田的广告正在播放时,你可以通过“Xbox Near Me”语音指令来获取你附近的丰田汽车代理商,Xbox会显示Bing地图,地图中标识出离用户较近的丰田经销商,并且提供了发送Email或是短信功能,如果用户选择发送短信,那么Xbox就会直接跳转到WP7手机。




微软推出了一款名为微软Kinect for Xbox 360(简称Kinect)的游戏外围设备。相当于是微软的iPad,一款几乎无视对手的热门电子产品,成为发明创新领域最热门的设计平台。Kinect的应用使得在营销、医学、商业、计算机科学、娱乐以及机器人等很多领域的技术水平取得重大突破。

微软于去年11月推出了一款名为微软Kinect for Xbox 360(简称Kinect)的游戏外围设备。由于这款产品全新的用户界面集简单性、易用性和创新性于一体,目前已经卖出超过一千万套,成为有史以来销售速度最快的消费类电子产品。


这也可谓是微软的悲哀,因为微软常常为其产品投入上亿的营销资金,最后却只是被看成一个二线球员,比如微软开发的搜索引擎Bing和微软的手机操作系统Windows Phone 7。但Kinect却是一个例外,大家都喜欢它。Kinect现在相当于是微软的iPad,一款几乎无视任何竞争对手的热门电子产品。





一家名为ARDoor的俄罗斯公司发明一款名为‘AR Door Kinect试衣间’的店内“镜子”软件,顾客可以使用软件将衣服添加到自己身上,这样不必亲自试穿就可以快速浏览自己试穿不同服装的效果。



微软发布Kinect for Windows7 SDK Beta开发工具包

微软今天发布了运行在 Windows 7 环境的 Kinect SDK Beta(开发工具包),需要 Microsoft .NET Framework 4.0、Microsoft Visual Studio 2010,使用 C++, C#, VB 等开发语言。硬件要求是双核 2.66GHz CPU,至少 2GB 内存建议 4GB,支持 DirectX 9 的显卡。

Skeleton tracking image


引领网购革命 KinectShop再掀体感浪潮



引领网购革命 KinectShop再掀体感浪潮