<?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>BarneyBlog &#187; css</title>
	<atom:link href="http://www.barneyb.com/barneyblog/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Mon, 02 Mar 2020 13:20:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Base CSS Templates</title>
		<link>https://www.barneyb.com/barneyblog/2011/05/17/base-css-templates/</link>
		<comments>https://www.barneyb.com/barneyblog/2011/05/17/base-css-templates/#comments</comments>
		<pubDate>Tue, 17 May 2011 17:30:24 +0000</pubDate>
		<dc:creator>barneyb</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1679</guid>
		<description><![CDATA[After my Progressive Enhancement presentation at cf.objective last week, I had several people ask about baseline CSS that I use.Â  This sort of surprised me, since I figured at a developer conference CSS would kind of be glossed over (and I built my presentation with that bias).Â  That said, CSS is a fundamental aspect of [...]]]></description>
			<content:encoded><![CDATA[<p>After my <a href="http://www.barneyb.com/barneyblog/2011/05/12/cf-objective-progressive-enhancement/">Progressive Enhancement</a> presentation at <a href="http://www.cfobjective.com/">cf.objective</a> last week, I had several people ask about baseline CSS that I use.Â  This sort of surprised me, since I figured at a developer conference CSS would kind of be glossed over (and I built my presentation with that bias).Â  That said, CSS is a fundamental aspect of progressive enhancement, and I am pleased people are interested in as well.</p>
<p>I use a pair of primary CSS templates when I throw together a new application: <a href="http://www.barneyb.com/r/css_tabs.cfm">CSS Tabs</a> and <a href="http://www.barneyb.com/s/table_data.css">table.data</a>.</p>
<p>The former is a small snippet of CSS which will turn a UL of LIs into a nice tab bar.Â  It supports customizing size and colors, as well as stacking multiple bars with different horizontal alignment (left align main nav, right aligned 'help' and 'logout' tabs).Â  It is NOT a client-side tabber, it's strictly presentational enhancement of a list of normal server-side links.Â  You could certainly use JS to manipulate the classes on the LIs client-side, but it provides no functionality along those lines.</p>
<p>The latter is a simple starting point for styling data tables (which, by the way, should be the only type of tables you have).Â  By default it uses a yellow theme for alternating rows, but if you add the 'grey' class it'll flip to a greyscale approach.Â  It has support for subheadings, multi-column headings, numeric cells, and 'total' rows.</p>
<p>Both are really designed as a starting point for your application to get a base level of prettiness out of the box.Â  table.data, in particular, usually ends up being further enhanced by the application stylesheet, perhaps to add new cell types or a different color scheme.Â  I've attempted to make them easy to extend without having to modify the code directly, which will let you grab a new copy (in the case of bug fixes) and not lose any of your changes.Â  Remember, layers of enhancement is the mantra.</p>
<p>I also generally end up with a .box class, along with .box.error and .box.success variants.Â  But those are typically more bound to the application's specific look and feel, so I haven't generalized those out into a separate stylesheet.Â  They're more semantic markup conventions I try to use consistently across applications.</p>
<p>Finally, I posted about <a href="http://www.barneyb.com/barneyblog/2011/05/17/even-better-inline-progress-bars/">inline progress bars</a> last fall, which is a technique that has served me very well on several applications since then.Â  This is a hybrid JS/CSS technique, not pure CSS, but it's easily dropped into an existing application with the proper markup structures.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.barneyb.com/barneyblog/2011/05/17/base-css-templates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Even Better Inline Progress Bars</title>
		<link>https://www.barneyb.com/barneyblog/2011/05/17/even-better-inline-progress-bars/</link>
		<comments>https://www.barneyb.com/barneyblog/2011/05/17/even-better-inline-progress-bars/#comments</comments>
		<pubDate>Tue, 17 May 2011 17:29:18 +0000</pubDate>
		<dc:creator>barneyb</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1680</guid>
		<description><![CDATA[In the handful of months since I last posted about inline progress bars, I've made some enhancements to the mechanism. In particular, the original mechanism didn't handle overages very gracefully, and while overage isn't strictly needed for progress, I've ended up wanting the same inline display for other types of measurements (e.g., fundraising dollars against [...]]]></description>
			<content:encoded><![CDATA[<p>In the handful of months since I last posted about <a href="http://www.barneyb.com/barneyblog/2010/09/15/inline-js-progress-bars/">inline progress bars,</a> I've made some enhancements to the mechanism. In particular, the original mechanism didn't handle overages very gracefully, and while overage isn't strictly needed for progress, I've ended up wanting the same inline display for other types of measurements (e.g., fundraising dollars against a goal).</p>
<p>The JS has grown slightly more complicated, creating a richer structure to style to handle some of the new stuff:</p>
<pre>jQuery(".progress").each(function() {
  var $this = jQuery(this)
  var frac = parseFloat($this.attr("rel"))
  if (isNaN(frac)) {
    return // bad data
  }
  var html = $this.html();
  $this.empty()
    .append(''
      + '&lt;span class="container"&gt;'
        + '&lt;span class="status-text-spacer"&gt;' + html + '&lt;/span&gt;'
        + '&lt;span class="progress-bar" style="width:' + (frac * 100) + '%;"&gt;&lt;/span&gt;'
        + '&lt;span class="status-text" style="width:' + Math.max(100, frac * 100) + '%;"&gt;'
          + '&lt;span class="status-text-spacer"&gt;' + html + '&lt;/span&gt;'
        + '&lt;/span&gt;'
      + '&lt;/span&gt;'
    )
  if (frac &gt;= 1) {
    $this.addClass("overage") // strictly for external targetting
      .find(".container")
        .css({
          marginRight: (100 - 100 / frac) + "%",
          width: (100 / frac) + "%"
        })
  }
})</pre>
<p>The CSS is still about the same for the base functionality, but with the new stuff, it's far richer:</p>
<pre>.progress {
  display: inline-block;
  position: relative;
}
.progress .container {
  display: inline-block;
  position: relative;
  border: 1px solid #999;
  background-color: #f7f7f7;
  color: #f7f7f7;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  width: 100%;
}
.progress .container .progress-bar {
  display: inline-block;
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  height: 100%;
  filter: alpha(opacity=80); /* yeah IE! */
  opacity: 0.8;
  /* .neutral is the default */
  background-color: #ddd;
  border-right: 1px solid #666;
}
.progress.overage.neutral-overage .container .progress-bar {
  background-color: #ddd;
  border-right: 1px solid #666;
}
.progress.ok .container .progress-bar,
.progress.overage.ok-overage .container .progress-bar {
  background-color: #dfd;
  border-right: 1px solid #393;
}
.progress.error .container .progress-bar,
.progress.overage.error-overage .container .progress-bar {
  background-color: #fdd;
  border-right-color: #c66;
}
.progress .container .status-text {
  display: inline-block;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  color: #000;
  margin: 0;
  padding: 0;
}
.progress .container .status-text-spacer {
  margin: 0 5px;
}
</pre>
<p>So now instead of just doing this (which will render a neutral bar):</p>
<pre>&lt;span class="progress" rel="#raised / goal#"&gt;
  #dollarFormat(raised)# of #dollarFormat(goal)# raised...
&lt;/span&gt;
</pre>
<p>You can control the various presentation very granularly (red below 100% and green from 100% up):</p>
<pre>&lt;span class="progress <span style="color: #ff0000;">error ok-overage</span>" rel="#raised / goal#"&gt;
  #dollarFormat(raised)# of #dollarFormat(goal)# raised...
&lt;/span&gt;
</pre>
<p>The original version rendered green bars for everything, with this incarnation you can have neutral, ok, or error semantics for your bars.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.barneyb.com/barneyblog/2011/05/17/even-better-inline-progress-bars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple CSS Tabs</title>
		<link>https://www.barneyb.com/barneyblog/2010/03/30/simple-css-tabs/</link>
		<comments>https://www.barneyb.com/barneyblog/2010/03/30/simple-css-tabs/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 18:28:35 +0000</pubDate>
		<dc:creator>barneyb</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1397</guid>
		<description><![CDATA[I use tabs for navigation a lot.Â  Not for in-page DOM swapping, but for expressing a list of available pages along with indicating which on you're on.Â  Pretty much every tab "system" is centered around client-side manipulation, rather than just presenting server-generated markup.Â  And the few counter examples don't do it in an encapsulated way, [...]]]></description>
			<content:encoded><![CDATA[<p>I use tabs for navigation a lot.Â  Not for in-page DOM swapping, but for expressing a list of available pages along with indicating which on you're on.Â  Pretty much every tab "system" is centered around client-side manipulation, rather than just presenting server-generated markup.Â  And the few counter examples don't do it in an encapsulated way, they use a body selector, tab-id-specific styling, or whatever.Â  What I really wanted was to simply emit a UL with some LIs inside (one of them with class="active") and be done.Â  No muss, no fuss.</p>
<p>After faking it with ad hoc CSS in a number of apps I decided it was time to actually make a concerted effort to build a reusable mechanism for doing this.Â  So I did.</p>
<p><img class="aligncenter size-full wp-image-1399" title="css_tabs" src="http://www.barneyb.com/barneyblog/wp-content/uploads/2010/03/css_tabs.png" alt="" width="634" height="45" /></p>
<p>You can get the code as well as a demo and docs at <a href="http://www.barneyb.com/r/css_tabs.cfm">http://www.barneyb.com/r/css_tabs.cfm</a>.Â  Included is a form for customizing the colors and sizing of the tabs (since some of the values are used in multiple directives), and the CSS is emitted at the bottom (as well as into the document itself for styling the demos).</p>
<p>Note that this is <em>not</em> designed to be the be-all and end-all CSS tab solution.Â  It is designed to be a really lightweight and easy to use CSS tab solution.Â  Emphasis on simplicity.Â  Disemphasis on edge cases, backwards compatibility, and bells and whistles.Â  Firefox 3+, IE8+, and Chome all do fine.Â  I didn't test others.Â  IE7 and less fail spectacularly (though the navigation remains totally usable).Â  And mind your !DOCTYPE.</p>
<p>Finally, since I'm deliberately only styling the UL and LI, you can put whatever you want inside the LIs.Â  I'm already using this layout on a number of apps and while most have simple As inside the LIs, some of them are using icons and/or icons and text.</p>
<p>I don't know if that's useful to anyone else, but since it's been so helpful for me, I figured I'd share.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.barneyb.com/barneyblog/2010/03/30/simple-css-tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
