<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Stupid but Useful CSS Tip</title>
	<atom:link href="http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/feed/" rel="self" type="application/rss+xml" />
	<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/</link>
	<description>技术任意</description>
	<lastBuildDate>Fri, 04 Dec 2009 04:36:16 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: rob</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1559</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Thu, 29 Mar 2007 14:49:39 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1559</guid>
		<description>&lt;p&gt;I wish attribute selectors were fully supported, but I know for sure they are not in IE.&lt;/p&gt;

&lt;p&gt;That&#039;s an ahead-of-your-time solution ;)&lt;/p&gt;

&lt;p&gt;I&#039;ve been wanting to use them for a long time to do stuff like input[type=&quot;checkbox&quot;].  I am pretty sure they are supported in Firefox and Safari (as are &#124;= and ~= I &lt;em&gt;think&lt;/em&gt;), so someday... someday...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I wish attribute selectors were fully supported, but I know for sure they are not in IE.</p>

<p>That&#8217;s an ahead-of-your-time solution ;)</p>

<p>I&#8217;ve been wanting to use them for a long time to do stuff like input[type="checkbox"].  I am pretty sure they are supported in Firefox and Safari (as are |= and ~= I <em>think</em>), so someday&#8230; someday&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ron Stewart</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1557</link>
		<dc:creator>Ron Stewart</dc:creator>
		<pubDate>Thu, 29 Mar 2007 03:34:17 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1557</guid>
		<description>&lt;p&gt;I don&#039;t know how widely this is supported, but what about using the matching capabilities of CSS to flag the links with something like this:&lt;/p&gt;

&lt;p&gt;a[href=&quot;newstuff.html&quot;] {
   styling...
}&lt;/p&gt;

&lt;p&gt;Any A element with an HREF attribute that matches the string (i.e., &quot;newstuff.html&quot; in this case) gets the styling applied. As long as you are consistent in setting up the link to the new stuff, all of your links to it should get the styling applied without you having to do anything else... in a perfect world, where all of the users you care about use a browser client that supports the CSS standard.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know how widely this is supported, but what about using the matching capabilities of CSS to flag the links with something like this:</p>

<p>a[href="newstuff.html"] {
   styling&#8230;
}</p>

