<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Vacuous Virtuoso &#187; CSS</title>
	<link>http://lipidity.com</link>
	<description>Despotic Development</description>
	<pubDate>Wed, 02 Apr 2008 14:18:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>FancyForm - Pretty checkboxes and radios</title>
		<link>http://lipidity.com/web/javascript-checkbox-radio-replacement/</link>
		<comments>http://lipidity.com/web/javascript-checkbox-radio-replacement/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 09:16:36 +0000</pubDate>
		<dc:creator>Ankur</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://dev.lipidity.com/feature/javascript-checkbox-radio-replacement</guid>
		<description><![CDATA[Styling form controls has always been limited with HTML and CSS. Not anymore. FancyForm provides the solution by letting you style checkboxes and radio buttons as you would any other elements, while degrading gracefully on older and non-graphical browsers.



Here&#8217;s an example of what&#8217;s possible with the script:



Not only does it let you style the checkboxes, [...]]]></description>
			<content:encoded><![CDATA[<p>Styling form controls has always been limited with HTML and CSS. Not anymore. <a href="http://dev.lipidity.com/fancy-form/">FancyForm</a> provides the solution by letting you style checkboxes and radio buttons as you would any other elements, while degrading gracefully on older and non-graphical browsers.</p>

<!--more-->

<p>Here&#8217;s an example of what&#8217;s possible with the script:</p>

<p class='centre'><img src="http://lipidity.com/images/fancy-20070828-190448.png" title="FancyForm styled checkboxes, before and after" alt="[styled checkboxes]" /></p>

<p>Not only does it let you style the checkboxes, you can also add your own custom JavaScript hooks, events, effects and a whole lot more.</p>

<p><a href="http://dev.lipidity.com/fancy-form/">Find out more</a> and please let me know of any bugs or possible ideas, or jump straight to <a href="http://dev.lipidity.com/fancy-form/demo/">the demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lipidity.com/web/javascript-checkbox-radio-replacement/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Make the most of the iPhone SDK</title>
		<link>http://lipidity.com/apple/iphone-webkit-css-3/</link>
		<comments>http://lipidity.com/apple/iphone-webkit-css-3/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 02:00:11 +0000</pubDate>
		<dc:creator>Ankur</dc:creator>
		
		<category><![CDATA[Apple]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[iPhone]]></category>

		<category><![CDATA[Mac]]></category>

		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://dev.lipidity.com/apple/make-the-most-of-the-iphone-sdk</guid>
		<description><![CDATA[<img src="http://dev.lipidity.com/wp-content/uploads/2007/06/safari.jpg" alt="Safari" title="Safari icon" class="fright" />
The iPhone, like Safari and many other browsers, runs on WebKit, which is one of the most blazing fast, powerful, standards-compliant rendering engine ever. Although there is no official Cocoa API for iPhone app development, it's not like we have nothing to work with. Writing web apps for the iPhone will be a pretty good experience for two reasons:

<ol>
<li>We don't have to worry about IE support when writing our web app</li>
<li>WebKit is amazing.</li>
</ol>

Highlighted below are ten CSS rules that make WebKit extra-great. <strong>Many of the previews require a WebKit-based browser like Safari, OmniWeb or Shiira.</strong><br />
<br />]]></description>
			<content:encoded><![CDATA[<h2>WebKit and <abbr title="Cascading Stylesheets">CSS</abbr></h2>

<h3>1. Native Controls</h3>

<p>A feature unique to the later versions of WebKit is the ability to style form controls. For a long time, the form inputs were kept as the operating system&#8217;s native controls, but now they are specifically styled that way. This means, we can easily over-ride that styling, or make elements appear like native controls.</p>

<p>Take a look at these text inputs:</p>

<div class="example">
<input type="text" value="I am a text input" />
<input type="text" style="-webkit-appearance:searchfield;" value="Me too, but I am round" />
<input type="search" value="I am a proper search input" />
</div>

<p>If you&#8217;re running a WebKit-based browser like Safari, you&#8217;ll see the first text input as a normal OS X-style
control, but the second one is a rounded control (like the search input minus the cancel widget).</p>

<p>Now look at these anchors:</p>

<div class="example">
<a href="#top">Go to top</a>
<a href="#top" style="-webkit-appearance:push-button;text-decoration:none;color:black">Go to top</a>
</div>

<p>Both are <code>&lt;a&gt;</code> tags, but the second one appears as a push-button in Safari.</p>

<p>That&#8217;s not all. Here are two button inputs:</p>

<div class="example">
<input type="button" value="I do nothing" />
<input type="button" value="I do nothing" style="-webkit-appearance:square-button" />
</div>

<p>Notice how the second button is a square button?</p>

<p>Have I caught your interest? Here&#8217;s how you do it.</p>

<h4>Mimic native widgets / controls</h4>

<p>Elements are styled to look like native controls for WebKit-based browsers using the <code>-webkit-appearance</code> <abbr title="Cascading Stylesheets">CSS</abbr> property. Some of the values this can take are (in two columns if you&#8217;re on WebKit):</p>

<div style="-webkit-column-count:2;-webkit-column-rule:1px solid rgba(0,0,0,0.1);">
<ul style="padding-left:2em">
<li>checkbox</li>
<li>radio</li>
<li>push-button</li>
<li>square-button</li>
<li>button</li>
<li>button-bevel</li>
<li>listbox</li>
<li>listitem</li>
<li>menulist</li>
<li>menulist-button</li>
<li>menulist-text</li>
<li>menulist-textfield</li>
<li>slider-horizontal</li>
<li>slider-vertical</li>
<li>sliderthumb-horizontal</li>
<li>sliderthumb-vertical</li>
<li>searchfield</li>
<li>searchfield-decoration</li>
<li>searchfield-results-decoration</li>
<li>searchfield-results-button</li>
<li>searchfield-cancel-button</li>
<li>textfield</li>
<li>textarea</li>
</ul>
</div>

<p>Setting <code>-webkit-appearance</code> simply makes the element appear as if it were the control. This could be of enormous use within WebViews inside Cocoa applications or with web apps for the iPhone.</p>

<p>If don&#8217;t have access to a WebKit-based browser, here&#8217;s a screenshot of what some of the &#8220;controls&#8221; look like:</p>

<p class="centre"><img class="feature" src="http://dev.lipidity.com/wp-content/uploads/2007/06/webkit-controls.png" alt="Webkit Controls" title="WebKit OS X Native Controls or Widgets" /></p>

<p>The important thing to note is that although the controls can be made to look like other controls using <code>-webkit-appearance</code>, their function is not affected. That is, textboxes will still accept text when they&#8217;re made to appear like <code>push-button</code> and so on.</p>

<h3>2. Element Drag</h3>

<p><ins class="block"><a href="http://fettig.net/weblog/2007/06/29/a-few-iphone-safari-notes/">Apparently</a> dragging doesn&#8217;t work with the iPhone, as it&#8217;s used for scrolling. That&#8217;s to be expected, I guess.</ins></p>

<p>Generally there is a lot of javascript involved in making an element draggable. Now you can achieve the same thing with only one line of <abbr title="Cascading Stylesheets">CSS</abbr>. Javascript will still be required to have drop targets, etc. but this allows the user to drag the entire element rather than just text or an image.</p>

<p>Try dragging this element (from the side):</p>

<div class="example" style="-webkit-appearance:push-button;-webkit-user-drag:element;-webkit-user-select:ignore">Drag me if you dare</div>

<p>Notice how the whole element is dragged? It&#8217;s just a regular <code>div</code> (made to act as a push-button) with the <abbr title="Cascading Stylesheets">CSS</abbr> rule <code>-webkit-user-drag:element</code> applied to it. Easy!</p>

<h3>3. Edit the webpage</h3>

<p><ins class='block'>Doesn&#8217;t work on the iPhone. You can click in the element, but the keyboard doesn&#8217;t show up. This is likely to work when there are copy-paste functions in the phone.</ins></p>

<p class="feature" style="-webkit-user-modify:read-write-plaintext-only">
This is a paragraph that you can edit if you&#8217;re running a WebKit-based browser like Safari or the iPhone. Just click here and edit the text like a normal textbox.
</p>

<p>To allow users to edit elements of the page (or all of it) in real time, there exists a property <code>-webkit-user-modify</code>. Obviously this defaults to read-only, but you can set it to the following:</p>

<ul>
<li>read-only</li>
<li>read-write</li>
<li>read-write-plaintext-only</li>
</ul>

<p><code>read-write</code> allows the user to copy and paste in <strong>rich</strong> <em>text</em> with formatting, while <code>read-write-plaintext-only</code> pastes in only the text. This could be useful with debugging or as part of a <abbr title="What You See Is What You Get">WYSIWYG</abbr> editor, etc. Just be careful with the security side of things.</p>

<h3>4. Selection (Highlighting)</h3>

<p style="-webkit-user-select:ignore" class="feature">I am a paragraph that you can&#8217;t select (if you&#8217;re running Safari). Try and highlight me and realize that your attempts are futile. Bwah, ha ha&#8230;</p>

<p>To disallow selection (highlighting) of text for a particular element, set the <abbr title="Cascading Stylesheets">CSS</abbr> rule <code>-webkit-user-select:ignore</code>. This may be useful for many web apps, but use it sparingly to avoid irritating the user.</p>

<p class="feature selection_hilite">I am a paragraph that you can select. If your browser supports the `::selection` selector, highlighting this will result in a black background and white text for the highlighted region.</p>

<h3>5. Rounded corners</h3>

<p><big class='example' style='-webkit-border-radius:6px; border:1px solid #000;'>
Rounded corners: Look, no hacks!
</big></p>

<p><code>-webkit-border-radius</code> specifies the radius of the corners. You can specify certain corners only by using one of</p>

<ul>
<li>-webkit-border-top-left-radius</li>
<li>-webkit-border-top-right-radius</li>
<li>-webkit-border-bottom-left-radius</li>
<li>-webkit-border-bottom-right-radius</li>
</ul>

<p>For example, the following has the top-right and bottom-left corners set to a radius of 7px:</p>

<p><big class='example' style='-webkit-border-top-right-radius:7px;-webkit-border-bottom-left-radius:7px;border:1px solid #000;'>
A bit of fancy corner-work
</big></p>

<p>Elliptical corners are possible by specifying two values, eg. <code>-webkit-border-radius: 3px 7px;</code>.</p>

<h3>6. Shadows</h3>

<h4>text-shadow</h4>

<p><big class='example' style='color:#FFF;text-shadow:2px 2px 2px #000;'>
This text has a shadow when viewed with a compliant browser.
</big></p>

<p>For the text-shadow <abbr title="Cascading Stylesheets">CSS</abbr> property, the parameters are</p>

<ol>
<li>horizontal offset (negative is to the left)</li>
<li>vertical offset (negative is up)</li>
<li>blur radius (higher is more blurred)</li>
<li>shadow color</li>
</ol>

<p>For example, using <code>text-shadow: 1px 1px 7px #000;</code> we get:</p>

<p><big class='example' style='color:#fff;text-shadow:1px 1px 7px #000;'>
this excellent text with a blurred, but visible shadow.
</big></p>

<h4>box-shadow</h4>

<p><big class='example' style='-webkit-box-shadow:1px 1px 7px #000;'>
This entire element has a shadow using -webkit-box-shadow:
</big></p>

<p>To add a shadow to the actual element rather than just the text, use <code>-webkit-box-shadow</code>. Parameters are the same as for the <code>text-shadow</code> property.</p>

<ol>
<li>the horizontal offset</li>
<li>the vertical offset</li>
<li>the blur radius</li>
<li>shadow color</li>
</ol>

<p>The shadow automatically compensates for any rounded corners you may have added.</p>

<p><big class='example' style='-webkit-box-shadow:1px 1px 7px #000;-webkit-border-radius:5px;'>
This element has a shadow, but also a border-radius.
</big></p>

<h4>text-stroke</h4>

<p><big class='example' style='-webkit-text-fill-color:yellow;-webkit-text-stroke:1px black;'>
I guess I&#8217;m really just a string of text. Oh, I&#8217;m stroked.
</big></p>

<p>Use <code>-webkit-text-stroke</code> to set a border or stroke around the text. Specify thickness and color.</p>

<p>To change the fill color, use -webkit-text-fill-color; otherwise value for the color property is used.</p>

<h3>7. Backgrounds</h3>

<p>WebKit allows multiple background images using <abbr title="Cascading Stylesheets">CSS</abbr>. If you&#8217;re running Safari or other WebKit-based browser, see <a href="http://www.decaffeinated.org/archives/projects/multibg/background-image.html">this great example</a> of multiple background images with <abbr title="Cascading Stylesheets">CSS</abbr>.</p>

<p>The syntax for multiple backgrounds:</p>

<pre><code>  background-image:    url("first-img"), url("second-img"),
                       url("other-img"), url("another-img");
  background-repeat:   no-repeat, no-repeat,
                       repeat-y, repeat-x;
  background-position: top left, top right,
                       left, top;
</code></pre>

<p>The first image is associated with the first background-repeat, and the first background-position value and so on. The order in which the images appear also determines the stacking order - earlier images are stacked higher.</p>

<p>Shorthand background notation also works, the example above is equivalent to:</p>

<pre><code>background: url("first-img") top left no-repeat,
            url("second-img") top right no-repeat,
            url("other-img") left repeat-y,
            url("another-img") top repeat-x;
</code></pre>

<p>This could be really handy with making the background of a web-app, such as for the iPhone, without the need for multiple nested elements.</p>

<h3>8. Border Image</h3>

<p>To set fancy borders, you often need to use images. However, you can do away with all the javascript and <abbr title="Cascading Stylesheets">CSS</abbr> hacks and use <code>-webkit-border-image</code>.</p>

<p>Syntax:</p>

<pre><code>-webkit-border-image: url("image-url") size fit fit;
</code></pre>

<p>&#8220;image-url&#8221; needs to be an image divided into nine parts for each corner and edge and the content. The size is the height / width of the squares that the image is divided into. Fit can be <code>round</code> or <code>stretch</code>, which are ways of fitting the image into the border. To show the border, you need to actually have a <code>border</code> rule, but that can be integrated into the border-image by using something like:</p>

<pre><code>-webkit-border-image: url("image-url") 27 / 27px round round;
</code></pre>

<p>The <code>/ 27px</code> bit specifies the width of the border and makes it show if it isn&#8217;t already.</p>

<h3>9. Resizing</h3>

<p><big class='example' style="border:1px solid;resize:both;overflow:auto;max-width:100%">
This element is actually resizable.<br />If you&#8217;re using a compatible browser, drag the handle at the bottom right to resize this box.<br />Max-width is restricted to 100%.
</big></p>

<p>Making an element resizable is really easy: just set the <code>resize</code> property to <code>vertical</code>, <code>horizontal</code> or <code>both</code>.</p>

<p><big class='example' style="border:1px solid;resize:horizontal;overflow:auto;max-width:100%">
This box can only be resized horizontally (along the x-axis)
</big></p>

<p>To make scrollbars appear when the content doesn&#8217;t fit completely inside the box, it&#8217;s a good idea to set <code>overflow:auto;</code>.</p>

<p>Restrict the size that an element can be resized to by setting <code>min-width</code>, <code>min-height</code>, <code>max-width</code> and / or <code>max-height</code>.</p>

<h3>10. Colors and Opacity</h3>

<p><big class='example' style="background-color: hsla(100,90%,50%,0.6);">I am a-hued, a-saturated, and a-alpha-ed.</big></p>

<p>Colors can be set using <code>rgb(red, green, blue)</code>, <code>rgba(red, green, blue, alpha)</code>, <code>hsl(hue, saturation, lightness)</code> or <code>hsla(hue, saturation, lightness, alpha)</code>.</p>

<p>The example above has the rule <code>background-color: hsla(100,90%,50%,0.6);</code>.</p>

<hr />

<div class='example' style="background-color: black; opacity: 0.5; color: white"><big>
Easily set opacity. This element has a black background, but an alpha value of 0.5.<br />
<span style='color: yellow'>Opacity is inherited by any child elements.</span>
</big></div>

<p>Set <code>opacity</code> as a number between 0 (completely transparent) and 1 (completely opaque). If you don&#8217;t want the opacity to be inherited by child elements, set the background color using rgba or hsla and specify the alpha value there.</p>

<h2>Further reading:</h2>

<ul>
<li><a href="http://qooxdoo.org/documentation/general/webkit_css_styles">http://qooxdoo.org/documentation/general/webkit_css_styles</a></li>
<li><a href="http://www.css3.info">http://www.css3.info</a></li>
<li><a href="http://andybudd.com/presentations/css3">http://andybudd.com/presentations/css3</a></li>
</ul>

<p><style type="text/css">
    .example {
        display: block;
        padding: 3px;
        text-align: center;
    }
    .selection_hilite::selection {
        background: rgba(2, 2, 2, 0.8);
        color: white;
    }
</style></p>
]]></content:encoded>
			<wfw:commentRss>http://lipidity.com/apple/iphone-webkit-css-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS Style guide generator</title>
		<link>http://lipidity.com/web/css-style-guide-generator/</link>
		<comments>http://lipidity.com/web/css-style-guide-generator/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 08:37:18 +0000</pubDate>
		<dc:creator>Ankur</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dev.lipidity.com/dev/css-style-guide-generator</guid>
		<description><![CDATA[For a web designer, remembering the properties of all the CSS classes, IDs and elements that have been written, often over multiple stylesheets, can be a real task. Often developers need to keep referring back to their CSS to check the definitions, look at the properties and classes and find the right element. This is time wasted. Time that could be spent on more constructive endeavours.]]></description>
			<content:encoded><![CDATA[<p><a href="http://dev.lipidity.com/wp-content/uploads/2007/03/cssedit.png" style="border: 1px solid #cccccc; margin: 5px; padding: 5px; float: left" title="CSSEdit shot" rel="lightbox"><img src="http://dev.lipidity.com/wp-content/uploads/2007/03/cssedit.thumbnail.png" alt="CSSEdit shot" /></a>MacRabbit&#8217;s CSSEdit eases the burden slightly by displaying a graphical representation of each CSS definition in the sidebar. This however, is still missing information on positioning, padding, margins, borders background images, background properties, font styles and various other vital pieces of data. Of course, it would be unreasonable to stipulate that kind of display in the application as it&#8217;s meant to be a CSS editor. Click on a definition on the left to bring up the full CSS.</p>

<p>But the web designer is not doomed to be eternally editing CSS. The HTML needs to be written as much as the styles, and it&#8217;s really very obtrusive and awkward to have to search through your CSS to see what a particular class or ID looks like. Which where style guides come into play.</p>

<p>A style guide is critical for any designer undertaking a project of a decent size. Not only does it help you remember your classes if you&#8217;re working on multiple projects or if it&#8217;s been a while, it&#8217;s also a great way to  get instantaneous updates, and easy cross-browser rendering to see what your styles look like in different browsers. A style guide will also benefit any other person working on the same website who may not be familiar with the styles you have created.</p>

<p>The benefits of having a style guide are numerous, and fairly obvious (Refer to <a href="http://72.14.253.104/search?q=cache:http://www.willjessup.com/?p=25">this article</a>), but often the time and effort taken to write up a style guide can be a deterrent. Not any more.</p>

<h1 style="text-align: center"><a href="http://dev.lipidity.com/styled/" title="CSS Style guide generator"><span style="color: #8000ff; margin-right: 3px">style</span><span style="color: #0080ff">say</span></a></h1>

<p><a href="http://dev.lipidity.com/styled/" title="CSS Style guide generator"><span style="color: #8000ff; margin-right: 2px">style</span><span style="color: #0080ff">say</span></a> is, to my knowledge, the first ever style guide generator, and it couldn&#8217;t be easier to use. It&#8217;s been written with a single, clear goal in mind - to provide designers with a resource from which CSS style guides can be created quickly, and with minimal effort.</p>

<p>Currently, <a href="http://dev.lipidity.com/styled/" title="CSS Style guide generator"><span style="margin-right: 2px">style</span><span>say</span></a> is still being developed, but the feature-set is now near enough to completion that it does its job. There is no syntax to learn; <a href="http://dev.lipidity.com/styled/" title="CSS Style guide generator"><span style="margin-right: 2px">style</span><span>say</span></a> recognizes CSS elements, classes and IDs, so you can copy and paste portions straight from your stylesheet. For the moment, the default text includes some basic documentation in the comments, but that will eventually be moved when the project goes final.</p>

<p>Would you find <a href="http://dev.lipidity.com/styled/" title="CSS Style guide generator"><span style="color: #8000ff; margin-right: 2px">style</span><span style="color: #0080ff">say</span></a> to be useful? Or are there any features that you would like to request?</p>
]]></content:encoded>
			<wfw:commentRss>http://lipidity.com/web/css-style-guide-generator/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