<p>Any A element with an HREF attribute that matches the string (i.e., &#8220;newstuff.html&#8221; in this case) gets the styling applied. As long as you are consistent in setting up the link to the new stuff, all of your links to it should get the styling applied without you having to do anything else&#8230; in a perfect world, where all of the users you care about use a browser client that supports the CSS standard.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: rob</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1553</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Wed, 28 Mar 2007 17:56:51 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1553</guid>
		<description>&lt;p&gt;&quot;(the application isn’t totally in an MVC style framework at present so there are several places to update).&quot;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;(the application isn’t totally in an MVC style framework at present so there are several places to update).&#8221;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1552</link>
		<dc:creator>Bryan</dc:creator>
		<pubDate>Wed, 28 Mar 2007 17:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1552</guid>
		<description>&lt;p&gt;@Rob: What would prevent you from extending the class? The only thing I can think of would be the site&#039;s organization (too many file would have to be updated, etc) because you can use multiple classes on the same object. You could have your standard class and a new class.&lt;/p&gt;

&lt;p&gt;.standard {
   definitions
}
.new {
   definitions only for new items
}&lt;/p&gt;

&lt;p&gt;someObject class=&quot;standard new&quot;&lt;/p&gt;

&lt;p&gt;Then when the item isn&#039;t &quot;new&quot; anymore remove the space and new class from the object.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Rob: What would prevent you from extending the class? The only thing I can think of would be the site&#8217;s organization (too many file would have to be updated, etc) because you can use multiple classes on the same object. You could have your standard class and a new class.</p>

<p>.standard {
   definitions
}
.new {
   definitions only for new items
}</p>

<p>someObject class=&#8221;standard new&#8221;</p>

<p>Then when the item isn&#8217;t &#8220;new&#8221; anymore remove the space and new class from the object.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: rob</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1551</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Wed, 28 Mar 2007 16:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1551</guid>
		<description>&lt;p&gt;To clarify I was thinking something more along the lines of:&lt;/p&gt;

&lt;p&gt;newfeature { ... }&lt;/p&gt;

&lt;p&gt;.myforeverclass extends .newfeature {
... styleing ...
}&lt;/p&gt;

&lt;p&gt;(which is not possible) Then later remove the extends part. I mean, we could do this (which is what we do now)&lt;/p&gt;

&lt;p&gt;.myforeverclass { ... }&lt;/p&gt;

&lt;p&gt;.myforeverclass  { [the new feature addition parts] }&lt;/p&gt;

&lt;p&gt;but it would easier to just have all the styles in one class.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>To clarify I was thinking something more along the lines of:</p>

<p>newfeature { &#8230; }</p>

<p>.myforeverclass extends .newfeature {
&#8230; styleing &#8230;
}</p>

<p>(which is not possible) Then later remove the extends part. I mean, we could do this (which is what we do now)</p>

<p>.myforeverclass { &#8230; }</p>

<p>.myforeverclass  { [the new feature addition parts] }</p>

<p>but it would easier to just have all the styles in one class.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: rob</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1550</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Wed, 28 Mar 2007 16:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1550</guid>
		<description>&lt;p&gt;@Adam&lt;/p&gt;

&lt;p&gt;Yeah totally, but you still have to go to each place then and remove the &quot;newfeature&quot; class, which is more or less the same as just adding an img tag with the new graphic - which is what we were trying to avoid ;)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Adam</p>

<p>Yeah totally, but you still have to go to each place then and remove the &#8220;newfeature&#8221; class, which is more or less the same as just adding an img tag with the new graphic &#8211; which is what we were trying to avoid ;)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Ness</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1548</link>
		<dc:creator>Adam Ness</dc:creator>
		<pubDate>Wed, 28 Mar 2007 15:24:19 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1548</guid>
		<description>&lt;p&gt;@rob:
Sure, it&#039;s possible to extend a CSS class with another CSS class, like Ron was suggesting:&lt;/p&gt;

&lt;p&gt;In CSS:
.foo {
  font-weight: bold;
  font-family: Comic Sans, Eye-Gouge;
  font-size: 30em;
}&lt;/p&gt;

&lt;p&gt;.newfeature {
  background: url(/images/new.gif) no-repeat;
  padding-left: 30px;
}&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;foo &lt;b&gt;newfeature&lt;/b&gt;&quot;&gt;Some new feature&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This way you can just tack on the &quot;newfeature&quot; class to any tag on the page.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@rob:
Sure, it&#8217;s possible to extend a CSS class with another CSS class, like Ron was suggesting:</p>

<p>In CSS:
.foo {
  font-weight: bold;
  font-family: Comic Sans, Eye-Gouge;
  font-size: 30em;
}</p>

<p>.newfeature {
  background: url(/images/new.gif) no-repeat;
  padding-left: 30px;
}</p>

<p>&lt;span class=&#8221;foo <b>newfeature</b>&#8220;&gt;Some new feature&lt;/span&gt;</p>

<p>This way you can just tack on the &#8220;newfeature&#8221; class to any tag on the page.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: rob</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1547</link>
		<dc:creator>rob</dc:creator>
		<pubDate>Wed, 28 Mar 2007 14:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1547</guid>
		<description>&lt;p&gt;@Peter: That would be definitely be better, but sadly we have to support IE6 :-/&lt;/p&gt;

&lt;p&gt;@Ron: Good thoughts - I actually wasn&#039;t clear. The &quot;newfeature&quot; class in the example is really the name of the feature. So the CSS class wont get removed once the newnesss faded. I was using the generic name as an example.&lt;/p&gt;

&lt;p&gt;The class will still be need even after the feature isn&#039;t new for bold, underline, etc etc.  If this didn&#039;t need a specific class of it&#039;s own, we could still probably do it with a more complicated rule: div.sidebar, li, thing.newfeature { ... or whatever. But it just happened to work out in this instance.&lt;/p&gt;

&lt;p&gt;I like your idea of a generic newfeature class. It would be nice to extend a css class with the newfeature class then unextend when it wasn&#039;t needed anymore - I don&#039;t think that&#039;s possible though... hum...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Peter: That would be definitely be better, but sadly we have to support IE6 :-/</p>

<p>@Ron: Good thoughts &#8211; I actually wasn&#8217;t clear. The &#8220;newfeature&#8221; class in the example is really the name of the feature. So the CSS class wont get removed once the newnesss faded. I was using the generic name as an example.</p>

<p>The class will still be need even after the feature isn&#8217;t new for bold, underline, etc etc.  If this didn&#8217;t need a specific class of it&#8217;s own, we could still probably do it with a more complicated rule: div.sidebar, li, thing.newfeature { &#8230; or whatever. But it just happened to work out in this instance.</p>

<p>I like your idea of a generic newfeature class. It would be nice to extend a css class with the newfeature class then unextend when it wasn&#8217;t needed anymore &#8211; I don&#8217;t think that&#8217;s possible though&#8230; hum&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ron Stewart</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1546</link>
		<dc:creator>Ron Stewart</dc:creator>
		<pubDate>Wed, 28 Mar 2007 11:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1546</guid>
		<description>&lt;p&gt;Nice tip, Rob. Thinking ahead, though, and trying to think semantically -- both of which are always dangerous, I realize -- wouldn&#039;t it make more sense to leave the CSS alone and go remove the &quot;newFeature&quot; class from the links when the target is no longer new? That way when something else is new, the CSS is still there to support the presentation of new items, and it is just a matter of flagging links to new things with the appropriate additional class. And if your site is based on some sort of content management tool, just make the tool smart enough to include the &quot;newFeature&quot; class on links to pages that are new or updated...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice tip, Rob. Thinking ahead, though, and trying to think semantically &#8212; both of which are always dangerous, I realize &#8212; wouldn&#8217;t it make more sense to leave the CSS alone and go remove the &#8220;newFeature&#8221; class from the links when the target is no longer new? That way when something else is new, the CSS is still there to support the presentation of new items, and it is just a matter of flagging links to new things with the appropriate additional class. And if your site is based on some sort of content management tool, just make the tool smart enough to include the &#8220;newFeature&#8221; class on links to pages that are new or updated&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Boughton</title>
		<link>http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/comment-page-1/#comment-1545</link>
		<dc:creator>Peter Boughton</dc:creator>
		<pubDate>Wed, 28 Mar 2007 08:36:50 +0000</pubDate>
		<guid isPermaLink="false">http://robrohan.com/2007/03/27/stupid-but-useful-css-tip/#comment-1545</guid>
		<description>&lt;p&gt;The ideal way of doing this with CSS is not as a background image, but like this:&lt;/p&gt;

&lt;p&gt;.newfeature:after
{
 content: url(/images/new.gif)
}&lt;/p&gt;

&lt;p&gt;Allowing you much more control and flexibility than the background image method.&lt;/p&gt;

&lt;p&gt;Of course, this way doesn&#039;t work with IE6 (not sure about IE7?) so might not be possible for everyone.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The ideal way of doing this with CSS is not as a background image, but like this:</p>

<p>.newfeature:after
{
 content: url(/images/new.gif)
}</p>

<p>Allowing you much more control and flexibility than the background image method.</p>

<p>Of course, this way doesn&#8217;t work with IE6 (not sure about IE7?) so might not be possible for everyone.</p>]]></content:encoded>
	</item>
</channel>
</rss>
