<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4843224028361594470</id><updated>2012-02-15T11:23:16.014-08:00</updated><category term='Image Captioning'/><category term='a href'/><category term='Descendants'/><category term='list-style-type'/><category term='Image Grid'/><category term='outside'/><category term='Unordered Lists'/><category term='HTML5 Rocks'/><category term='mysqli_num_rows'/><category term='Google Font'/><category term='border'/><category term='PHP sort'/><category term='Intermediate'/><category term='Barrel Distortion'/><category term='Apache'/><category term='IP Packet'/><category term='Caltech'/><category term='IPv6'/><category term='Eric Meyer'/><category term='RFC'/><category term='SSH'/><category term='CSS'/><category term='Javascript'/><category term='Network Address Translation'/><category term='Substring Matching Attribute Selector'/><category term='wf-inactive'/><category term='font-style'/><category term='Pseudo Element'/><category term='networking'/><category term='The Cascade'/><category term='-moz-border-radius'/><category term='Microsoft Security Essentials'/><category term='WIFI'/><category term='Life'/><category term='Array'/><category term='Firefox'/><category term='INSERT INTO'/><category term='Centering Images'/><category term='z-index'/><category term='IP Address'/><category term='Sessions'/><category term='Headings'/><category term='FAT32'/><category term='PNG Transparency Files'/><category term='Internet Explorer'/><category term='Modifying Blogger'/><category term='Webkit'/><category term='DIV'/><category term='Inline Element'/><category term='outline:none'/><category term='wf-active'/><category term='3 Column Layout'/><category term='Bob Parsons'/><category term='Microsoft'/><category term='gparted'/><category term='Cache'/><category term='hr'/><category term='Meddon'/><category term='Router'/><category term='CSS Resets'/><category term='Browsers'/><category term='Color Swatch'/><category term='Photoshop Action'/><category term='text-indent'/><category term='USB Device'/><category term='Browser Wars'/><category term='a:hover'/><category term='Notepad++'/><category term='Shared Hosting'/><category term='Particular Attribute Selector'/><category term='Transparency'/><category term='FOUT'/><category term='Pullqutoes'/><category term='mysqli_query'/><category term='Inheritance'/><category term='list marker'/><category term='Size an Image Using CSS'/><category term='watermark'/><category term='IE6'/><category term='td'/><category term='ASCII'/><category term='Secure Shell'/><category term='Parsing RSS Feed'/><category term='PHP'/><category term='Value Attribute Selector'/><category term='Google Chrome'/><category term='CSS Tutorials'/><category term='Unordered List'/><category term='Photoshop Circles'/><category term='CSS3'/><category term='Truncation'/><category term='Browser Internals'/><category term='Descendant Selector'/><category term='Tools'/><category term='Dedicated Server'/><category term='CSS visibility'/><category term='inline style'/><category term='Horizontal Bar Graph'/><category term='Blogger Template'/><category term='Form Element'/><category term='PHP Array of Arrays'/><category term='MYSQLI_ASSOC'/><category term='tbody'/><category term='overflow: hidden;'/><category term='Expand Widget Templates'/><category term='clear'/><category term='li'/><category term='display'/><category term='italic'/><category term='Scrolling Tables'/><category term='C'/><category term='Networking Driver'/><category term='CSS 3.0 Gradient'/><category term='Stu Nicholls'/><category term='PHP Syntax'/><category term='PHP if'/><category term='XAMPP'/><category term='Computing News'/><category term='HTTP'/><category term='Photoshop'/><category term='Foreign Keys'/><category term='nav'/><category term='IP Header'/><category term='Flash'/><category term='Sonet OC3'/><category term='UDP'/><category term='Form Tag'/><category term='Safari'/><category term='Google API'/><category term='IP'/><category term='top'/><category term='Specificity'/><category term='Escaping Characters in CSS'/><category term='Inserting Records into Database'/><category term='Rounded Corners'/><category term='jQuery'/><category term='display:block; Cookie Cutter Method'/><category term='IP Packets'/><category term='Inserting MySQL Records'/><category term='Anti-Virus Software'/><category term='mysqli_connect'/><category term='Crop an Image Using CSS'/><category term='Sprites'/><category term='Developer'/><category term='Padding and Margins'/><category term='first-child'/><category term='Transparent Border in Photoshop'/><category term='Protocol'/><category term='important'/><category term='-webkit-gradient'/><category term='background-image'/><category term='CSS Bar Graphs'/><category term='Photoshop Macro'/><category term='VPS'/><category term='Cookies'/><category term='Recipes'/><category term='Cufon'/><category term='line-height'/><category term='Google Maps'/><category term='Graph'/><category term='Cloud Hosting'/><category term='Twitter'/><category term='PHP in_array'/><category term='Dave Shea'/><category term='Favicon'/><category term='overflow:auto'/><category term='gutter'/><category term='TCP/IP'/><category term='Reset'/><category term='Windows Driver'/><category term='print_r'/><category term='Tweet'/><category term='Friends of Apache'/><category term='Embedded Styles'/><category term='HTTP Headers'/><category term='CSS3.0'/><category term='Faux Columns'/><category term='HTML Elements'/><category term='CSS Zen Garden'/><category term='CPU'/><category term='background'/><category term='Curl'/><category term='Websites'/><category term='User Style Sheet'/><category term='GraublauWeb'/><category term='Menu'/><category term='Virtual Private Server'/><category term='LAMP'/><category term='Internet'/><category term='list-style-image'/><category term='CSS Quote Property'/><category term='Tantek Celik'/><category term='Positioning Elements'/><category term='NexStar'/><category term='Definition Lists'/><category term='CSS 3.0 Transforms'/><category term='Drop Cap'/><category term='Blogspot'/><category term='Search'/><category term='API'/><category term='border-radius'/><category term='C#'/><category term='right-margin'/><category term=':before'/><category term='p element'/><category term='Blog Software'/><category term='Data Cells'/><category term='CSS 3.0 last-child'/><category term='E Ink'/><category term='article'/><category term='Primary Keys'/><category term='Pop-ups'/><category term='Compiler'/><category term='Ordered Lists'/><category term='-moz-linear-gradient'/><category term='Blockquotes'/><category term='Google AdSense'/><category term='Windows'/><category term='WebFontConfig'/><category term='Stephen Hawking'/><category term='SELECT'/><category term='Table Layout'/><category term='thead'/><category term='Backward Slash'/><category term='External Stye Sheets'/><category term='Search Engine Optimization'/><category term='Cron Job'/><category term='Hex Codes'/><category term='Forms'/><category term='Relative Path'/><category term='Background Property'/><category term='Reader Style Sheet'/><category term='Absolute Positioning'/><category term='photo gallery'/><category term='font-face'/><category term='HTML Forms'/><category term='Negative Margin'/><category term='Origin'/><category term='span'/><category term='left'/><category term='Captioning'/><category term='MySpace'/><category term='Firefox Personas'/><category term='Margins between Floated and Cleared Elements'/><category term='Styling a Page'/><category term='server side'/><category term='float next to ul'/><category term='Cascade'/><category term='HTML Blockquote'/><category term='CSS Zen Garden Dave Shea'/><category term='Parent-Child Relationship'/><category term='Layout'/><category term='cross-domain'/><category term='h1'/><category term='Floating LI element'/><category term='Creating MySQL Tables'/><category term='HTTP Request Headers'/><category term='Copyright Symbol'/><category term='Eclipse'/><category term='Search Engine'/><category term='Order'/><category term='CSS Syntax'/><category term='Navigation Menu'/><category term='NTFS'/><category term='PHP foreach'/><category term='Sprite'/><category term='HTTP GET'/><category term='PHP empty'/><category term='The Flow'/><category term='Floats'/><category term='display:block; Fonts and Text'/><category term='Fluid Rose for Zen Garden'/><category term='wf-loading'/><category term='Background Positioning'/><category term='CSS Content Property'/><category term='Oracle'/><category term='IDE'/><category term='Simple Attribute Selector'/><category term='Selectors'/><category term='The Site'/><category term='Software Design'/><category term='Margin Collapsing'/><category term='Searching RSS Feed'/><category term='CSS 3.0 Multiple Background Images'/><category term='JSON'/><category term='markup'/><category term='Removing Hard Disk in a Laptop'/><category term='Adjusting Blogger Profile Image'/><category term='Image Captioning Tool'/><category term='background-repeat'/><category term='Margin'/><category term='Classes and IDs'/><category term='Disk Partitions'/><category term='header'/><category term='Server'/><category term='CREATE TABLE'/><category term='Relative Positioning'/><category term='Beginner'/><category term='PHP Short Tags'/><category term='Google'/><category term='Framing an Image'/><category term='I&apos;m not a witch'/><category term='The Right To Be Forgotten Initiative'/><category term='Bing'/><category term='IPC'/><category term='Linux'/><category term='Author Style Sheet'/><category term='Ubuntu'/><category term='Regular Expression'/><category term='ul'/><category term='Opacity'/><category term='External Enclosure'/><category term='hgroup'/><category term='HTTPS'/><category term='inside'/><category term='Attribute Selectors'/><category term='Technorati'/><category term='img'/><category term='visibility'/><category term='PS Lens Flare'/><category term='localhost'/><category term='DOM'/><category term='Image Replacement'/><category term='RSS'/><category term='Period in a Class/ID Name'/><category term='Adobe Photoshop Tutorials'/><category term='DSL'/><category term='IP Route'/><category term='containing block'/><category term='Style Sheets'/><category term='link'/><category term='Float'/><category term='IE Punches'/><category term='Multi-Column Layout'/><category term='Funny'/><category term='Class'/><category term='PS Mosaic'/><category term='Block Element'/><category term='HTTP Response Headers'/><category term='MySQL'/><category term='Rounding Corners of an Image'/><category term='Input'/><category term='Positioning'/><category term='aside'/><category term='Tables with Fixed Headings'/><category term='th'/><category term='Ubuntu 10.04'/><category term='Browser Default Style Sheet'/><category term='display: none; visibility'/><category term='HTML'/><category term='overflow property'/><category term='list-style-position'/><category term='Floating'/><category term='Google Webfonts'/><category term='text-align'/><category term='multiple class'/><category term='Relational Database'/><category term='Kindle'/><category term='Automated Tools'/><category term='width'/><category term='display:block;'/><category term='Auto Margins'/><category term='background-position'/><category term='RSS Feed'/><category term='overflow'/><category term='Fonts and Text'/><category term='Drop Shadow'/><category term='Apache Server on Local Environment'/><category term='$geo_status'/><category term='Positioning Context'/><category term='C++'/><category term='PS Find Edges'/><category term='display:block; display:none'/><category term='How CSS Works'/><category term='PS Perspective'/><category term='CEO'/><category term='IPv4'/><category term='Dual Stack'/><category term='height'/><category term='Footer'/><category term='XHTML'/><category term='port'/><category term='Flash of Unstyled Text'/><category term='PHP Variable Dump'/><category term='box-shadow'/><category term='Digg'/><category term='Floating IMG element'/><category term='IETF.org'/><category term='Toshiba R500'/><category term='HTML5'/><category term='StumbleUpon'/><category term='PHP count'/><category term='Godaddy'/><category term='phpMyAdmin'/><category term='background-color'/><category term='Ethernet'/><category term='border-bottom'/><category term='Loading Times'/><category term='h3'/><category term='Fading Image'/><category term='text-shadow'/><category term='last-child'/><category term='Art'/><category term='Caching'/><category term='PNG Format'/><category term='MySpace Layout Tutorials'/><category term='Website Design'/><category term='ID'/><category term='mysqli_fetch_array'/><category term='SEO'/><category term='HTML Table'/><category term='IE'/><category term='Code Igniter'/><category term='Photoshop Action Palette'/><category term=':after'/><category term='Google GeoCoding'/><title type='text'>CSS Bakery</title><subtitle type='html'>An interactive reference guide for Cascading Style Sheets - CSS.  Also includes tutorials and information on HTML, PHP, Javascript, Adobe Photoshop and Blogger modifications.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.cssbakery.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default?start-index=101&amp;max-results=100'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>228</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2476096751657975597</id><published>2012-02-11T21:07:00.000-08:00</published><updated>2012-02-13T08:43:53.285-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Right To Be Forgotten Initiative'/><category scheme='http://www.blogger.com/atom/ns#' term='Computing News'/><category scheme='http://www.blogger.com/atom/ns#' term='Search Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><title type='text'>Google Knows Too Much About You</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#justbetweenusjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#D305E6'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='justbetweenusjpg' style='display:none;' src='http://pics.cssbakery.com/pics/jbs.jpg' alt='A Boston Whaler&amp;lt;br&amp;gt;[yacht tender]&amp;lt;br&amp;gt;&amp;copy; 2012 Copyright www.cssbakery.com All Rights Reserved'&gt; &lt;br /&gt;&lt;br /&gt;In her article titled, &lt;a href="http://www.cnn.com/2012/02/09/opinion/ghitis-google-privacy/index.html?hpt=hp_abar"&gt;Google Knows Too Much About You&lt;/a&gt;, Ghitis says, "&lt;i&gt;Google has every search you ever made and every e-mail you ever sent or received on Gmail. If you ever used Google while logged in to your account to search for a person, a symptom, a medical side effect, a political idea; all of this is on Google's servers.  You've done it, said it, clicked it, searched it, Googled it. You can never undo it or unclick it. It stays there forever&lt;/i&gt;."&lt;br /&gt;&lt;br /&gt;The tracking is not a revelation to anyone but storing the compiled information indefinitely sounds disturbing.  The &lt;a href="http://www.pcworld.com/businesscenter/article/248709/proposed_eu_data_protection_rules_include_right_to_be_forgotten.html"&gt;right to be forgotten&lt;/a&gt; initiative may be the way to protect users by providing them with the option to purge search engine data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2476096751657975597?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2476096751657975597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/02/google-knows-too-much-about-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2476096751657975597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2476096751657975597'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/02/google-knows-too-much-about-you.html' title='Google Knows Too Much About You'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8121132893745505069</id><published>2012-01-28T09:24:00.000-08:00</published><updated>2012-02-10T21:05:13.358-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='Blockquotes'/><category scheme='http://www.blogger.com/atom/ns#' term='Funny'/><title type='text'>Writing a Generic CSS Blockquote Class</title><content type='html'>&lt;blockquote class="gen"&gt;&lt;img alt="" src="http://pics.cssbakery.com/pics/tallship2.png" /&gt;&lt;br /&gt;&lt;p class="first"&gt;People do odd things in an emergency and we all have stories of ludicrous situations in an emergency which we laugh afterwards, if we are still alive. &lt;/p&gt;&lt;p class="last"&gt;My favorite one is of the &lt;a href="http://en.wikipedia.org/wiki/Third_mate"&gt; third mate&lt;/a&gt; of a merchant ship who, after a tremendous explosion and thinking his ship had been torpedoed, leapt naked from his bunk and jammed both his legs down one leg of his shorts, so immobilizing himself that he had to crawl out on deck on his hands and knees. Fortunately the explosion hadn't come from a torpedo but from a closely dropped depth charge.&lt;/p&gt;&lt;br /&gt;&lt;span&gt;D. Robertson, &lt;a href="http://www.amazon.com/Survive-Savage-Sea-Sailing-Classics/dp/0924486732/ref=sr_1_1?ie=UTF8&amp;amp;qid=1327696188&amp;amp;sr=8-1"&gt;Survive the Savage Sea&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;I wanted to post a funny paragraph from one of the paperbacks I've been  reading to the blog.  We had covered &lt;a href="http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html"&gt;CSS blockquotes&lt;/a&gt; before so I went  back to find out how to use the blockquote class with my quote.  &lt;a name='more'&gt;&lt;/a&gt;As it  is, every blockquote gets &lt;a href="http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html"&gt; an airplane&lt;/a&gt;  and naturally I had a boat to display.  I must have assumed that the  user would rewrite the background statements to fulfill their needs.   This is a very easy change. But sometimes people just want to use things  as is and have it work for them.  So now, I am going to rewrite a more  generic blockquote class without a background image - you can always add  one if you desire using &lt;a href="http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html"&gt;this post&lt;/a&gt; as a guide. &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;THE CSS&lt;/h1&gt;&lt;pre class="Blue"&gt;/* blockquote generic*/&lt;br /&gt;div.post-body blockquote.gen img  { &lt;br /&gt;   float: left;  &lt;br /&gt;   margin-right: 25px; &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;div.post-body blockquote.gen span { &lt;br /&gt;   float: right; &lt;br /&gt;   margin-top: 5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;blockquote.gen p.first:before,  &lt;br /&gt;blockquote.gen p.last:after {&lt;br /&gt;   font-weight: bold;&lt;br /&gt;   font-size: 4em;&lt;br /&gt;   color: #909090;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*MS repositioning upper quote*/&lt;br /&gt;blockquote.gen p.first:before {&lt;br /&gt;   /*push the upper quote down, line up with the text*/&lt;br /&gt;   position: relative;&lt;br /&gt;   top: 0.4em;&lt;br /&gt;   /*to push the text away from the quote symbol*/&lt;br /&gt;   padding-right: 0.2em;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;.post blockquote.gen {&lt;br /&gt;   width: 490px;&lt;br /&gt;   margin: 0px;&lt;br /&gt;   padding: 18px 30px 30px;&lt;br /&gt;   /*cantaloupe background-color: #f0dfb5; */&lt;br /&gt;   background-color: #d9e8fa;&lt;br /&gt;   /*to round the corners of the blockquote background*/&lt;br /&gt;  -moz-border-radius: 10px;&lt;br /&gt;  -webkit-border-radius: 10px;&lt;br /&gt;  -goog-ms-border-radius: 10px;&lt;br /&gt;   border-radius: 10px; &lt;br /&gt;   quotes: "\201C" "\201D";&lt;br /&gt;&lt;br /&gt;   font-family: Calibri, sans-serif;&lt;br /&gt;   font-size: 15px;&lt;br /&gt;   color: #363636;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; blockquote.gen p.first:before { content: open-quote; }&lt;br /&gt; blockquote.gen p.last:after   { &lt;br /&gt;    content: close-quote; &lt;br /&gt;    float: right; &lt;br /&gt;    padding-top:20px;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; .post blockquote.gen p {&lt;br /&gt;   margin: 0 0 0.75em;&lt;br /&gt; }          &lt;br /&gt; /* end of blockquotes */      &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;THE HTML&lt;/h1&gt;&lt;pre class="MiamiVice"&gt;&amp;lt;blockquote class="gen"&amp;gt;&lt;br /&gt;&amp;lt;img src="images/tallship2.png" alt="" /&amp;gt;&lt;br /&gt;&amp;lt;p class="first"&amp;gt;&lt;br /&gt;People do odd things...... alive. &amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p class="last"&amp;gt;My favorite one is of the ...... charge.&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;span&amp;gt;D. Robertson, &amp;lt;a href="#"&amp;gt;Surviving the Savage Sea&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/blockquote&amp;gt;  &lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;RELATIVE POSITIONING TO NUDGE THE QUOTE DOWN&lt;/h1&gt;&lt;br /&gt;Given the 4em font size, the first quote comes out rather large, producing a large line height to go with it.  Since the text within the quote is in a much smaller font, we end up with a pretty large offset between the quote and the first letter of the text.  The upper quote still looks decent but if you want to make it perfect, we can fix it using relative positioning.&lt;br /&gt;&lt;br /&gt;&lt;img alt="Quote Repositioning" src="http://pics.cssbakery.com/pics/cssquotepositioning2.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;HOW TO USE THE CLASS&lt;/h1&gt;&lt;br /&gt;Your markup will be very similar to the above.  If you wish, you can change the background color from blue to a color of your choosing by rewriting the background color statement in the CSS and of course find a substitute for the image in the markup.  Remember the filename and path "images/tallship2.png" are generic, you need to write your own URL.&lt;br /&gt;&lt;br /&gt;&lt;div class="creditsL"&gt;The ship graphic used in the blockquote demo is by http://cemagraphics.deviantart.com &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8121132893745505069?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8121132893745505069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/writing-generic-css-blockquote-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8121132893745505069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8121132893745505069'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/writing-generic-css-blockquote-class.html' title='Writing a Generic CSS Blockquote Class'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5353653687374164437</id><published>2012-01-20T23:28:00.000-08:00</published><updated>2012-01-22T13:31:42.705-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='first-child'/><category scheme='http://www.blogger.com/atom/ns#' term='Padding and Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='Descendant Selector'/><category scheme='http://www.blogger.com/atom/ns#' term='Modifying Blogger'/><title type='text'>Blogger Adjustments Using CSS</title><content type='html'>&lt;script type="text/javascript"&gt;$(window).load(function(){ $('#visionofhomejpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;img alt="[looking back]&amp;lt;br&amp;gt;© 2012 Copyright www.cssbakery.com All Rights Reserved" id="visionofhomejpg" src="http://pics.cssbakery.com/pics/visionofhome.jpg" style="display: none;" /&gt;&lt;br /&gt;Another post working on Blogger software.  I host my own images and have my own domain but my blog is on Blogger so any time I update the look and feel of the site, I have to work with their software.  The placement of my post date could use some improvement.  &lt;a href="http://pics.cssbakery.com/pics/firstchildh2.jpg"&gt;Here's how it looks now&lt;/a&gt;.&lt;a name='more'&gt;&lt;/a&gt; I highlighted the gap between the date and my site logo in purple.  Either the logo or the date needs to move.  I will pull up the date for the first post, which means I will initialize the top margin for h2 to zero.  One caveat: I wouldn't want the new change to effect every post since I need that top margin for separating successive posts.  CSS first-child property will allow us to write a style that will be exclusively for the first post only.&lt;br /&gt;&lt;br /&gt;div.blog-posts h2:first-child { margin-top: 0px; }&lt;br /&gt;&lt;br /&gt;Zeroing the top margin of the post aligns us better but now I feel we are looking too crowded.  &lt;a href="http://pics.cssbakery.com/pics/toocrowded.jpg"&gt;See what you think&lt;/a&gt;.  I think we need some breathing room.&lt;br /&gt;&lt;br /&gt;Let's try lining up the blue block lettered CSS in my logo, with my main (the second column) and the right sidebar (the third column).  &lt;a href="http://pics.cssbakery.com/pics/bloggerUImain.jpg"&gt;Here's what we are going for&lt;/a&gt;. This will require rewriting our first style because we want to push it down and also push down the right sidebar:&lt;br /&gt;&lt;br /&gt;div.blog-posts h2:first-child { margin-top: 50px; }&lt;br /&gt;#sidebar-wrapper { padding-top: 63px; }&lt;br /&gt;&lt;br /&gt;I embedded these two statements into my local file but best way to do this is to keep an external style sheet and link that file into your Blogger style/markup template which is accessible via DESIGN/EDIT HTML.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5353653687374164437?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5353653687374164437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/more-blogger-adjustments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5353653687374164437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5353653687374164437'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/more-blogger-adjustments.html' title='Blogger Adjustments Using CSS'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7461356939202841188</id><published>2012-01-17T18:00:00.000-08:00</published><updated>2012-01-17T19:41:59.532-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blogger Template'/><category scheme='http://www.blogger.com/atom/ns#' term='Modifying Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogspot'/><title type='text'>Blogger Avatar Sitting on Top of Sidebar</title><content type='html'>I was reading comments on the blog recently when I noticed the &lt;a href="http://pics.cssbakery.com/pics/avatarbug.jpg"&gt;avatar images &lt;/a&gt;sitting on top of my left sidebar.   &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If I pushed the #comments div to the right,  the avatar would move along with it.  This would change my overall margins for the comment section which bothers the symmetrical strain in me but without a clear and apparent place for the avatar to go, was the easiest, fastest way to fix the problem. I decided I could always revisit the styling of comments later.&lt;br /&gt;&lt;br /&gt;div#main-wrapper #comments {&lt;br /&gt;margin-left: 20px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;does the trick.&lt;br /&gt;&lt;br /&gt;We are not writing over the &lt;a href="http://pics.cssbakery.com/pics/avataradjustment.jpg"&gt;left sidebar anymore&lt;/a&gt; which is good. We could push the avatar down  some to align it with the user name better.  Based on whether it's next to a user name that starts with lowercase or uppercase letters, the alignment looks different so I went for the middle of the road which looks pretty decent.  &lt;br /&gt;&lt;br /&gt;#comments-block .avatar-image-container {&lt;br /&gt;padding-top: 5px;&lt;br /&gt;}   &lt;br /&gt;&lt;br /&gt;Blogger users to make these changes, go to DESIGN &amp;gt; EDIT HTML and add the new CSS to your styles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7461356939202841188?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7461356939202841188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/blogger-avatar-sitting-on-top-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7461356939202841188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7461356939202841188'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/blogger-avatar-sitting-on-top-of.html' title='Blogger Avatar Sitting on Top of Sidebar'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7312546326496393606</id><published>2012-01-15T20:25:00.000-08:00</published><updated>2012-01-16T13:26:20.458-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS 3.0 Transforms'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Chrome'/><title type='text'>CSS3 3D Transform Example</title><content type='html'>&lt;a href="http://pics.cssbakery.com/pics/3drun.html"&gt;&lt;img alt="" src="http://pics.cssbakery.com/pics/3d.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;Above you see an image of a 3D box made from a single div element, and  rendered in Chrome using CSS3 3D Transforms.  On one side of the box you  see a small window with CSSBakery showing in it.  In the live demo,  that is actually an iframe that allows you to scroll and click around.&lt;br /&gt;&lt;br /&gt;If you click on the image you'll go to the live demo, but at the moment  3D Transforms are only supported on Apple Safari and Google Chrome (and  based on my tests, Chrome doesn't render it when running on Windows XP).   If you don't have a Browser with 3D transform support then it'll just  look like&lt;i&gt; a lot of gibberish&lt;/i&gt; and that includes Firefox which is the browser that I use.  If you are on IE, you need a prayer.  To download Chrome for Windows, visit &lt;a href="https://www.google.com/chrome/?brand=ECWB&amp;amp;installdataindex=welcome-ntp&amp;amp;hl=en&amp;amp;brand=CHFX&amp;amp;utm_campaign=en&amp;amp;utm_source=en-oa-na-us-bk-bng&amp;amp;utm_medium=oa"&gt;Google&lt;/a&gt;.  Google Chrome with Windows 7 as your OS will display the example correctly.&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The markup for this is really simple:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;div id="bar1" class="bar"&amp;gt;  &lt;br /&gt; &amp;lt;iframe src="http://cssbakery.com"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;The CSS is a bit longer, but still not too bad.  The main things we are doing are:&lt;br /&gt;&lt;ul class="starlist"&gt;&lt;li&gt;Setting up a common perspective value and origin in a parent element (body).  These values are then used by all 3D transforms that are done in all child elements.&lt;/li&gt;&lt;li&gt;We set the transform style to:  preserve-3d&lt;/li&gt;&lt;li&gt;We create a couple of pseudo elements to go along with our content div.  These are the ::before and ::after pseudo elements, which we'll use for rendering the right side and top of the 3d bar.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;We use the transform property on each of the 3 elements to rotate and translate it in space to form the image of a 3d box.&lt;/li&gt;&lt;li&gt;We add some styles for the iframe I mentioned earlier, including some positioning and a scaling factor to make it fit.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Here's the CSS:&lt;br /&gt;&lt;pre class="Blue"&gt;body {&lt;br /&gt; -webkit-perspective: 1000px;&lt;br /&gt; -webkit-perspective-origin: 200px -150px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#bar1 {&lt;br /&gt; color: white;&lt;br /&gt; font-size: 50px;&lt;br /&gt; text-align: center;&lt;br /&gt; background: navy;&lt;br /&gt; top: 300px;&lt;br /&gt; left: 400px; &lt;br /&gt; -webkit-transform-style: preserve-3d;&lt;br /&gt; -webkit-transform: translateX(-20%) rotateY(-45deg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.bar, .bar::before, .bar::after {&lt;br /&gt; padding: 0;&lt;br /&gt; margin: 0;&lt;br /&gt; position: absolute;&lt;br /&gt; left: 100px;&lt;br /&gt; width: 200px;&lt;br /&gt; height: 260px; &lt;br /&gt; display: block;&lt;br /&gt; position: absolute;&lt;br /&gt; font-size: 25px;&lt;br /&gt; line-height: 35px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.bar::before {&lt;br /&gt; &lt;br /&gt; content: 'Before';&lt;br /&gt; top: -100px;&lt;br /&gt; height: 200px;&lt;br /&gt; background-color: rgba(0, 0, 255, .4);&lt;br /&gt; -webkit-transform: rotateY(90deg) rotateX(90deg) translate(50%, -50%);&lt;br /&gt; -moz-transform: rotateY(90deg) rotateX(90deg) translate(50%, -50%);&lt;br /&gt; -o-transform: rotateY(90deg) rotateX(90deg) translate(50%, -50%);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.bar::after {&lt;br /&gt; content: 'After';&lt;br /&gt; top: 0px;&lt;br /&gt; background-color: rgba(0, 255, 0, .4);&lt;br /&gt; -webkit-transform: rotateY(90deg) translateX(50%);&lt;br /&gt; -moz-transform: rotateY(90deg) translateX(50%);&lt;br /&gt; -o-transform: rotateY(90deg) translateX(50%);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;iframe {&lt;br /&gt;    position: absolute;&lt;br /&gt;    left: -50px;&lt;br /&gt;    top: -96px;&lt;br /&gt;    height: 438px;&lt;br /&gt;    -webkit-transform: scale(.48);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7312546326496393606?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7312546326496393606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/css3-3d-transform-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7312546326496393606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7312546326496393606'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/css3-3d-transform-example.html' title='CSS3 3D Transform Example'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4044703752139372443</id><published>2012-01-04T23:00:00.000-08:00</published><updated>2012-01-09T10:58:30.926-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computing News'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Bar Graphs'/><category scheme='http://www.blogger.com/atom/ns#' term='Browsers'/><category scheme='http://www.blogger.com/atom/ns#' term='IE6'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Chrome'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='Browser Wars'/><title type='text'>King's Crown to be Made of Chrome?</title><content type='html'>&lt;div class="bargraph" style="width: 292px;"&gt;&lt;ul class="bars chrome-watermark"&gt;&lt;li class="bar1 orangebar" style="height: 12px;"&gt;&lt;span&gt;6%&lt;/span&gt;&lt;/li&gt;&lt;li class="bar2 crimsonbar" style="height: 50px;"&gt;25%&lt;/li&gt;&lt;li class="bar3 navybar" style="height: 54px;"&gt;27%&lt;/li&gt;&lt;li class="bar4 tealbar" style="height: 70px;"&gt;35%&lt;/li&gt;&lt;/ul&gt;&lt;ul class="label"&gt;&lt;li&gt;Safari&lt;/li&gt;&lt;li&gt;Firefox&lt;/li&gt;&lt;li&gt;Chrome&lt;/li&gt;&lt;li&gt;IE&lt;/li&gt;&lt;/ul&gt;&lt;ul class="y-axis"&gt;&lt;li&gt;100&lt;/li&gt;&lt;li&gt;75&lt;/li&gt;&lt;li&gt;50&lt;/li&gt;&lt;li&gt;25&lt;/li&gt;&lt;li&gt;0&lt;/li&gt;&lt;/ul&gt;&lt;p class="centered"&gt;Browser Market Share &lt;br /&gt;&lt;span class="graphfooter"&gt;©2012 &lt;a href="http://www.cssbakery.com/2009/06/data-visualisation-flexible-bar-graphs.html"&gt;bar graphs&lt;/a&gt; by cssbakery.com&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;Could Google Chrome overtake Microsoft's Internet Explorer in the browser wars? That's what people are asking after StatCounter reported that &lt;a href="http://www.blogger.com/%20http://www.cnn.com/2012/01/04/tech/web/google-chrome-browser/index.html?hpt=hp_bn6"&gt;Chrome has just bypassed Firefox&lt;/a&gt; in browser market share.  &lt;a name='more'&gt;&lt;/a&gt; Firefox and Chrome, long favored by developers, have steadily gone up in number of downloads over the years.   Internet Explorer is still the leader but everybody, including Microsoft, is happy  &lt;a href="http://technolog.msnbc.msn.com/_news/2012/01/04/9947042-ding-dong-ie-6-is-dead"&gt;IE6&lt;/a&gt; share is down to less than 1%. Not unlike those scenes in the movies when no matter what you do, you just can't kill the scary beast, there's a  reason why IE6 has staying power.&lt;br /&gt;&lt;br /&gt;Some corporations and government entities are still using IE6 because they have a suite of applications developed and tested on that particular browser.  Moving to a new browser means they have to re-test all those applications and fix the ones that are broken, all of which costs them money.  Of course, they should realize that there is also a large cost for staying on IE6, including extra effort for new applications and the potential cost of security breaches caused by the use of a 10 year old browser.&lt;br /&gt;&lt;br /&gt;Here's a set of earlier CSSBakery posts on &lt;a href="http://www.cssbakery.com/2010/09/building-chrome-on-64-bit-ubuntu-1004.html"&gt;Google Chrome&lt;/a&gt;.  The bar graph with the &lt;a href="http://pics.cssbakery.com/pics/emblemchrome.png"&gt;emblem&lt;/a&gt; was made using CSS classes  that we developed &lt;a href="http://www.cssbakery.com/2009/06/data-visualisation-flexible-bar-graphs.html"&gt;here&lt;/a&gt;.  For the markup and watermark css, look &lt;a href="http://pics.cssbakery.com/pics/chromebargraph.txt"&gt;here&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;Google Chrome is written in C++.  I'm including a &lt;a href="http://pics.cssbakery.com/pics/chromesamplecode.txt"&gt; sample&lt;/a&gt; of the source code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4044703752139372443?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4044703752139372443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/googles-chrome-is-on-rise.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4044703752139372443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4044703752139372443'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/googles-chrome-is-on-rise.html' title='King&apos;s Crown to be Made of Chrome?'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5566153170882033052</id><published>2012-01-01T10:58:00.000-08:00</published><updated>2012-01-07T15:22:51.882-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft Security Essentials'/><category scheme='http://www.blogger.com/atom/ns#' term='Anti-Virus Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Microsoft Security Essentials</title><content type='html'>&lt;script type="text/javascript"&gt;$(window).load(function(){ $('#BAILINGgif').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img alt="Happy New Year! :-)&amp;lt;br&amp;gt;© 2012 Copyright www.cssbakery.com All Rights Reserved" id="BAILINGgif" src="http://pics.cssbakery.com/pics/BAILING.gif" style="display: none;" /&gt;&lt;br /&gt;I had a Coast Guard instructor once, a gruff but lovable &lt;a href="http://en.wikipedia.org/wiki/File:Captain_Haddock.png"&gt;Captain Haddock&lt;/a&gt; type with a penchant for donuts, who used to tell us that anybody who gets on his boat has to wear a life vest at all times.  On board, he kept three of anything that was important - 3 GPS'es, 3 batteries, 3 radios that I can remember.  Inside a large, lake-like harbor or with a computer that rarely goes to unknown sites,  life vests and anti-virus software start feeling bulky, obstructive and you start bending the golden rules. &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When another computer detected problems with some of my files,  I scanned the suspect laptop with McAfee and Avast which revealed surprises in the form of Siveras-B. Feeling invincible, I hadn't run any anti-virus software on it for awhile (a sheepish grin). Even though I removed the threats identified by Avast and McAfee,  MSE full scan, a free &lt;a href="http://windows.microsoft.com/en-US/windows/products/security-essentials"&gt;downloadable&lt;/a&gt; from Microsoft, which took six hours to run, came up with more.   &lt;a href="http://windows.microsoft.com/en-US/windows/products/security-essentials"&gt;Microsoft Security Essentials&lt;/a&gt; Quick scan had declared it clean.  The lesson to learn from my example:  Run regular scans on all of your computers and any medium that comes into contact with them. An SD card that was infected is how I became aware of my situation.&lt;br /&gt;&lt;br /&gt;If you find yourself in a similar or worse predicament and you want to back up your data before you reformat a disk, remember that even when your operating system's gone belly up, you can always boot using &lt;a href="http://www.ubuntu.com/download/ubuntu/download"&gt;Ubuntu Linux&lt;/a&gt; on a portable medium to access your files.  After saving important data, reformat the disk and reload the OS for a fresh start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5566153170882033052?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5566153170882033052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2012/01/microsoft-security-essentials.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5566153170882033052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5566153170882033052'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2012/01/microsoft-security-essentials.html' title='Microsoft Security Essentials'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1941726766665404933</id><published>2011-12-31T15:02:00.000-08:00</published><updated>2012-01-07T17:38:16.916-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blogger Template'/><category scheme='http://www.blogger.com/atom/ns#' term='Blog Software'/><category scheme='http://www.blogger.com/atom/ns#' term='Class'/><category scheme='http://www.blogger.com/atom/ns#' term='Modifying Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='Expand Widget Templates'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogspot'/><title type='text'>Styling Blogger Differently for Single Post vs. Multiple Posts</title><content type='html'>&lt;script type="text/javascript"&gt;$(window).load(function(){ $('#hldylites1gif').cssBakeryCaption({'opacity':'0.1','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;br /&gt;&lt;img alt="Happy New Year&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved" id="hldylites1gif" src="http://pics.cssbakery.com/pics/hldylites1.gif" style="display: none;" /&gt;&lt;br /&gt;If you are a Blogger user, you may find this useful.  I had a situation where I wanted to style something differently for the individual post page vs. the main page where all the latest blog entries are displayed.  Looking at the Blogger HTML markup, I found that the HTML is very similar between these two pages.  So similar in fact that I could not write a CSS selector that would apply to one and not the other. &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To solve this, I added a div that will have a different class name when viewing a single post vs. the main list of recent posts.  To do this, I had to edit my Blogger template and 'expand widget templates'.  I found the place I wanted to add the new div and entered it as follows&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;div expr:class='data:blog.pageType''&amp;gt;&lt;br /&gt;    &amp;lt;!-- the div's I want to enclose for styling --&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;  &lt;/pre&gt;&lt;br /&gt;Note the 'expression' used within the div tag ("expr:class='data:blog.pageType'").  This is a Blogger scripting expression that will be evaluated at runtime.  Blogger will evaluate it and render something different based on the value of it's blog.pageType internal variable.  For a single post page, this expression will evalute to "class='item'", whereas on a mult-post home page it will evaluate to "class='index'".&lt;br /&gt;&lt;br /&gt;So, after doing this, the single post view will have the following div:&lt;br /&gt;&lt;br /&gt;&amp;lt;div class='item'&amp;gt;&lt;br /&gt;&lt;br /&gt;and the main list of posts will have:&lt;br /&gt;&lt;br /&gt;&amp;lt;div class='index'&amp;gt;&lt;br /&gt;&lt;br /&gt;Now I can write CSS rules that target one or the other using the different class names.&lt;br /&gt;&lt;br /&gt;.blog-pager .item {&lt;br /&gt;/* do something different on the single post page */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.blog-pager .index {&lt;br /&gt;/* do something else for the main page */&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1941726766665404933?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1941726766665404933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/12/styling-blogger-differently-for-single.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1941726766665404933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1941726766665404933'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/12/styling-blogger-differently-for-single.html' title='Styling Blogger Differently for Single Post vs. Multiple Posts'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-361388338312954311</id><published>2011-12-26T12:54:00.000-08:00</published><updated>2012-01-07T17:41:40.120-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='background-position'/><category scheme='http://www.blogger.com/atom/ns#' term='span'/><category scheme='http://www.blogger.com/atom/ns#' term='ul'/><category scheme='http://www.blogger.com/atom/ns#' term='Adobe Photoshop Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='li'/><category scheme='http://www.blogger.com/atom/ns#' term='Transparency'/><category scheme='http://www.blogger.com/atom/ns#' term='Menu'/><category scheme='http://www.blogger.com/atom/ns#' term='Classes and IDs'/><category scheme='http://www.blogger.com/atom/ns#' term='Sprites'/><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop Circles'/><category scheme='http://www.blogger.com/atom/ns#' term='Background Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='Absolute Positioning'/><title type='text'>CSS Diagonal Menu with Sprites</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#swooshAjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='swooshAjpg' style='display:none;' src='http://pics.cssbakery.com/pics/swooshA.jpg' alt='Large Fleet on a Run&amp;lt;br&amp;gt;[got caught in middle while tacking]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Below I decided to do another text wrapping experiment - similar to the "stair steps" in the &lt;a href="http://www.cssbakery.com/2011/12/curved-text-wrap-mock-slicing-image.html"&gt;previous post&lt;/a&gt; - where I'll have the right hand side of the text wrap along an angled series of graphics.  The graphics depict the various "points of sail" of a sailboat.  In this post rather than &lt;a href="http://www.cssbakery.com/2011/12/curved-text-wrap-mock-slicing-image.html"&gt;using invisible "steps"&lt;/a&gt; to force the wrapping, I'm going to use a fake stair approach where I'll just insert &amp;lt;br&amp;gt;'s into the text to break lines at appropriate words to form the angled right hand side.  While I'll do this by hand for this example, it wouldn't be too hard to write some server side code to insert the br's at appropriate places. &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That takes care of the text, but we also have to position the circles along a diagonal line.  We'll do this with a combination of relative and absolute positioning.  We'll also add a hover style to pop up a box of text explaining the point of sail you are currently hovering over.&lt;br /&gt;&lt;br /&gt;In the outer div - POSwrap - we set the position to relative to establish a positioning context. Below, we set an absolute position for the ul.  Since the ul is a descendant of POSwrap it will use the positioning context we established above.  &lt;br /&gt;&lt;br /&gt;By absolutely positioning the entire ul we can move around all the point of sail graphics as a single unit (that is, all the li's within the ul will move together as we move the ul).  Note that we will need to adjust the ul's position to match the amount of text in the paragraphs above the graphics.&lt;br /&gt;&lt;br /&gt;Within the ul, we again use absolute positioning for each of the child li's.  This positioning establishes the angled line of circular graphics. &lt;br /&gt;&lt;br /&gt;In the working example below, hover over the portholes to see the text overlayed on a semi-transparent background.  We discussed CSS transparency in other posts.  The CSS and markup are fully listed, I explain the sprites briefly. If you search the blog, you'll find many other posts where I talk about &lt;a href="http://www.cssbakery.com/2011/12/css-sprites.html"&gt;sprites&lt;/a&gt;. I finish off with Photoshop circles.  Enjoy and watch where you are going! :-)&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div id="POSwrap"&gt;&lt;br /&gt;&lt;h1&gt;Points of Sail&lt;/h1&gt;&lt;p&gt;A sailboat cannot sail directly into the eye of the wind, but can sail to within &lt;br /&gt;45 degrees of the wind or closer when close-hauled. If you head into the&lt;br /&gt;wind, your sails will start luffing and you will lose power and the&lt;br /&gt;ability to steer.  Describing a sailboat's course in relation&lt;br /&gt;to the wind direction, the points of sale on the right&lt;br /&gt;show a starboard tack and assume that the&lt;br /&gt;wind is blowing from the top of your &lt;br /&gt;screen. Boat drawings and info &lt;br /&gt;from Chapman Piloting &lt;br /&gt;and Seamanship, &lt;br /&gt;65th edition &lt;br /&gt;by &lt;em&gt;E. Maloney&lt;/em&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul id="pointsofsail"&gt;&lt;li id="run"&gt;&lt;span&gt;&lt;h2&gt;Run&lt;/h2&gt;When the wind is almost directly aft, the boat is said to be "running".  If the wind is light, it'll feel like you are not moving but just look behind the boat and you'll see a rippling line of water.  In stronger winds, gybing is a danger with this sail.  Aerodynamically simpler but can be the most dangerous point of sail.&lt;/span&gt;&lt;/li&gt;&lt;li id="closehauled"&gt;&lt;span&gt;&lt;h2&gt;Close-Hauled&lt;/h2&gt;When there's the smallest angle between wind direction and heading, the boat is said to be "close-hauled" meaning that it sails are hauled in close to the hull.  My favorite sail.&lt;/span&gt;&lt;/li&gt;&lt;li id="closereach"&gt;&lt;span&gt;&lt;h2&gt;Close Reach&lt;/h2&gt;When the angle between heading and wind direction is increased, the boat begins to "close reach".  A close reach is somewhat toward the wind, and broad reach is a little bit away from the wind. Fast point of sale for most boats.  The sails are eased about halfway out.&lt;/span&gt; &lt;/li&gt;&lt;li id="beamreach"&gt;&lt;span&gt;&lt;h2&gt;Beam Reach&lt;/h2&gt;The boat is "beam reaching" when the wind is on the beam at a right angle to the boat.  &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li id="broadreach"&gt;&lt;span&gt;&lt;h2&gt;Broad Reach&lt;/h2&gt;Further increases to the angle between heading and wind direction (more than 90 degrees) bring the boat to a "broad reach"&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1&gt;THE CSS AND THE MARKUP&lt;/h1&gt;&lt;br /&gt;/* pos */&lt;br /&gt;ul#pointsofsail {   position: absolute;&lt;br /&gt;padding: 0; margin: 0;&lt;br /&gt;list-style-type: none;&lt;br /&gt;&lt;br /&gt;/*these 2 points will position it from title of blog post*/&lt;br /&gt;/*and the title of pointofsale element*/&lt;br /&gt;top:   105px;  /*go below positioning context s 0 0 - go below*/&lt;br /&gt;left: -125px;  /*go left of positioning context s 0 0 - go left*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li {&lt;br /&gt;background-image: url("http://pics.cssbakery.com/pics/pointsofsail.png");&lt;br /&gt;background-repeat: none;&lt;br /&gt;height: 102px;&lt;br /&gt;width: 102px;&lt;br /&gt;position: absolute; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li span {&lt;br /&gt;font: 13px Arial, Helvetica, sans-serif;&lt;br /&gt;line-height: 16px;&lt;br /&gt;color: #494949;&lt;br /&gt;width: 200px;&lt;br /&gt;background: #fcf6e6;&lt;br /&gt;padding: 20px;&lt;br /&gt;&lt;br /&gt;border: 3px solid #616161;&lt;br /&gt;-moz-border-radius: 5px;&lt;br /&gt;-webkit-border-radius: 5px;&lt;br /&gt;border-radius: 5px;&lt;br /&gt;&lt;br /&gt;opacity: .90;&lt;br /&gt;filter: alpha(opacity=90);&lt;br /&gt;&lt;br /&gt;display: none;&lt;br /&gt;position: absolute;&lt;br /&gt;top: 120px;&lt;br /&gt;/*lines up with my blogger text but 8px works by shifting &lt;br /&gt;the hover window a little to the right &lt;br /&gt;*/&lt;br /&gt;left: 8px; &lt;br /&gt;text-align: justify;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*the span is always the first child of the li in this &lt;br /&gt;markup.  We are really trying to get to the first&lt;br /&gt;list item in the ul so the first-child goes to the li&lt;br /&gt;element&lt;br /&gt;I want the first popup window to be placed at 0 left and &lt;br /&gt;not 8px like the rest of them&lt;br /&gt;*/&lt;br /&gt;#POSwrap ul#pointsofsail li:first-child span { left: 0; }&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li:hover span {&lt;br /&gt;display: block;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#closehauled {&lt;br /&gt;background-position: 0 0;&lt;br /&gt;height: 102px;&lt;br /&gt;width: 102px; &lt;br /&gt;left: 571px;&lt;br /&gt;top: 9px;&lt;br /&gt;}&lt;br /&gt;#closehauled:hover {&lt;br /&gt;background-position: 0 -102px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#closereach {&lt;br /&gt;background-position: -102px 0;&lt;br /&gt;left: 460px;&lt;br /&gt;top: 72px;&lt;br /&gt;}&lt;br /&gt;#closereach:hover {&lt;br /&gt;background-position: -102px -102px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#beamreach {&lt;br /&gt;background-position: -204px 0;&lt;br /&gt;left: 349px;&lt;br /&gt;top: 138px;&lt;br /&gt;}&lt;br /&gt;#beamreach:hover {&lt;br /&gt;background-position: -204px -102px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#broadreach {&lt;br /&gt;background-position: -306px 0;&lt;br /&gt;background-position: -307px -2px;&lt;br /&gt;left: 235px;&lt;br /&gt;top: 202px;&lt;br /&gt;}&lt;br /&gt;#broadreach:hover {&lt;br /&gt;background-position: -307px -104px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#run {&lt;br /&gt;background-position: -408px 0;&lt;br /&gt;background-position: -409px -2px;&lt;br /&gt;left: 125px;&lt;br /&gt;top: 266px;&lt;br /&gt;}&lt;br /&gt;#run:hover {&lt;br /&gt;background-position: -409px -104px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.post-body ul#pointsofsail li span h2 {&lt;br /&gt;font-size: 15px;&lt;br /&gt;line-height: 6px;&lt;br /&gt;font-weight: bold;&lt;br /&gt;padding: 0;&lt;br /&gt;margin: 5px 0 20px 0;&lt;br /&gt;&lt;br /&gt;/*to undo the effects of cascading*/&lt;br /&gt;text-transform: none;&lt;br /&gt;background: none;&lt;br /&gt;font-family : Arial,Helvetica,sans-serif;&lt;br /&gt;font-style : normal;&lt;br /&gt;letter-spacing : normal;&lt;br /&gt;line-height : 6px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*different colors*/&lt;br /&gt;ul#pointsofsail li#closehauled span h2 {&lt;br /&gt;color: #6a2df7;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li#closereach span h2 {&lt;br /&gt;color: #61a1e2;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li#beamreach span h2 {&lt;br /&gt;color: #23689c;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li#broadreach span h2 {&lt;br /&gt;color: #06c2d3;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ul#pointsofsail li#run span h2 {&lt;br /&gt;color: #de0c1b;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.post-body div#POSwrap {  &lt;br /&gt;width: 550px;  &lt;br /&gt;margin: 0;&lt;br /&gt;padding: 0 0 90px;&lt;br /&gt;font-family: "Helvetica Neue Medium",Helvetica,"Helvetica Neue",Arial,sans-serif;&lt;br /&gt;position: relative;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.post-body div#POSwrap h1 {&lt;br /&gt;background: url(http://pics.cssbakery.com/pics/h2transparent.png) no-repeat;&lt;br /&gt;width: 244px;&lt;br /&gt;height: 56px;&lt;br /&gt;text-indent: -9999px;&lt;br /&gt;margin-top: 20px;&lt;br /&gt;}&lt;br /&gt;/*end of pos*/&lt;br /&gt;&lt;br /&gt;&lt;pre class='MiamiVice'&gt;&amp;lt;div id="POSwrap"&amp;gt;&lt;br /&gt;&amp;lt;h1&amp;gt;&lt;br /&gt;Points of Sail&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&lt;br /&gt;A sailboat cannot sail directly into the eye of the wind, but can sail to within &lt;br /&gt;45 degrees of the wind or closer when close-hauled. If you head into the&lt;br /&gt;wind, your sails will start luffing and you will lose power and the&lt;br /&gt;ability to steer.  Describing a sailboat's course in relation&lt;br /&gt;to the wind direction, the points of sale on the right&lt;br /&gt;show a starboard tack and assume that the&lt;br /&gt;wind is blowing from the top of your &lt;br /&gt;screen. Boat drawings and info &lt;br /&gt;from Chapman Piloting &lt;br /&gt;and Seamanship, &lt;br /&gt;65th edition &lt;br /&gt;by &amp;lt;em&amp;gt;E. Maloney&amp;lt;/em&amp;gt;.&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ul id="pointsofsail"&amp;gt;&lt;br /&gt;&amp;lt;li id="run"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;h2&amp;gt;&lt;br /&gt;Run&amp;lt;/h2&amp;gt;&lt;br /&gt;When the wind is almost directly aft, the boat is said to be "running".  If the wind is light, it'll feel like you are not moving but just look behind the boat and you'll see a rippling line of water.  In stronger winds, gybing is a danger with this sail.  Aerodynamically simpler but can be the most dangerous point of sail.&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li id="closehauled"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;h2&amp;gt;&lt;br /&gt;Close-Hauled&amp;lt;/h2&amp;gt;&lt;br /&gt;When there's the smallest angle between wind direction and heading, the boat is said to be "close-hauled" meaning that it sails are hauled in close to the hull.   My favorite sail :)&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li id="closereach"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;h2&amp;gt;&lt;br /&gt;Close Reach&amp;lt;/h2&amp;gt;&lt;br /&gt;When the angle between heading and wind direction is increased, the boat begins to "close reach".  A close reach is somewhat toward the wind, and broad reach is a little bit away from the wind. Fast point of sale for most boats.  The sails are eased about halfway out.&amp;lt;/span&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li id="beamreach"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;h2&amp;gt;&lt;br /&gt;Beam Reach&amp;lt;/h2&amp;gt;&lt;br /&gt;The boat is "beam reaching" when the wind is on the beam at a right angle to the boat.  &amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li id="broadreach"&amp;gt;&amp;lt;span&amp;gt;&amp;lt;h2&amp;gt;&lt;br /&gt;Broad Reach&amp;lt;/h2&amp;gt;&lt;br /&gt;Further increases to the angle between heading and wind direction (more than 90 degrees) bring the boat to a "broad reach"&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;    &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;CSS SPRITES&lt;/h1&gt;&lt;br /&gt;The same rules that set the absolute positions of the graphics, also implements the CSS sprite technique by setting the background position attribute.  An additional hover style makes the sprite dynamic by changing the background offset when you hover over the graphic.  As an added touch, hovering over a graphic also displays the block of text contained in the corresponding li's span element (see the li:hover span" rule).&lt;br /&gt;&lt;br /&gt;Finally, for each of these blocks of text, we set the color of the heading to match the border color of the circular graphic.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/spritefile.jpg" alt="CSS Sprite File" /&gt;&lt;br /&gt;The &lt;a href="http://pics.cssbakery.com/pics/pointsofsail.png"&gt;sprite file&lt;/a&gt; that I'm using has the the active (when an image is pressed) and the inactive state (the grey versions) of each bitmap.  For detailed discussion of CSS Sprites, see these &lt;a href="http://www.cssbakery.com/2011/12/css-sprites.html"&gt;links&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;HOLLOW PHOTOSHOP CIRCLES&lt;/h1&gt;&lt;br /&gt;Here is a video briefly describing the steps involved in drawing consistent see through circles in Adobe Photoshop.  You will learn how to use the Ellipse tool to make perfect circles, Stroke, Blending Options Default, and Fill Opacity for vector shapes:&lt;br /&gt;&lt;br /&gt;&lt;iframe title="AdobeTV Video Player" width="480" height="296" src="http://tv.adobe.com/embed/588/10981/" frameborder="0" allowfullscreen scrolling="no"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-361388338312954311?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/361388338312954311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/12/css-diagonal-menu-with-sprites.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/361388338312954311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/361388338312954311'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/12/css-diagonal-menu-with-sprites.html' title='CSS Diagonal Menu with Sprites'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3828745432855861029</id><published>2011-12-26T12:46:00.000-08:00</published><updated>2011-12-28T18:02:37.590-08:00</updated><title type='text'>CSS Sprites</title><content type='html'>&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/littlespriteicon.jpg" alt="" title="" /&gt;&lt;h4&gt;CSS Sprites &lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/06/shifting-background-image.html"&gt;How Sprites Work: Shifting a Background Image&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/12/css-diagonal-menu-with-sprites.html"&gt;CSS Diagonal Menu with Sprites&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/04/css-sprite-for-performance-improvement.html"&gt;Sprites for Performance Improvement&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/06/data-visualisation-flexible-bar-graphs.html"&gt;Data Visualization: Sprites in Bar Graphs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/css-image-grid-using-sprites_30.html"&gt;CSS Image Grid Using Sprites&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3828745432855861029?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3828745432855861029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/12/css-sprites.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3828745432855861029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3828745432855861029'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/12/css-sprites.html' title='CSS Sprites'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8799234002396021391</id><published>2011-12-18T08:39:00.000-08:00</published><updated>2011-12-18T09:34:06.909-08:00</updated><title type='text'>Happy Holidays</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#lightsgif').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#c13ef8'}); });&lt;/script&gt;&lt;img id='lightsgif' style='display:none;' src='http://pics.cssbakery.com/pics/lights.gif' alt='Happy Holidays&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8799234002396021391?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8799234002396021391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/12/happy-holidays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8799234002396021391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8799234002396021391'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/12/happy-holidays.html' title='Happy Holidays'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2772153359972329062</id><published>2011-12-12T20:42:00.000-08:00</published><updated>2012-01-19T20:06:30.632-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS3'/><category scheme='http://www.blogger.com/atom/ns#' term='box-shadow'/><category scheme='http://www.blogger.com/atom/ns#' term='Positioning Elements'/><category scheme='http://www.blogger.com/atom/ns#' term='Padding and Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='The Flow'/><category scheme='http://www.blogger.com/atom/ns#' term='Negative Margin'/><category scheme='http://www.blogger.com/atom/ns#' term='border-radius'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Absolute Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='Positioning Context'/><title type='text'>The Stair Effect: CSS Curved Text Wrap Using a Mock Sliced Image</title><content type='html'>&lt;img src="http://pics.cssbakery.com/pics/CSSMockSlices.jpg" alt="CSS Mock Slicing an Image" /&gt;To view the slideshow which has the major steps of the tutorial, click &lt;a href="http://pics.cssbakery.com/pics/gown.gif" alt=""&gt;here&lt;/a&gt;.  So why are we going to pretend to divide up an image into smaller rectangles?  Because I want to wrap text around an image following a curved path.  Like &lt;a href="http://www.peachpit.com/articles/article.aspx?p=434250&amp;seqNum=4"&gt;many others&lt;/a&gt; have done before, including &lt;a href="http://www.meyerweb.com"&gt;Eric Meyer&lt;/a&gt; in his blue book, you can also cut your image into real slices in Photoshop, which would simplify the CSS but it'd be labor intensive, and requires you to add img tags in the markup.  I want to do the same using CSS (and a bit of markup) without actually editing the image.&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Honestly, CSS was not what I had in mind when I started thinking about wrapping text around a PNG file which contained an unevenly shaped image.  Using Javascript, you can probably check for blank pixels to determine the real contour of an image and then  build a "staircase" based on that.  That would require a bit of programming and writing of some image processing algorithms.  &lt;br /&gt;&lt;br /&gt;Being a CSS-centric blog, I want to share with you a CSS technique that approximates the same thing without any traditional programming.  If you have a good grasp of CSS fundamentals and some patience, you can curve text around an image using only CSS and HTML.  The types of topics that we'll cover during this exercise are Negative Margins, Relative and Absolute Positioning, The Flow, and Floats.  &lt;br /&gt;&lt;br /&gt;The markup for the &lt;a href="http://pics.cssbakery.com/pics/gown.gif" alt="" /&gt;first still&lt;/a&gt; in the animated gif has a div enveloping an img and a p element. The image goes first and because p is a block element, the text starts at a new line.  The red border is for the enveloping div and the dotted black border belongs to the image.  No CSS needed, the markup goes something like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div id="stairs"&amp;gt;&lt;br /&gt;  &amp;lt;img src="images/gown.png"&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;An evening gown is a long flowing women's....&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;    &lt;/pre&gt;&lt;br /&gt;The output without any CSS &lt;a href="http://pics.cssbakery.com/pics/cssbakeryCURVEDTEXT.jpg"&gt;looks like this&lt;/a&gt;.  The borders are not turned on in this version because I have no CSS.&lt;br /&gt;&lt;br /&gt;Since we want to pull the text to the same level with the image, we begin writing some CSS.  Floating the image to the right should do the trick because this will sort of take the image out of the flow so as long as there's enough space the text and image will sit next to each other.  Text will flow around the floated image but other than that, the image being there will not cause a block level element generate a br.  &lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;#stairs img { float: right; border: 1px dotted black; }&lt;br /&gt;#stairs { border: 1px solid red; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Let's add 20 pixels all around to get the image away from the corner of the browser and give the stairs div a width of 500 pixels to contain the text a bit.  The &lt;a href="http://pics.cssbakery.com/pics/gown.gif" alt="" /&gt;third still&lt;/a&gt; is how we'll look at this point.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;#stairs { &lt;br /&gt;   border: 1px solid red;&lt;br /&gt;   margin: 20px;&lt;br /&gt;   width: 500px;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;#stairs img { border: 1px dotted black; &lt;br /&gt;              float: right;}&lt;/pre&gt;&lt;br /&gt;The text is confined to a set width and is next to the image  but moving the text more towards the image will benefit the design.  To do this, we will use negative margins.  Remember a left margin controls how far away the neighboring element to your left has to stay from you.  You control how close someone gets to you.  When you have a negative margin, you are in effect saying "come on in" so that the elements actually start overlapping.  A left margin of minus 80 pixels looks okay.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;#stairs { &lt;br /&gt;   border: 1px solid red;&lt;br /&gt;   margin: 20px;&lt;br /&gt;   width: 500px;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;#stairs img { &lt;br /&gt;   border: 1px dotted black;&lt;br /&gt;   float: right;  &lt;br /&gt;   margin-left: -80px;}&lt;br /&gt;&lt;br /&gt;#stairs p   { text-align: justify; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here's the &lt;a href="http://pics.cssbakery.com/pics/negativemargin.jpg"&gt;output&lt;/a&gt; of our CSS and HTML after the latest changes.  I have the borders turned on for debugging.  &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;STAIR EFFECT&lt;/h1&gt;&lt;br /&gt;With CSS, we do not have access to the internals of an image file so we are going to simulate the curve by stacking up rectangles on top of one another.  This reminds me of how we used to compute an integral using a numerical method.  &lt;br /&gt;&lt;br /&gt;The markup will change.  The finer the slices, the better the curve but for our purposes, four (4) should be sufficient to demonstrate the technique.  Six (6) rectangles will make it perfect which would be a good exercise for you.  All div's will be floated and will have nothing inside them so it's imperative that we declare width and height for each div.  Without dimensions, an empty div will collapse in the flow.  I'll take the negative margin out for now since we don't it for this case.  The containing block for the image is &lt;b&gt;csdiv&lt;/b&gt;, the wrapper div for the stair divs.  I'm sure you can come up with a more descriptive name for your div, cs is short for container-stairs div.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;/*the css*/&lt;br /&gt;#stairs { &lt;br /&gt;   border: 1px solid red;&lt;br /&gt;   margin: 20px;&lt;br /&gt;   width: 460px;&lt;br /&gt;   font: 13px/1.7 Georgia;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;#stairs img { &lt;br /&gt;      border: 1px dotted black; &lt;br /&gt;      position: absolute; &lt;br /&gt;      top:0; right:0;  }&lt;br /&gt;&lt;br /&gt;#stairs p   { text-align: justify; }&lt;br /&gt;#csdiv      { position: relative; }&lt;br /&gt;&lt;br /&gt;.stair1, .stair2, .stair3, .stair4 { float: right; }   &lt;br /&gt;.stair2, .stair3, .stair4 { clear: both; }&lt;br /&gt;&lt;br /&gt;.stair1 { width: 181px;&lt;br /&gt;   height: 190px;&lt;br /&gt;   border: 1px solid blue;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;.stair2 { width:  208px;&lt;br /&gt;   height: 76px;&lt;br /&gt;   border: 1px solid black;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;.stair3 { width:  245px;  &lt;br /&gt;   height:  70px;&lt;br /&gt;   border: 1px solid red;&lt;br /&gt;   }&lt;br /&gt;   &lt;br /&gt;.stair4 { width:  278px;&lt;br /&gt;   height: 112px;&lt;br /&gt;   border: 1px solid green;&lt;br /&gt;   }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;!-- The Markup --&amp;gt;&lt;br /&gt;&amp;lt;div id="stairs"&amp;gt;&lt;br /&gt;  &amp;lt;div id="csdiv"&amp;gt;&lt;br /&gt;    &amp;lt;img src="images/gown.png"&amp;gt;&lt;br /&gt;    &amp;lt;div class="stair1"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div class="stair2"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div class="stair3"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div class="stair4"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;p&amp;gt;&lt;br /&gt;  An evening gown is a long flowing women's dress usually worn....&lt;br /&gt;  &amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/stairs.jpg" alt="CSS Stair Effect" /&gt;&lt;h1&gt;CSS3 BORDER PROPERTIES&lt;/h1&gt;&lt;br /&gt;You can easily see the different elements when we turn the borders on.  The text is nicely flowing around our image.  We can dress up the border in Firefox by thickening the border, rounding its corners and dropping a shadow. The -webkit- prefix covers Safari/Chrome/Konqueror. I am not including it in the code here but you should:&lt;br /&gt;&lt;br /&gt;#stairs { &lt;br /&gt;border: 9px solid #f8d0d4;&lt;br /&gt;-moz-border-radius: 12px;&lt;br /&gt;-moz-box-shadow: -2px 2px 5px 1px #888;&lt;br /&gt;box-shadow: -2px 2px 5px 1px #888;&lt;br /&gt;border-radius: 12px;&lt;br /&gt;......&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;A LITTLE MARGIN GOES A LONG WAY&lt;/h1&gt;&lt;br /&gt;With the addition of the &lt;a href="http://pics.cssbakery.com/pics/wborder.jpg"&gt;thick border&lt;/a&gt; for the stairs div, the first thing that strikes you is the lack of padding/margin which we can take care of easily.  &lt;br /&gt;&lt;br /&gt;The text runs right up to the red border so one way to fix this is to give some padding or margin to one of the elements.  I'm going to add margin to the p element with &lt;b&gt;margin: 40px 0 40px 40px;&lt;/b&gt; statement.  There will be no margin for the right side because that could create problems by  keeping the text away from our "stairs".&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/wborder.jpg" alt="CSS3 Border" /&gt;&lt;br /&gt;Let's get the text and the image away from the border:&lt;br /&gt;&lt;br /&gt;#stairs p   { &lt;br /&gt;text-align: justify; &lt;br /&gt;margin: 40px 0 40px 40px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;A SET OF STAIRS KEEP THE TEXT AT BAY&lt;/h1&gt;&lt;br /&gt;Just so we are on the same page - if you are thinking the image itself is playing any role in arranging the text, you'd be wrong.  It's taken out of the flow by the absolute positioning and is only there for displaying purposes.  The 4 rectangles are now the "image".  As long as we overlay the image where the rectangles are stacked up, we'll fool the eye.&lt;br /&gt;&lt;br /&gt;#stairs { &lt;br /&gt;margin: 50px;&lt;br /&gt;width: 360px;&lt;br /&gt;font: 13px/1.7 Georgia;&lt;br /&gt;border: 9px solid #f8d0d4;&lt;br /&gt;-moz-border-radius: 12px;&lt;br /&gt;-moz-box-shadow: -2px 2px 5px 1px #888;&lt;br /&gt;border-radius: 12px;&lt;br /&gt;box-shadow: -2px 2px 5px 1px #888;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I am going to nudge the image up a little by absolutely positioning the top by -20 pixels.  This will move the image up a little above the border.  &lt;br /&gt;&lt;br /&gt;#stairs img { &lt;br /&gt;position: absolute; &lt;br /&gt;top:-20px; right:0;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;RELATIVE POSITIONING LEAVES A HOLE IN THE FLOW&lt;/h1&gt;&lt;br /&gt;#csdiv      { &lt;br /&gt;position: relative; &lt;br /&gt;right: -165px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To see the effects of the relative (moving the stairs to the right) and absolute positioning (moving the image up), take a look &lt;a href="http://pics.cssbakery.com/pics/thehole.jpg"&gt;here&lt;/a&gt;.  &lt;b&gt;csdiv&lt;/b&gt; is relatively positioned.  It's still in the flow but we have moved it to the right by 165 pixels. We are doing this because we want the image to pop out of its container and sit on top of the border.  But doing so will leave a &lt;a href="http://pics.cssbakery.com/pics/thehole.jpg"&gt;"hole"&lt;/a&gt; behind where &lt;b&gt;csdiv&lt;/b&gt; was going to be.  As far as the flow is concerned, it still is.  &lt;br /&gt;&lt;br /&gt;We are going fill in  the&lt;a href="http://pics.cssbakery.com/pics/thehole.jpg"&gt; yellow strip&lt;/a&gt; - leftover from the relative positioning - by bringing the text over to the right.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;NEGATIVE MARGIN TO PULL THE TEXT TO THE RIGHT&lt;/h1&gt;&lt;br /&gt;The curve will stay the same.  Every stair will get the same negative margin of minus 162 pixels.  I can turn off my debugging borders simply by setting all borders to none.&lt;br /&gt;&lt;br /&gt;/*negative margin to pull the text over*/&lt;br /&gt;.stair1, .stair2, .stair3, .stair4 { &lt;br /&gt;float: right; &lt;br /&gt;margin-left: -162px;&lt;br /&gt;border: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Notice how we have moved the image over the border of its containing div in the &lt;a href="http://pics.cssbakery.com/pics/finalgown.jpg" alt="CSS Curved Text Wrap" /&gt;final version&lt;/a&gt;.  I thought we were done then I remembered that I had replaced the first letter of the paragraph with a &lt;a href="http://pics.cssbakery.com/pics/35pxdropshadow.jpg" alt="" /&gt;dropcap&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;At the time I wrote the &lt;a href="http://www.cssbakery.com/2010/01/drop-caps-in-css.html"&gt;CSS Dropcap post&lt;/a&gt;, I didn't think a non-floated version was going to help anyone but maybe calm down people's fears about floats.  Well, as it turns out, a non-floated dropcap, "stylized_olho-a" in this case, is exactly what I needed for this example to work. &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;THE CSS &amp; THE MARKUP&lt;/h1&gt;&lt;br /&gt;If you want to see the entire CSS and markup based on this version, click &lt;a href="http://pics.cssbakery.com/pics/CSSCurvedTextWrap.txt"&gt;here&lt;/a&gt;.  HTML version &lt;a href="http://pics.cssbakery.com/pics/CSSCurvedText.html"&gt;here&lt;/a&gt;. The introductory gif shows the text lighter than I have in the image below. If you prefer it that way, update the paragraph selector with: #stairs p { color: #999999; }. &lt;br /&gt;&lt;br /&gt;For comparing the image below with what we started out, see  &lt;a href="http://pics.cssbakery.com/pics/cssbakeryCURVEDTEXT.jpg"&gt;here&lt;/a&gt;. Once again, the &lt;a href="http://pics.cssbakery.com/pics/gown.gif" alt="" /&gt;slideshow&lt;/a&gt; has the major steps of the tutorial.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/CSSDropCap.jpg" alt="CSS Curved Text Wrap" /&gt;&lt;br /&gt;&lt;!-- By the end of this post, our image will be absolutely positioned and the "stair" divs that will take the place of the image relatively positioned.  Any element that is absolutely positioned is out of the flow, the stairs will still be there but we have to fill in the hole left behind with a negative margin--&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2772153359972329062?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2772153359972329062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/12/curved-text-wrap-mock-slicing-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2772153359972329062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2772153359972329062'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/12/curved-text-wrap-mock-slicing-image.html' title='The Stair Effect: CSS Curved Text Wrap Using a Mock Sliced Image'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5791852962184539114</id><published>2011-11-11T21:43:00.000-08:00</published><updated>2012-01-19T19:57:39.659-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Classes and IDs'/><category scheme='http://www.blogger.com/atom/ns#' term='Size an Image Using CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='DIV'/><category scheme='http://www.blogger.com/atom/ns#' term='Image Grid'/><category scheme='http://www.blogger.com/atom/ns#' term='overflow: hidden;'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Art'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple class'/><category scheme='http://www.blogger.com/atom/ns#' term='overflow'/><category scheme='http://www.blogger.com/atom/ns#' term='Crop an Image Using CSS'/><title type='text'>Building Image Grids: Size and Crop an Image Using CSS</title><content type='html'>&lt;script type="text/javascript"&gt;$(window).load(function(){ $('#childjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img alt="19th Century Watercolor over Pen and Brown Ink&amp;lt;br&amp;gt;&amp;lt;em&amp;gt;Portrait of a Child, 1840&amp;lt;/em&amp;gt;&amp;lt;br&amp;gt;[Sir Edwin Henry Landseer]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved" id="childjpg" src="http://pics.cssbakery.com/pics/child.jpg" style="display: none;" /&gt;&lt;br /&gt;&lt;br /&gt;Sometimes you want to display an existing image in a different size and with a different crop, but without actually changing the image file itself.  For example if you are displaying a lot of images that reside on Flickr, you could consider making copies of all the images and editing those copies (e.g. using Photoshop) to resize and crop.  But that's a lot of work.  Instead, we can resize and crop the original images directly in the Browser using CSS.&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;RE-SIZING&lt;/h1&gt;&lt;br /&gt;The original image could be any size, so it's likely that we'll need to resize it to fit in with our page layout.  For example if we are laying out a grid of images we'll want to each image in the grid to be the same width and height.  Cropping, which we talk about below, can help, but if the image is large we don't want to just crop a small section of it.  Instead, we first want to scale the image to get as much of it as we can in our target rectangle, then we'll finish it off with a crop.  &lt;br /&gt;&lt;br /&gt;Scaling the image is pretty easy by setting the CSS width and height properties of the img tag.  But there is one trick here:  we never want to set both the width and height because then the image can be streched and distorted to meet the exact height and width we specify.  Instead, what we want to do is set only the width, or only the height, letting the other dimension be determined automatically, and thus preserving the original aspect ratio of the image.&lt;br /&gt;&lt;br /&gt;So one question we must answer for each image is:  Do we scale it by height, or by width?&lt;br /&gt;&lt;br /&gt;The answer depends on the aspect ratios of both the target rectangle, and the image.  Suppose our target rectangle has a height of 100px and a width of 150px, while the image we are displaying has a height of 200px and a width of 450px - the dimensions for the B/W composite image that appears below.  First lets consider what would happen if we scale the image width to be 150px in order to fit it into our target rectangle.&lt;br /&gt;&lt;br /&gt;That's a scaling factor of 1/3, so the height will also be multiplied by 1/3 and we'll end up with an image 150 pixels wide, but only 67 pixels in height.  Note that since we don't want to distort the image, we have to apply the same scaling factor of 1/3 to both the width and height.  But the resulting height of 67 pixels doesn't work since our target height is 100px. As you can see, our resized image got too small for our targeted window.  The blue area, which was supposed to be filled with the image, is empty.&lt;br /&gt;&lt;br /&gt;&lt;img alt="Scaling an Image" src="http://pics.cssbakery.com/pics/scalingdown.jpg" /&gt;&lt;br /&gt;So lets try scaling the image height to 100px instead.  That's a scaling factor of 1/2, so the width of the image gets reduced to 225px.  This is better since the image is still &lt;a href="http://pics.cssbakery.com/pics/cropwindow.jpg"&gt;large enough&lt;/a&gt; to fill our target rectangle.  Of course it's wider than our target, but we'll fix that by &lt;a href="http://pics.cssbakery.com/pics/cropwindow.jpg"&gt;cropping it&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Mathematically, the way to decide whether to scale the height or the width is to compute aspect ratios for both the target area and the image:&lt;br /&gt;&lt;pre&gt;A_Target = TargetWidth / TargetHeight&lt;br /&gt;A_Image  = ImageWidth / ImageHeight&lt;br /&gt;&lt;/pre&gt;Then compare them to decide whether to scale the image by height or width:&lt;br /&gt;&lt;pre&gt;if (A_Image &amp;gt; A_Target) then&lt;br /&gt;  scale image using height&lt;br /&gt;else&lt;br /&gt;  scale image using width&lt;br /&gt;&lt;/pre&gt;For the example discussed above, the calculations would be:&lt;br /&gt;&lt;pre&gt;A_Target = 150 / 100 = 3:2 = 1.5&lt;br /&gt;A_Image  = 450 / 200 = 9:4 = 2.25&lt;br /&gt;&lt;br /&gt;A_Image is greater than A_Target, so scale using height.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;CROPPING&lt;/h1&gt;&lt;br /&gt;To crop the image, we need to have a parent element that we set to the height and width of the target rectangle.  The img tag is a child of this parent element.  To crop, we just set the overflow property of the parent to hidden (overflow: hidden).  If the scaled image is wider than the parent, this will crop off the right portion of the image.  If the scaled image is taller than the parent, it will crop off the lower portion of the image.&lt;br /&gt;&lt;br /&gt;To crop equally from all sides, we need to pull the image to the left (or up) relative to the parent.  We can do this with negative margins.  So let's say the scaled image is 20px wider than the parent.  If we set margin-left of the image to be -10px, it will pull the image 10px to the left without affecting the parent, and the crop will be centered.  If the scaled image is taller then the parent, then use a negative margin-top to achieve the same effect.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;Given these &lt;a href="http://pics.cssbakery.com/pics/child.jpg"&gt;two images&lt;/a&gt; of varying dimensions - one's vertical and &lt;a href="http://pics.cssbakery.com/pics/childv.jpg"&gt;taller&lt;/a&gt;, the other's got a horizontal layout that's &lt;a href="http://pics.cssbakery.com/pics/childh.jpg"&gt;wider&lt;/a&gt; - let's display them with the same dimensions (height and width the same) in an image grid using CSS:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;.flickrgrid a {&lt;br /&gt;   height:275px;&lt;br /&gt;   width: 275px;&lt;br /&gt;   overflow: hidden;&lt;br /&gt;   float: left;&lt;br /&gt;   display: block;&lt;br /&gt;   margin-bottom: 25px;&lt;br /&gt;   }&lt;br /&gt;#image1 {&lt;br /&gt;   width: 275px;&lt;br /&gt;   }&lt;br /&gt;#image2 {&lt;br /&gt;   height: 275px;   &lt;br /&gt;   }&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class="flickrgrid"&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingv.jpg"&amp;gt;&amp;lt;img id="image1" src="images/drawingv.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingh.jpg"&amp;gt;&amp;lt;img id="images/drawingh.jpg"&amp;gt;&amp;lt;/a&amp;gt; &lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;style type="text/css"&gt;.flickrgrid a {   height:275px;   width: 275px;   overflow: hidden;   float: left;   display: block;   margin-bottom: 65px;   }#image1 {   width: 275px;   }#image2 {   height: 275px;      }&lt;/style&gt;&lt;br /&gt;&lt;div class="flickrgrid"&gt;&lt;a href="http://pics.cssbakery.com/pics/childv.jpg"&gt;&lt;img id="image1" src="http://pics.cssbakery.com/pics/childv.jpg" /&gt;&lt;/a&gt;&lt;a href="http://pics.cssbakery.com/pics/childh.jpg"&gt;&lt;img id="image2" src="http://pics.cssbakery.com/pics/childh.jpg" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;&lt;h1&gt;SAME EXAMPLE WITH LESS CSS&lt;/h1&gt;&lt;br /&gt;We can make the CSS more compact by using multiple classes.  The width and height will be set in only one place.  .window is made generic so that it can be used for a window of any dimension.  We are going to reduce the size of each image in the grid to 220 pixels down from 275 pixels that I used in the example above.  That'll give us extra room for right margin to separate the thumbnail images.&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;.window1, .window1 .taller { width: 220px; }&lt;br /&gt;.window1, .window1 .wider  { height: 220px; }&lt;br /&gt;&lt;br /&gt;.window {&lt;br /&gt;   overflow: hidden;&lt;br /&gt;   display: block;&lt;br /&gt;   float: left;&lt;br /&gt;   margin-right:20px;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&amp;lt;a class="window window1" href="images/drawingh.jpg"&amp;gt;&lt;br /&gt;&amp;lt;img class="wider" src="images/drawingh.jpg"&amp;gt;&lt;br /&gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;a class="window window1" href="images/drawingv.jpg"&amp;gt;&lt;br /&gt;&amp;lt;img class="taller" src="images/drawingv.jpg"&amp;gt;&lt;br /&gt;&amp;lt;/a&amp;gt;&lt;/pre&gt;&lt;style type="text/css"&gt;.window1, .window1 .taller { width: 220px; }.window1, .window1 .wider  { height: 220px; }.window {   overflow: hidden;   display: block;   float: left;   margin-right:20px;   }  .mock { margin-bottom: 30px;    /*this says your children are floated but you will grow big enough to      contain them */   overflow: auto;}&lt;/style&gt;&lt;br /&gt;&lt;div class="mock"&gt;&lt;a class="window window1" href="http://pics.cssbakery.com/pics/childh.jpg"&gt;&lt;img class="wider" src="http://pics.cssbakery.com/pics/childh.jpg" /&gt;&lt;/a&gt;&lt;a class="window window1" href="http://pics.cssbakery.com/pics/childv.jpg"&gt;&lt;img class="taller" src="http://pics.cssbakery.com/pics/childv.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1&gt;THREE IMAGE GRID&lt;/h1&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;.flickrgrid2 a {&lt;br /&gt;   height:150px;&lt;br /&gt;   width: 150px;&lt;br /&gt;   overflow: hidden;&lt;br /&gt;   float: left;&lt;br /&gt;   display: block;&lt;br /&gt;   margin-right: 15px;&lt;br /&gt;   margin-bottom: 25px;&lt;br /&gt;   }&lt;br /&gt;#image12 {&lt;br /&gt;   height: 150px;&lt;br /&gt;   }&lt;br /&gt;#image22 {&lt;br /&gt;   width: 150px;&lt;br /&gt;   }&lt;br /&gt;#image32 {&lt;br /&gt;   height: 150px;&lt;br /&gt;   }&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;div class="flickrgrid2"&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingv.jpg"&amp;gt;&amp;lt;img id="image22" src="images/drawingv.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;a href="images/pencils550x361.jpg"&amp;gt;&amp;lt;img id="image32" src="images/pencils550x361.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingh.jpg"&amp;gt;&amp;lt;img id="image12" src="images/drawingh.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;  &lt;/pre&gt;&lt;style type="text/css"&gt;.flickrgrid2 a {   height:150px;   width: 150px;   overflow: hidden;   float: left;   display: block;   margin-right: 20px;   margin-bottom: 65px;   }#image12 {   height: 150px;   }#image22 {   width: 150px;   }#image32 {   height: 150px;   }&lt;/style&gt;&lt;br /&gt;&lt;div class="flickrgrid2"&gt;&lt;a href="http://pics.cssbakery.com/pics/childv.jpg"&gt;&lt;img id="image22" src="http://pics.cssbakery.com/pics/childv.jpg" /&gt;&lt;/a&gt;&lt;a href="http://pics.cssbakery.com/pics/pencils550x361.jpg"&gt;&lt;img id="image32" src="http://pics.cssbakery.com/pics/pencils550x361.jpg" /&gt;&lt;/a&gt;&lt;a href="http://pics.cssbakery.com/pics/childh.jpg"&gt;&lt;img id="image12" src="http://pics.cssbakery.com/pics/childh.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1&gt;USING WIDER CROPS&lt;/h1&gt;&lt;br /&gt;Next we change the example above to make the cropping window wider than it is tall.  So it will no longer be a square of 150px on each side.  Instead it will be 150px tall and 180px wide.  To do this we need to set the width of the a tags to be 180px, and then any images that need to be scaled by width, we will also set to be 180px wide.&lt;br /&gt;&lt;br /&gt;The only tricky part of this is that since we are changing the width of the cropping window, it could mean that some images that we were previously scaling by height, now need to be scaled by width.  This happens if the aspect ratio of the scaling window is now larger than the aspect ratio of the image.  &lt;br /&gt;&lt;br /&gt;In our example the aspect ratio of the cropping window is changing from 1 (150/150) to 1.2 (180/150).  If we had images with an aspect ratio of say 1.1, then we would have been scaling them by width and cropping a little off the bottom, and now we need to scale them by height and crop a little off the right.&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;.flickrgrid3 a {&lt;br /&gt;   height:150px;&lt;br /&gt;   width: 180px;&lt;br /&gt;   overflow: hidden;&lt;br /&gt;   float: left;&lt;br /&gt;   display: block;&lt;br /&gt;   margin-right: 3px;&lt;br /&gt;   margin-bottom: 25px;&lt;br /&gt;   }&lt;br /&gt;#image12c {&lt;br /&gt;   height: 150px;&lt;br /&gt;   }&lt;br /&gt;#image22c {&lt;br /&gt;   width: 180px;&lt;br /&gt;   }&lt;br /&gt;#image32c {&lt;br /&gt;   height: 150px;&lt;br /&gt;   }&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class="flickrgrid3"&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingv.jpg"&amp;gt;&amp;lt;img id="image22c" src="images/drawingv.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;a href="images/pencils550x361.jpg"&amp;gt;&amp;lt;img id="image32c" src="images/pencils550x361.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;a href="images/drawingh.jpg"&amp;gt;&amp;lt;img id="image12c" src="images/drawingh.jpg"&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;style type="text/css"&gt;.flickrgrid3 a {   height:150px;   width: 180px;   overflow: hidden;   float: left;   display: block;   margin-right: 3px;   margin-bottom: 25px;   }#image12c {   height: 150px;   }#image22c {   width: 180px;   }#image32c {   height: 150px;   }&lt;/style&gt;&lt;br /&gt;&lt;div class="flickrgrid3"&gt;&lt;a href="http://pics.cssbakery.com/pics/childv.jpg"&gt;&lt;img id="image22c" src="http://pics.cssbakery.com/pics/childv.jpg" /&gt;&lt;/a&gt;&lt;a href="http://pics.cssbakery.com/pics/pencils550x361.jpg"&gt;&lt;img id="image32c" src="http://pics.cssbakery.com/pics/pencils550x361.jpg" /&gt;&lt;/a&gt;&lt;a href="http://pics.cssbakery.com/pics/childh.jpg"&gt;&lt;img id="image12c" src="http://pics.cssbakery.com/pics/childh.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="related_thumbnail" style="clear: both;"&gt;&lt;img alt="" src="http://pics.cssbakery.com/pics/gridrelatedicon.jpg" title="" /&gt;&lt;br /&gt;&lt;h4&gt;CSS Image Grids&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/css-image-grid-using-sprites_30.html"&gt;Grid Using  Sprites&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html"&gt;Grid Using CSS Floats&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/11/size-and-crop-image-using-css.html"&gt;Building Grids: Size and Crop an Image Using CSS&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5791852962184539114?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5791852962184539114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/11/size-and-crop-image-using-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5791852962184539114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5791852962184539114'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/11/size-and-crop-image-using-css.html' title='Building Image Grids: Size and Crop an Image Using CSS'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5324671256398794797</id><published>2011-07-04T20:32:00.000-07:00</published><updated>2011-09-04T19:48:32.113-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Happy 4th</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#july4gif').cssBakeryCaption({'opacity':'0.5','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'#15157d'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='july4gif' style='display:none;' src='http://pics.cssbakery.com/pics/july4.gif' alt='[Catalina 38]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5324671256398794797?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5324671256398794797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/07/happy-july-4th.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5324671256398794797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5324671256398794797'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/07/happy-july-4th.html' title='Happy 4th'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5049487614551867972</id><published>2011-05-30T14:27:00.000-07:00</published><updated>2011-11-11T21:57:36.647-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Background Property'/><category scheme='http://www.blogger.com/atom/ns#' term='GraublauWeb'/><category scheme='http://www.blogger.com/atom/ns#' term='Image Grid'/><category scheme='http://www.blogger.com/atom/ns#' term='Floating LI element'/><category scheme='http://www.blogger.com/atom/ns#' term='Sprite'/><category scheme='http://www.blogger.com/atom/ns#' term='Floating'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Background Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='Art'/><title type='text'>CSS Image Grid Using Sprites</title><content type='html'>&lt;div class="imggrid_display"&gt;&lt;ul class="imggrid"&gt;&lt;li&gt;&lt;a id="col1" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col2" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col3" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col4" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col5" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col6" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col7" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col8" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a id="col9" href="#"&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Still Life&lt;/h2&gt;&lt;p&gt;© Copyright 2011 | www.cssbakery.com | All Rights Reserved&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;When we worked on a &lt;a href="http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html"&gt;CSS image grid&lt;/a&gt; last summer, I thought later I'd complete a second version using sprites to show you how that approach can improve performance.  I should make notes to myself about loose ends like that because somewhere along the way, I forgot about it.   Last week, an email about the original grid reminded me.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html"&gt;grid post&lt;/a&gt; is popular, the sprite change is easy enough, so let's implement it.  By the way, the grid above is a real-time working example generated through HTML included within this post and styles that come from a style sheet. Each thumbnail is clickable but needs a URL assigned to its &lt;i&gt;a&lt;/i&gt; element before it'll take you somewhere.&lt;br /&gt;&lt;br /&gt;The thumbnail images are still life on black, which is a hobby of mine.  I had to crop some of them quite a bit in order to fit them here.  Images were saved in low resolution to speed up things for the web.&lt;br /&gt;&lt;br /&gt;I made a new copy of the old CSS styles just to keep things from tangling with each other.  Most of the code is recycled so for detailed explanations, see this previous &lt;a href="http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html"&gt;post&lt;/a&gt;.  I posted several times on &lt;a href="http://www.cssbakery.com/2009/06/shifting-background-image.html"&gt;sprites &lt;/a&gt;before if you need help to figure out what those are about.  &lt;br /&gt;&lt;br /&gt;Keep in mind that my space on the blog is limited to 550 pixels, you can adjust the width to fit your requirements and increase the number of columns of your grid as you wish.  You'll find the markup at the end of the CSS.  &lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;ul.imggrid {&lt;br /&gt;  padding: 0;&lt;br /&gt;  list-style: none;&lt;br /&gt;  margin: 0 auto;&lt;br /&gt;  width: 495px;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;.imggrid li {&lt;br /&gt;    float: left;&lt;br /&gt;    padding: 1px;&lt;br /&gt;    border: 1px solid #cbcad0;&lt;br /&gt;    margin: 0 5px 10px 5px;&lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;.imggrid_display {&lt;br /&gt;   padding: 20px;&lt;br /&gt;   margin: 0 auto;&lt;br /&gt;   width: 513px; &lt;br /&gt;   /*these two properties will be inherited by .portfolio h2 and .portfolio p */&lt;br /&gt;   font-family: 'GraublauWeb', arial, serif; &lt;br /&gt;   text-align: center;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  /* .post-body is only for those who are on Blogger, or all others please skip &lt;br /&gt;     it and write your selector as "div.imggrid_display h2" without the quotes&lt;br /&gt;  */&lt;br /&gt;  .post-body div.imggrid_display h2 {&lt;br /&gt;     padding: 0; margin: 0;&lt;br /&gt;     clear: both;&lt;br /&gt;     font-size: 35px;&lt;br /&gt;     font-weight: normal;&lt;br /&gt;     color: #58595b;&lt;br /&gt;     background: none;&lt;br /&gt;     font-family: 'GraublauWeb', arial, serif;  &lt;br /&gt;     /* reset for cascade effects that are trickling down to me &lt;br /&gt;       from other h2's &lt;br /&gt;    */&lt;br /&gt;     text-transform: none;&lt;br /&gt;     letter-spacing: normal;&lt;br /&gt;     }&lt;br /&gt;  &lt;br /&gt;  .imggrid_display p {&lt;br /&gt;      margin:0; padding: 0;&lt;br /&gt;      font-size: 15px;&lt;br /&gt;      color: #58595b;&lt;br /&gt;      }&lt;br /&gt;  &lt;br /&gt;/* sprites for imggrid */&lt;br /&gt;.imggrid a {&lt;br /&gt;    background: url('images/spritebitmaps.jpg') no-repeat;&lt;br /&gt;    height: 150px;&lt;br /&gt;    width: 150px;&lt;br /&gt;    display: block;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;/*sprites*/&lt;br /&gt;.imggrid a#col1 {background-position: 0 0;}&lt;br /&gt;.imggrid a#col2 {background-position:  -150px 0;}&lt;br /&gt;.imggrid a#col3 {background-position: -300px 0;}&lt;br /&gt;.imggrid a#col4 {background-position:  -450px 0;}&lt;br /&gt;.imggrid a#col5 {background-position:  -600px 0;}&lt;br /&gt;.imggrid a#col6 {background-position:  -750px 0;}&lt;br /&gt;.imggrid a#col7 {background-position:  -900px 0;}&lt;br /&gt;.imggrid a#col8 {background-position:  -1050px 0;}&lt;br /&gt;.imggrid a#col9 {background-position:  -1200px 0;}&lt;br /&gt;/* end sprites for imggrid */&lt;br /&gt;/* end imggrid block */      &lt;/pre&gt;&lt;br /&gt;Important note for the CSS: .post-body is only for those who are on Blogger, All others please skip it and write your selector as &lt;i&gt;div.imggrid_display h2 &lt;br /&gt;&lt;/i&gt;&lt;br /&gt;Fill in your own URLs for the a href's. The markup:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div class="imggrid_display"&amp;gt;&lt;br /&gt;&amp;lt;ul class="imggrid"&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col1" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col2" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col3" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col4" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col5" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col6" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col7" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col8" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a id="col9" href="#"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;Still Life&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;© Copyright 2011 | www.cssbakery.com | All Rights Reserved&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;THE "SPRITE" FILE&lt;/h1&gt;&lt;br /&gt;All the images used in forming the grid reside in the same file avoiding multiple GETs which saves time and loads the page smoother. I did not leave any space between my images but for clarity and ease of edit, you might want to include at least a single line as a separator between yours.  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/spritecapture.jpg"&gt;&lt;br /&gt;&lt;br /&gt;Since my images are each 150 pixels wide and stacked next to each other with no separator space, I shift the sprite file by a factor of 150 times the order of each image in the file to get to that image.  &lt;br /&gt;&lt;br /&gt;To give you an example, the red tulip is fifth in line so I multiply 150 by (5-1). I  subtracted 1 since we start counting from zero.  In other words, I have to shift the background image by 600 pixels to get to the tulip.   &lt;br /&gt;&lt;br /&gt;The background position x value is negative at -600 pixels because we want to pull the image to the left.  If it helps any, think of the negative x axis from school.  You are pulling the parts of the image that you don't want into that quadrant and showing only a portion of the remaining in the positive quadrant.  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/spriteillustration.jpg" alt="Explaining Sprite Shifting in Background Image" title="Explaining Sprite Shifting in Background Image"&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;NTH CHILD OF CSS3&lt;/h1&gt;&lt;br /&gt;We can improve the CSS by including the nth-child construct from CSS3.  It will simplify both the CSS and the markup.  Off the top of my head, I couldn't tell you how widespread it's implemented in browsers, except that Firefox 3.5 and greater supports it and IE8 and below doesn't.  The fact that IE8 does not support it is a dealbreaker and the reason why we cannot use in official code yet.  There are still a lot of users running Windows XP, which does not support IE9. Anyway, I will show you how the nth child works in a separate post. &lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="related_thumbnail" style="clear: both;"&gt;&lt;img src="http://pics.cssbakery.com/pics/gridrelatedicon.jpg" alt="" title="" /&gt;&lt;h4&gt;CSS Image Grids&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/css-image-grid-using-sprites_30.html"&gt;Grid Using  Sprites&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/07/image-grid-using-css-floats_6950.html"&gt;Grid Using CSS Floats&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/11/size-and-crop-image-using-css.html"&gt;Building Grids: Size and Crop an Image Using CSS&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1&gt;AN IMAGE GRID FOR YOUR WALL&lt;/h1&gt;&lt;br /&gt;This has nothing to do with software but the idea is very similar to the grid that we just talked about with the only difference being where the images go - on a computer screen or  a wall. If you have a collection of pictures - with the proliferation of digital cameras who doesn't these days - you can print them on canvas with a wide format &lt;a href="http://www.amazon.com/Canon-Pro9000-Professional-Printer-9995A001/dp/B000J1HPK8/ref=sr_1_1?ie=UTF8&amp;qid=1306712457&amp;sr=8-1"&gt;printer&lt;/a&gt;. Once the prints are made, stretch them on ready-made canvas frames.  Arrange the finished pictures in a grid on a bare wall and surround the arrangement with a hollow but complete frame. No need for glass, matting, or mounting.  Finish it off with a picture light. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/frameg.jpg" alt="Grid on a Wall"&gt;&lt;br /&gt;&lt;div class="credits"&gt;Images and Text © Copyright 2011 &lt;a href="www.cssbakery.com"&gt;cssbakery.com&lt;/a&gt;&lt;br /&gt;Brass Picture Light Image © Copyright &lt;a href="http://www.gracioushome.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10051&amp;productId=12647&amp;sideBarCatId=10007"&gt;Gracious Home&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5049487614551867972?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5049487614551867972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/05/css-image-grid-using-sprites_30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5049487614551867972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5049487614551867972'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/05/css-image-grid-using-sprites_30.html' title='CSS Image Grid Using Sprites'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2148839051626228767</id><published>2011-05-30T03:53:00.000-07:00</published><updated>2011-05-30T14:53:30.554-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraublauWeb'/><category scheme='http://www.blogger.com/atom/ns#' term='IE'/><category scheme='http://www.blogger.com/atom/ns#' term='font-face'/><title type='text'>Fixing font-face Problems in IE</title><content type='html'>GraublauWeb font was working fine in Firefox for me but not in IE.  I have the before's and after's to show you the changes that I had to make in order to have it working in IE.  To implement font-face that will work across browsers, use &lt;a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/"&gt;Fontspring @font-face&lt;/a&gt; syntax.&lt;br /&gt;&lt;br /&gt;BEFORE:&lt;br /&gt;@font-face { &lt;br /&gt;font-family:'GraublauWeb'; &lt;br /&gt;src: url(http://pics.cssbakery.com/fonts/GraublauWeb.eot);&lt;br /&gt;src: url(http://pics.cssbakery.com/fonts/GraublauWeb.otf) format("opentype");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;AFTER:&lt;br /&gt;@font-face { &lt;br /&gt;font-family:'GraublauWeb'; &lt;br /&gt;src: url("http://pics.cssbakery.com/fonts/GraublauWeb.eot?") format('eot'), url(http://pics.cssbakery.com/fonts/GraublauWeb.otf) format("opentype");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/cufonicon.jpg" alt="summary of font related posts"  /&gt;&lt;h4&gt;google fonts + cufon + font-face&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/fixing-font-face-problems-in-ie.html"&gt;Fixing font-face Problems in IE&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/browser-caching-server-data.html"&gt;Caching Cufon Javascript Files via Apache HTTP Response Headers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/update-google-webfont-fout-flash-of.html"&gt;Update: Google WebFonts FOUT Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/google-web-fonts-flash-of-unstyled-text.html"&gt;Google WebFonts FOUT Problem with wf-active&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html"&gt;Fixing Firefox font-face Cross Domain Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html"&gt;Cufon with Variants of the Same Font Family&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2148839051626228767?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2148839051626228767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/05/fixing-font-face-problems-in-ie.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2148839051626228767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2148839051626228767'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/05/fixing-font-face-problems-in-ie.html' title='Fixing font-face Problems in IE'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5552322429842842193</id><published>2011-05-22T21:00:00.000-07:00</published><updated>2011-05-22T23:33:07.356-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Headers'/><category scheme='http://www.blogger.com/atom/ns#' term='Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP'/><category scheme='http://www.blogger.com/atom/ns#' term='Cache'/><category scheme='http://www.blogger.com/atom/ns#' term='Caching'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Response Headers'/><category scheme='http://www.blogger.com/atom/ns#' term='Browser Internals'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Request Headers'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache'/><category scheme='http://www.blogger.com/atom/ns#' term='Cufon'/><title type='text'>Caching Cufon Javascript Files via Apache HTTP Response Headers</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#httpgetsgif').cssBakeryCaption({'opacity':'0.7','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#01a44a'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='httpgetsgif' style='display:none;' src='http://pics.cssbakery.com/pics/httpgets.gif' alt='Browser, Browser Cache and Server&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;In a comment on a previous post, someone wanted to know how to &lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html?showComment=1304845378893#c659082096666963201"&gt;cache data&lt;/a&gt; returned by the server in order to save time from extra Cufon Javascript file loads.  In Cufon, the data that describes the font is placed in a Javascript file.  This is the file you download when running the Cufon generator.&lt;br /&gt;&lt;br /&gt;When using Cufon, one thing we do not want is for the browser to retrieve a fresh copy of that Javascript file each time the page loads or refreshes.  After the Browser has downloaded the file once, we'd like to cache it to save the download time.&lt;br /&gt;&lt;br /&gt;You can see here in Firebug that the Javascript files we are downloading with the Cufonized "MS Trebuchet" font does not have &lt;a href="http://pics.cssbakery.com/pics/httpget1.jpg"&gt;HTTP Expires or Cache Control headers&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;But you can see here that font files downloaded from Google have &lt;a href="http://pics.cssbakery.com/pics/httpget2.jpg"&gt;both an Expires and Cache Control header&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We want to have the Expires and Cache-Control headers sent down with our Cufon-generated Javascript files.  To do this, we can make a change to our Apache server configuration to tell it to send down these headers.&lt;br /&gt;&lt;br /&gt;We simply need to put a .htaccess file on the server in the directory where the Cufon js file resides.&lt;br /&gt;&lt;br /&gt;We can do that by either logging on to our server using SSH and creating the file with an editor on the server, or we can create the file on our local machine and transfer it to the server using Filezilla or other file transfer program.&lt;br /&gt;&lt;br /&gt;The file must be called .htaccess, and will have these contents:&lt;br /&gt;&lt;br /&gt;&amp;lt;Files *.js&amp;gt;&lt;br /&gt;Header add "Cache-Control" "max-age=604800"&lt;br /&gt;Header set Expires "Thu, 14 May 2015 20:00:00 GMT"&lt;br /&gt;&amp;lt;/Files&amp;gt;&lt;br /&gt;&lt;br /&gt;The max-age parameter of the Cache-Control header tells the Browser that the file can be cached until the given number of seconds elapses.  The Expires header tells the Browser that the current file expires at a future time, after which the Browser should re-download a fresh copy instead of using the verion in cache.&lt;br /&gt;&lt;br /&gt;By placing a .htaccess file in a directory on the server, you are telling Apache to apply some additional configuration settings just for the files in that directory.  Since the .htaccess file as written will apply to all .js files in the directory, you want to make sure that it is OK to cache all of those files.  If there is a .js file that you think should not be cached (e.g. because you are making frequent changes to it), then you should place that file in a separate directory that does not have the same .htaccess file settings.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;With &lt;a href="http://pics.cssbakery.com/pics/httpget3.jpg"&gt;these changes applied&lt;/a&gt;, you can now see that the Expires and Cache-Control headers are being sent down for the "MS Trebuchet" font file.&lt;br /&gt;&lt;br /&gt;A couple of other things to point out in the Response Headers are the "Last Modified" and "Etag" headers, as seen below.  These are used in conjunction with the "If-Modified-Since" and "If-None-Match" request headers that the Browser sends to the Server.  Basically the Browser remembers the last modified date from the "Last Modified" header, and the ETag value from the ETag header.  It then sends those values back to the Server in the "If-Modified-Since" and "If-None-Match" headers, respectively.  That allows Apache to then compare the values the Browser is sending up to the current version of the file residing on the server.  Apache then makes a decision about whether the file should be sent down to the Browser, vs. telling to Browser to use the version in its cache.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/httpget4.jpg" alt="" title="" /&gt;&lt;br /&gt;&lt;br /&gt;So, just to re-iterate:&lt;br /&gt;&lt;br /&gt;The If-Modified-Since request header asks the server if the file has changed since a certain date/time which is the date/time that the Browser received in the "Last Modifield" header.  If the server sees that it has not been modified since then, it will send back a 304 Not Modified response, and the file content will not be sent down to the Browser.&lt;br /&gt;&lt;br /&gt;The If-None-Match request header asks the server if the file's ETag value matches the ETag that was sent by the server when the Browser last downloaded the file.  If the server sees that the ETag is unchanged, then it will send back a 304 Not Modified response, and the file content is not sent down to the Browser.&lt;br /&gt;&lt;br /&gt;The ETag and "Last Modified" headers can be turned on/off via Apache configuration.  My server already has them turned on, and I'll leave them that way.  The one case where you would want to turn them off is if  your site is hosted across multiple servers where the same file can come from one of many servers in a cluster, and where the file can have different attributes on the different servers in the cluster.  In that case you are better off relying on just the Expires and Cache-Control headers.&lt;br /&gt;&lt;br /&gt;As you can see there are multiple mechanisms in HTTP that can help the Browser to use files from its cache rather than re-downloading them, and each mechanism has its strengths and weaknesses.&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/a13a.jpg" alt="" title="" /&gt;&lt;h4&gt;CUFON&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/browser-caching-server-data.html"&gt;Caching Cufon Javascript Files via Apache HTTP Response Headers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html"&gt;Cufon with Same Font Family/Different Weights&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5552322429842842193?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5552322429842842193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/05/browser-caching-server-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5552322429842842193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5552322429842842193'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/05/browser-caching-server-data.html' title='Caching Cufon Javascript Files via Apache HTTP Response Headers'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3498199432057397427</id><published>2011-05-09T22:10:00.000-07:00</published><updated>2011-05-10T10:59:15.690-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>The Milky Way</title><content type='html'>&lt;iframe src="http://player.vimeo.com/video/22439234" width="400" height="225" frameborder="0"&gt;&lt;/iframe&gt;&lt;p&gt;Most of us live in big cities with a lot of  light pollution making stargazing impossible.   If you've never seen our galaxy at night,  &lt;a href="http://vimeo.com/22439234"&gt;Terje Sorgjerd's&lt;/a&gt;  time-lapse piece, shot with a 5D will surprise you. &lt;br /&gt;&lt;br /&gt;Speaking of stars, I remember a night many years ago in a small coastal town,  when I unwittingly stepped into a meteor shower.   It was a warm summer night, I had gone out onto the balcony for some air.   I thought I was dreaming when the first shooting star streaked across the navy sky.  Within a minute, another followed and another..and... It was magical. &lt;br /&gt;&lt;br /&gt;In the same town,  a large octopus had taken up residence under a rock in the deeper waters of the calm, crystal clear sea.  Those of us who knew kept quiet because we didn't want the local restaurant owner to get any ideas for his &lt;a href="http://upload.wikimedia.org/wikipedia/commons/3/34/Fried_calamari.jpg"&gt;appetizer menu&lt;/a&gt;.  Whenever I went out for a swim, I'd take a look to see if he moved.  Octopus are shy creatures and for the most part not dangerous.  He'd always leave one of his arms outside.  Maybe that was his favorite resting position, one tentacle out, the rest of him tucked under the rock, his pillow.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3498199432057397427?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3498199432057397427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/05/milky-way-from-mountain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3498199432057397427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3498199432057397427'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/05/milky-way-from-mountain.html' title='The Milky Way'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7644600855275781591</id><published>2011-05-03T22:17:00.000-07:00</published><updated>2011-05-22T23:37:23.755-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cufon'/><title type='text'>Cufon Multiple Fonts Using Same Font with Different Weights</title><content type='html'>Someone asked me a &lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;question&lt;/a&gt; about using a Cufon generated font with two different weights.  We know that Cufon works for multiple fonts but when he tried to use the different weights of the same font, it sounded like it didn't work for him.  I don't have Myriad Pro on this computer so I am going to test this idea with the ubiquitous MS Trebuchet, in regular and bold.  &lt;br /&gt;&lt;br /&gt;In Windows find the fonts under Control Panel fonts and copy them to your desktop.  In my case, the names of the files are trebuc.ttf and trebucbd.ttf.  Then go to the &lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;Using Cufon&lt;/a&gt; post or &lt;a href="http://cufon.shoqolate.com/generate/"&gt;use this link&lt;/a&gt;  to generate the fonts at Cufon's site.&lt;br /&gt;&lt;br /&gt;&amp;lt;script src='http://pics.cssbakery.com/pics/Trebuchet_MS_400-Trebuchet_MS_700.font.js' type='text/javascript'/&amp;gt;&lt;br /&gt;&lt;br /&gt;Cufon placed both of the fonts in the same Javascript file.  That's fine. I opened the &lt;a href="http://pics.cssbakery.com/pics/Trebuchet_MS_400-Trebuchet_MS_700.font.js"&gt;.js file &lt;/a&gt;above in Wordpad to get the names of the fonts.  They used the same name for both weights.  We have to know how to express the bold font in Cufonspeak.  I check their documentation for their &lt;a href="https://github.com/sorccu/cufon/wiki/API"&gt;API&lt;/a&gt; to find out about a parameter named &lt;i&gt;fontWeight&lt;/i&gt;. Problem solved.&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;Cufon.replace('p.mstest',{fontFamily: 'Trebuchet MS'} );&lt;br /&gt;Cufon.replace('p.mstest2',{fontFamily: 'Trebuchet MS', fontWeight:'bold'} );&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;Simple color styling for the two classes.  You don't even have to do this:&lt;br /&gt;.mstest, .mstest2 { color: #817BBA; }&lt;br /&gt;&lt;br /&gt;The HTML for testing:&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;p class="mstest"&amp;gt;&lt;br /&gt;Testing the p.mstest font - This is Cufon generated Trebuchet MS&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p class="mstest2"&amp;gt;&lt;br /&gt;Testing the p.mstest2 font - This is Cufon generated Trebuchet MS Bold&amp;lt;/p&amp;gt;  &lt;/pre&gt;&lt;br /&gt;The output:&lt;br /&gt;&lt;p class="mstest"&gt;Testing the p.mstest font - This is Cufon generated Trebuchet MS&lt;/p&gt;&lt;p class="mstest2"&gt;Testing the p.mstest2 font - This is Cufon generated Trebuchet MS Bold&lt;/p&gt;&lt;br /&gt;So you can make Cufon work for the variants of the same font family.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/a13a.jpg" alt="" title="" /&gt;&lt;h4&gt;CUFON&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/browser-caching-server-data.html"&gt;Caching Cufon Javascript Files via Apache HTTP Response Headers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html"&gt;Cufon with Same Font Family/Different Weights&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7644600855275781591?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7644600855275781591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7644600855275781591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7644600855275781591'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html' title='Cufon Multiple Fonts Using Same Font with Different Weights'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8007647162495948950</id><published>2011-04-20T22:54:00.000-07:00</published><updated>2011-04-21T19:17:56.232-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='External Enclosure'/><category scheme='http://www.blogger.com/atom/ns#' term='NexStar'/><category scheme='http://www.blogger.com/atom/ns#' term='Removing Hard Disk in a Laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='USB Device'/><title type='text'>How To Access Your Disk in an Unresponsive Laptop</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#enclosurejpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='enclosurejpg' style='display:none;' src='http://pics.cssbakery.com/pics/enclosure.jpg' alt='Installing a Hard Drive in an External Enclosure&amp;lt;br&amp;gt;[NexStar]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;I wonder if extra cooling would prevent untimely exits.  Another laptop of mine is RIP.  From the looks of it, it's the motherboard since the machine won't even go through the ROM sequence.   A little whir of the disk then pitch black.  &lt;br /&gt;&lt;br /&gt;Say you're in a similar situation and you'd like to salvage the data on the disk.  One way is to remove the disk from the computer to turn it into an external drive.  In my 17 inch Toshiba Satellite, I had to take a few screws off of a small panel next to the fan in the bottom to get to the hard drive.  The disk has a clear plastic tab on it for easy removal.   But first we have to disconnect it from the laptop so you gently push the disk down with a few fingers to disengage the pins. Then grab it by the tab and pull it up and out of the laptop.  &lt;br /&gt;&lt;br /&gt;The disk is in a &lt;a href="http://pics.cssbakery.com/pics/disk.gif"&gt;metal cage&lt;/a&gt; which you have to remove before you can install it in one of these &lt;a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817145133&amp;cm_re=nexstar_3-_-17-145-133-_-Product"&gt;colorful enclosures&lt;/a&gt;, available from Newegg or Staples.  Connect the pins of the disk (male) with the enclosure (female), line up the holes and then put in about 4 screws and you got yourself a new USB device and a way to access your old files from another computer.  &lt;br /&gt;&lt;br /&gt;PS Be careful when handling the disk itself as there are exposed chips that are sensitive to static electricity, which can damage them.  I try to handle the disk by the edges and not touch the circuitry.  If the machine has any exposed metal, then you could touch it before you begin working to ground yourself and hopefully discharge any static electricity.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8007647162495948950?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8007647162495948950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/how-to-access-your-disk-in-unresponsive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8007647162495948950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8007647162495948950'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/how-to-access-your-disk-in-unresponsive.html' title='How To Access Your Disk in an Unresponsive Laptop'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3401237326799132938</id><published>2011-04-13T22:47:00.000-07:00</published><updated>2011-04-21T20:20:34.432-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Art'/><title type='text'>Sailboat</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#boatdrawing1jpg').cssBakeryCaption({'opacity':'0.7','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#4673ab'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='boatdrawing1jpg' style='display:none;' src='http://pics.cssbakery.com/pics/boatdrawing1.jpg' alt='Sailboat&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3401237326799132938?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3401237326799132938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/sailboats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3401237326799132938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3401237326799132938'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/sailboats.html' title='Sailboat'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5539531887016965115</id><published>2011-04-10T23:26:00.000-07:00</published><updated>2011-12-26T14:38:12.565-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ul'/><category scheme='http://www.blogger.com/atom/ns#' term='a href'/><category scheme='http://www.blogger.com/atom/ns#' term='span'/><category scheme='http://www.blogger.com/atom/ns#' term='width'/><category scheme='http://www.blogger.com/atom/ns#' term='li'/><category scheme='http://www.blogger.com/atom/ns#' term='Sprite'/><category scheme='http://www.blogger.com/atom/ns#' term='height'/><category scheme='http://www.blogger.com/atom/ns#' term='display'/><category scheme='http://www.blogger.com/atom/ns#' term='display:block; display:none'/><category scheme='http://www.blogger.com/atom/ns#' term='outline:none'/><category scheme='http://www.blogger.com/atom/ns#' term='Classes and IDs'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='Navigation Menu'/><category scheme='http://www.blogger.com/atom/ns#' term='Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='a:hover'/><title type='text'>CSS Hover Menu on a Post-it Note</title><content type='html'>&lt;ul id="menu"&gt;&lt;li&gt;&lt;a href="#" class="things"&gt; &lt;span&gt;Things&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#" class="notes"&gt; &lt;span&gt;Notes&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#" class="posts"&gt; &lt;span&gt;Posts&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#" class="calendar"&gt; &lt;span&gt;Calendar&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Hover over the yellow note to see how it changes. Example bitmap for the hover menu sprite:&lt;br /&gt;&lt;img style="border: 1px dotted black;" src="http://pics.cssbakery.com/pics/examplepng.jpg" alt="CSS Hover Menu" title="CSS Hover Menu" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;!-- name of the file is testCSS3.html --&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;&lt;br /&gt;#menu {&lt;br /&gt;  list-style: none;&lt;br /&gt;  width: 164px;&lt;br /&gt;  height: 155px;&lt;br /&gt;  background: url(images1/yellownote.png) no-repeat;&lt;br /&gt;  position: relative;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu span {&lt;br /&gt;  display: none;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu a {&lt;br /&gt;  display: block;&lt;br /&gt;  position: absolute;&lt;br /&gt;  outline: none;&lt;br /&gt;  width: 126px;&lt;br /&gt;  height: 50px;&lt;br /&gt;  left: 12px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu a:hover {&lt;br /&gt;  background-position: 0 top;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;#menu .things {&lt;br /&gt;  /* width: 126px;  height: 50px;  left: 12px; coming from "#menu a" &lt;br /&gt;     for .things, .notes, .posts, .calendar&lt;br /&gt;  */&lt;br /&gt;  background: url(images1/things.png) -126px top no-repeat;&lt;br /&gt;  top: 8px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu .notes {&lt;br /&gt;  background: url(images1/notes.png) -126px top no-repeat;&lt;br /&gt;  top: 40px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu .posts {&lt;br /&gt;  background: url(images1/posts.png) -126px top no-repeat;&lt;br /&gt;  top: 68px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#menu .calendar{&lt;br /&gt;  background: url(images1/calendar.png) -126px top no-repeat;&lt;br /&gt;  top: 105px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ul id="menu"&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;&amp;lt;a href="#" class="things"&amp;gt; &amp;lt;span&amp;gt;Things&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;&amp;lt;a href="#" class="notes"&amp;gt; &amp;lt;span&amp;gt;Notes&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;&amp;lt;a href="#" class="posts"&amp;gt; &amp;lt;span&amp;gt;Posts&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;&amp;lt;a href="#" class="calendar"&amp;gt; &amp;lt;span&amp;gt;Calendar&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;  &lt;/pre&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;img  src="http://pics.cssbakery.com/pics/postitonmenu.jpg" alt="CSS Hover Menu" title="CSS Hover Menu" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5539531887016965115?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5539531887016965115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/css-hover-menu-on-post-it-note.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5539531887016965115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5539531887016965115'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/css-hover-menu-on-post-it-note.html' title='CSS Hover Menu on a Post-it Note'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-6120150179992762534</id><published>2011-04-03T01:06:00.000-07:00</published><updated>2012-01-02T23:32:30.855-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fluid Rose for Zen Garden'/><category scheme='http://www.blogger.com/atom/ns#' term='Dave Shea'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Zen Garden'/><title type='text'>CSS Zen Garden Series</title><content type='html'>&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/q6g.jpg" alt="" title="" /&gt;&lt;h4&gt;CSS Zen Garden Series &lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/04/positioning-extra-divs-in-css-zen.html"&gt;Styling ExtraDiv1, Part 8&lt;/a&gt; | &lt;a href="http://pics.cssbakery.com/pics/zenGardenFinal.html"&gt;Final Design&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/04/styling-css-zen-garden-menu.html"&gt;Styling the CSS Zen Garden Menu, Part 7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/11/styling-zen-garden-footer.html"&gt;Styling the CSS Zen Garden Footer, Part 6&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/preamble-we-have-to-make-z-index-for.html"&gt;Styling the CSS Zen Garden Text Paragraphs, Part 5&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/in-our-last-post-we-took-stroll-through.html"&gt;Spider &amp;amp; Rose for CSS Zen Garden, Part 4&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/zen-garden-xhtml-elements.html"&gt;CSS Zen Garden HTML Elements, Part 3&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://websiteraising.blogspot.com/2009/09/zen-garden-markup.html"&gt;CSS Zen Garden Markup, Part 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/09/walking-over-to-css-zen-garden.html"&gt;Walking over to the Zen Garden, Part 1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/pics/zenGardenFinal.html" target="_blank"&gt;&lt;img src="http://pics.cssbakery.com/pics/zengardenFinalPage.jpg" alt="CSS Zen Garden Screenshot" title="Fluid Rose - A Design for Dave Shea's CSS Zen Garden"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-6120150179992762534?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/6120150179992762534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/css-zen-garden-series.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6120150179992762534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6120150179992762534'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/css-zen-garden-series.html' title='CSS Zen Garden Series'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-9213791784776761698</id><published>2011-04-02T15:29:00.000-07:00</published><updated>2011-04-05T11:55:09.771-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='Fluid Rose for Zen Garden'/><category scheme='http://www.blogger.com/atom/ns#' term='top'/><category scheme='http://www.blogger.com/atom/ns#' term='z-index'/><category scheme='http://www.blogger.com/atom/ns#' term='Auto Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='left'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Zen Garden'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Zen Garden Dave Shea'/><title type='text'>Positioning the Extra Divs in the CSS Zen Garden Markup</title><content type='html'>Saturday 3:30PM.  The sky's turned grey again.  I'm going to work on the blog on and off throughout today and finish explaining the CSS behind my Zen Garden design which I had done many years ago - 2005 I think but never sent it to &lt;a href="http://www.csszengarden.com/"&gt;Dave Shea&lt;/a&gt;.  So when I started the blog later in '09, I thought it'd make a good teaching example. &lt;br /&gt;&lt;br /&gt;In the &lt;a href="http://www.cssbakery.com/2011/04/styling-css-zen-garden-menu.html" title="CSS Zen Garden"&gt;last&lt;/a&gt; Zen Garden post, we worked on the #linkList element and finished the &lt;a href="http://pics.cssbakery.com/pics/rose2bugs.html"&gt;menu&lt;/a&gt;.  There are just a few cosmetic changes to do before the design is complete.  &lt;br /&gt;&lt;br /&gt;In the footer, I'm going to hang a spider from a hyperlink and right underneath the spider, I will drop a few flower petals.  We can use one of the paragraph elements as a hook for the spider, but the petals are going to require the use of an extradiv  that Dave Shea provided at the end of his Zen Garden markup.  &lt;br /&gt;&lt;br /&gt;p5 is the last paragraph in the markup:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;p class="p5"&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt;Bandwidth graciously donated by &amp;lt;a href="http://www.dreamfirestudios.com/"&amp;gt;&lt;br /&gt;DreamFire Studios&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/p&amp;gt;  &lt;/pre&gt;&lt;img src="http://pics.cssbakery.com/pics/itsy.jpg" alt="CSS Zen Garden" title="CSS Zen Garden Bitmap" /&gt;&lt;br /&gt;The spider bitmap is &lt;a href="http://pics.cssbakery.com/pics/itsy.jpg"&gt;41px × 95px&lt;/a&gt;.  I'm going to give the paragraph a height of 100 pixels and make the bitmap the background of &lt;i&gt;p5 p&lt;/i&gt;.  Then through background positioning, we will find the perfect place to hang the spider:&lt;br /&gt;&lt;br /&gt;.p5 {&lt;br /&gt;height: 100px;&lt;br /&gt;background: url("images/itsy.jpg") 16em 1em no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;No matter what the browser window or the text size is doing,  the &lt;a href="http://pics.cssbakery.com/pics/rose2SPIDER.html"&gt;spider stays in place&lt;/a&gt;, attached to the hyperlink.  That's good. :)&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;STYLING THE EXTRA DIVS OF CSS ZEN GARDEN&lt;/h1&gt;&lt;br /&gt;Zen Garden has six of these extra div's.&lt;br /&gt;&lt;br /&gt;#extraDiv2 {&lt;br /&gt;width: 215px;&lt;br /&gt;height:  106px;&lt;br /&gt;background: url(images/shell215x106.jpg) 0 0 no-repeat;&lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;The flower petal bitmap is going to go right underneath the spider. The bitmap is 215 by 106 pixels.  So you give the extraDiv2 width and height that will match those numbers.  Drop your bitmap into the background and you'll get &lt;a href="http://pics.cssbakery.com/pics/rose2flowerpetals.htm"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/flowerpetals2.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;Let's change positioning from static to relative.  I think Shea tells you to do this by absolute positioning.  With relative positioning, the browser will keep the element in the flow but will move it by an x,y offset that you specify.  We want to move the bitmap up into the frame, shifting it up by 200px from where it would be positioned in the normal flow.  Horizontally, we want to move it 600px to the right (see the red dot in the diagram) to move it underneath the spider.  I don't want to teach anybody math but for example for x, all the points along that vertical line (y-axis) are valid since they will all have the same x coordinate.&lt;br /&gt;&lt;br /&gt;#extraDiv2 {&lt;br /&gt;width: 215px;&lt;br /&gt;height:  106px;&lt;br /&gt;background: url(images/shell215x106.jpg) 0 0 no-repeat;&lt;br /&gt;position: relative;&lt;br /&gt;top: -200px;&lt;br /&gt;left: 600px; &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;At first sight, everything looks good but the design &lt;a href="http://pics.cssbakery.com/pics/rose2RUNS.jpg"&gt;quickly breaks&lt;/a&gt; when the user resizes the browser window. &lt;a href="http://pics.cssbakery.com/pics/rose2RUNS.htm"&gt;Try it&lt;/a&gt; and see for yourself.   &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/relative_positioning4.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;Remember the auto margin statement?  Setting the left and right margins to auto will take of this problem nicely.  Here's how the browser will compute the bitmap's final destination: First it will go through the normal flow and lay down all the elements including our bitmap.  This would be position 1 in the illustration above.  But it won't stay there.  Auto margin is considered part of the normal flow so it'll center the image by computing the size of the browser window dividing it by two, then find the midpoint of our bitmap, and moving it to intersect with the halfline.  I am not showing this position in the image.&lt;br /&gt;&lt;br /&gt;From there, the relative positioning kicks in, and you move 200 up (up because it's negative) and 100 to the right which is position 2 in the illustration.  &lt;br /&gt;&lt;br /&gt;#extraDiv2 {&lt;br /&gt;width: 215px;&lt;br /&gt;height:  106px;&lt;br /&gt;background: url(images/shell215x106.jpg) 0 0 no-repeat;&lt;br /&gt;position: relative;&lt;br /&gt;top: -200px;&lt;br /&gt;left: 100px; &lt;br /&gt;margin: 0 auto;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;The curious may ask me why I chose 100 pixels for the x value.  That's because when the browser is sized to an average width, the spider is positioned right above the red petal as if &lt;a href="http://pics.cssbakery.com/pics/rose2relpos.html" title="CSS Zen Garden"&gt;he's trying to reach it&lt;/a&gt;.  &lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;Ok, two down, two to go.  One easy, the other has something with to do with our fluid design and is tricky.   &lt;br /&gt;&lt;br /&gt;First the super easy.  I'm going to place another insect bitmap in our design, this time underneath quickSummary on the upper right.  p2's background is clear, let's hook into that:&lt;br /&gt;&lt;br /&gt;/* The dragonfly */&lt;br /&gt;#quickSummary p.p2 {&lt;br /&gt;background: url("images/dragonfly.gif") &lt;br /&gt;no-repeat right bottom;&lt;br /&gt;padding-bottom: 40px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Normally we'd give a height and width but here I'm using the bottom padding since we know background images show through padding.  40 pixels is enough for our little guy.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/dragonflyZENGARDEN.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;Looks and &lt;a href="http://pics.cssbakery.com/pics/rose2DRAGONFLY.html" title="CSS Zen Garden"&gt;works&lt;/a&gt; fine.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;We are almost done.  The eagle eyed aside, most people may not notice the gap between the red title and the &lt;a href="http://pics.cssbakery.com/pics/rose2DRAGONFLY.html" title="CSS Zen Garden"&gt;moving grey line&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/extradiv1a.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;Using one of the extradiv's, I want to give the illusion of a long grey line that grows or shrinks depending on what the user is doing with the browser window.  We accomplish this by turning on the top border of extraDiv1, and absolutely positioning it in just the right spot to align that border with the existing line.&lt;br /&gt;&lt;br /&gt;We set the z-index to a high value (800) to make sure this line shows up on top of all other elements in the area.  We give it a minimum width of 100px to make sure the line doesn't become too narrow when the browser window is narrow.&lt;br /&gt;&lt;br /&gt;Finally, we play an interesting trick.  We set to width to auto, and we set both left and right properties, which is something you usually don't see.  This causes the div's left edge to be offset 524 px from the left edge of the page, and the div's right edge to be offset 130px from the right edge of the page.  Thus, the width of the div varies with the width of the browser window, but the horizontal dimensions are controlled in such a way so that it appears to be an extension of the existing line underneath the page heading.  This is interesting because its a case where we are using the left and right properties, along with absolute positioning to control the width of the element, as well as the left/right offsets from the edges of the page.&lt;br /&gt;&lt;br /&gt;#extraDiv1 {&lt;br /&gt;width: auto;&lt;br /&gt;border-top: 1px solid #e1e1e1;&lt;br /&gt;height: 1px;&lt;br /&gt;position: absolute;&lt;br /&gt;top: 80px;  left: 524px;  right: 130px;&lt;br /&gt;z-index: 800;      &lt;br /&gt;min-width: 100px;&lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;You can stretch the browser more and the design will not break - I had to limit myself for this screenshot because of my tight 550px main column width.  The line will keep growing in the middle as if it's one piece:&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/extradiv1c.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;This is the case when the browser is sized to its minimum - it cannot shrink more.  See how perfectly the grey line is positioned, it always stops under "THE" and the right edge of the frame sits aligned under "DESIGN".  Everything looks perfect even when you increase text size in the order of 5. I &lt;a href="http://pics.cssbakery.com/pics/zenGardenFinal.html" title="CSS Zen Garden"&gt;love&lt;/a&gt; how this works:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/extradiv1b.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;The interactive &lt;a href="http://pics.cssbakery.com/pics/zenGardenFinal.html" title="CSS Zen Garden"&gt;html&lt;/a&gt; file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-9213791784776761698?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/9213791784776761698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/positioning-extra-divs-in-css-zen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/9213791784776761698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/9213791784776761698'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/positioning-extra-divs-in-css-zen.html' title='Positioning the Extra Divs in the CSS Zen Garden Markup'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-234407503943208873</id><published>2011-04-01T20:16:00.000-07:00</published><updated>2011-04-01T21:02:00.323-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Spring Has Sprung</title><content type='html'>&lt;div&gt;&lt;span class="bugs"&gt;It was the beginning of February sometime. I blinked. It's April&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="bugs"&gt;2011 is giving me a whiplash&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-234407503943208873?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/234407503943208873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/springs-sprung.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/234407503943208873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/234407503943208873'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/springs-sprung.html' title='Spring Has Sprung'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2863621095452633668</id><published>2011-04-01T19:47:00.000-07:00</published><updated>2011-04-09T00:19:27.986-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='border-bottom'/><category scheme='http://www.blogger.com/atom/ns#' term='Fluid Rose for Zen Garden'/><category scheme='http://www.blogger.com/atom/ns#' term='border'/><category scheme='http://www.blogger.com/atom/ns#' term='Dave Shea'/><category scheme='http://www.blogger.com/atom/ns#' term='ul'/><category scheme='http://www.blogger.com/atom/ns#' term='li'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Zen Garden'/><category scheme='http://www.blogger.com/atom/ns#' term='background-image'/><category scheme='http://www.blogger.com/atom/ns#' term='z-index'/><category scheme='http://www.blogger.com/atom/ns#' term='h3'/><category scheme='http://www.blogger.com/atom/ns#' term='last-child'/><category scheme='http://www.blogger.com/atom/ns#' term='Tweet'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS 3.0 last-child'/><title type='text'>Styling the CSS Zen Garden Menu</title><content type='html'>Let's go back to CSS Zen Garden and finish the example that we were working on for the blog.  We had left off &lt;a href="http://pics.cssbakery.com/pics/rose2Thcomplete.html"&gt;here&lt;/a&gt;.  The menu is sitting &lt;a href="http://pics.cssbakery.com/pics/rose2zero.jpg"&gt;below the page&lt;/a&gt;. Let's move it up:&lt;br /&gt;&lt;br /&gt;#linkList {&lt;br /&gt;position: absolute;&lt;br /&gt;top: 200px; left: 0; &lt;br /&gt;z-index: 11;     &lt;br /&gt;margin-top: 105px;&lt;br /&gt;text-align: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This is an absolutely positioned element so we give it the coordinates of (0,200px) to pull it up to the top of the page. &lt;i&gt;z-index&lt;/i&gt; is necessary to keep the element on top of &lt;i&gt;pageHeader&lt;/i&gt; div which has a smaller z-index.   Without a higher z-index, we will lose the "&lt;i&gt;Select a Design&lt;/i&gt;" header.  Also, 105 pixels for top margin so that we don't end up on top of the bitmap for the red rose.  If you have text with more than word, with enough space, the words will separate from one another, giving you an unsightly sinkhole in between.  &lt;i&gt;text-align: left&lt;/i&gt; will take care of this potential problem.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/rose2bugsA.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;Next we'll get rid of the bullets and &lt;a href="http://pics.cssbakery.com/pics/rose2bugsB.jpg"&gt;style the ul/li elements&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;#linkList ul {&lt;br /&gt;margin: 5px 1em 0 60px; &lt;br /&gt;list-style: none;&lt;br /&gt;font-family: Tahoma, Arial, Helvetica, sans-serif;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#linkList li  {  &lt;br /&gt;margin-bottom: 5px;&lt;br /&gt;font-size: 70%;&lt;br /&gt;width: 138px;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#linkList a {   color: #5c7a5e; &lt;br /&gt;text-decoration: none;&lt;br /&gt;font-weight: bold;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#linkList a:hover {&lt;br /&gt;text-decoration: underline;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;In lselect div, I want to draw a line between the li elements so I use a border-bottom rule.  &lt;br /&gt;&lt;br /&gt;#lselect ul li {   &lt;br /&gt;padding-bottom: 5px;&lt;br /&gt;color: #858f72;&lt;br /&gt;border-bottom: 1px solid #858f72;    &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;The updated &lt;a href="http://pics.cssbakery.com/pics/rose2bugsC.jpg"&gt;menu&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There are some links in the lselect div that we want to display on their own line in the menu, but there's no class name that lets us target them directly.  So what we'll do is write a general rule for all the links in lselect, then we'll selectively undo part of it.&lt;br /&gt;&lt;br /&gt;For the first part, we set all the links to have display: block.  This will cause them to render on their own line.&lt;br /&gt;&lt;br /&gt;#lselect ul li a, #lselect ul li a:link, #lselect ul li a:visited {&lt;br /&gt;display: block;&lt;br /&gt;padding: 0 0 5px 0;&lt;br /&gt;color: #566047;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;But here's where we "undo" that for other links that we don't want on their own line.  These are the links that have a class="c".  We accomplish this by setting these back to display: inline.  While were at it, we give these links a different color:&lt;br /&gt;&lt;br /&gt;#linkList a.c, #linkList a.c:link, &lt;br /&gt;#linkList a.c:visited, #linkList a.c:hover, &lt;br /&gt;#linkList a.c:active, #linkList a.c:focus {&lt;br /&gt;color: #858f72;  &lt;br /&gt;display: inline;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#lselect ul li a:hover {&lt;br /&gt;text-decoration: underline;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Once again, the &lt;a href="http://pics.cssbakery.com/pics/rose2bugsD.jpg"&gt;new menu&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;I'm going to skip the bottom border for the &lt;a href="http://pics.cssbakery.com/pics/rose2bugsE.jpg"&gt;last child in "select a design"&lt;/a&gt;. This rule will only work in browsers that recognize the last-child property of CSS3.  IE will draw the extra bottom border:&lt;br /&gt;&lt;br /&gt;#lselect ul li:last-child { &lt;br /&gt;border: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;I have  a leaf vector graphic that will go right before each li (menu item): &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/littleleaf.png" alt="CSS Zen Garden" /&gt;&lt;br /&gt;I thought of using list-style-image for this purpose but gave up on the idea when I figured the background property's just as good.  Since we want this icon only for the "Select a Design",  we are going to write our descendant selectors using #lselect.  The property cascades down to a.c element but we do not want a second icon in the same menu item.  That's why we are resetting the background images to none later.  (note: This is due to 'cascading' not 'inheritance'.  In inheritance a style applied to some parent element is inherited by a child element.  But in this case the 'a' elements are siblings, not parent-child).&lt;br /&gt;&lt;br /&gt;#lselect ul li a, #lselect ul li a:link, #lselect ul li a:visited {&lt;br /&gt;padding: 0 0 2px 20px;&lt;br /&gt;background: transparent url(images/littleleaf.png) left center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#lselect ul li a.c, #lselect ul li a.c:link, #lselect ul li a.c:visited {&lt;br /&gt;background-image: none;&lt;br /&gt;padding: 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The "Select a Design" menu with its new &lt;a href=" http://pics.cssbakery.com/pics/rose2bugsF.jpg"&gt;icons&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;I have a moth and a butterfly which I'm going to use to separate the menu items, lselect (Select a Menu Design) and lresources (Resources) by dropping the bitmaps in their background images.  A 40 pixel bottom padding will allow enough room to show each bug.  &lt;br /&gt;&lt;br /&gt;#lselect {&lt;br /&gt;background: url(images/moth.gif) no-repeat 50% 100%;&lt;br /&gt;padding-bottom: 40px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#lresources{&lt;br /&gt;background: url(images/butterfly.gif) no-repeat 50% 100%;&lt;br /&gt;padding-bottom: 40px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Here's the menu with &lt;a href="http://pics.cssbakery.com/pics/rose2bugsG.jpg"&gt;the two insects&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;There are &lt;a href="http://pics.cssbakery.com/pics/rose2bugsA.jpg"&gt;three headings&lt;/a&gt; in the menu, "Select a Design",  "Archives" and "Resources" which are all in plain, black text.  How about replacing the text with bitmap images?  The first rule establishes the width and height for the bitmaps.  The next three statements are straight forward where we drop in the bitmaps into each h3's background.  The very last statement &lt;i&gt;#linkList h3  span  {visibility: hidden;}&lt;/i&gt; is for hiding the text that comes from the markup since we want to replace the text with the new images. If you skip this step, there will be &lt;a href="http://pics.cssbakery.com/pics/rose2bugsI.jpg"&gt;graffiti on your menu&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;#linkList h3 {&lt;br /&gt;width: 163px;&lt;br /&gt;height: 40px;&lt;br /&gt;margin: 25px 0 5px 45px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#linkList h3.select {&lt;br /&gt;background: transparent url(images/h3_select_red.gif) left center no-repeat;&lt;br /&gt;margin: 0 0 0 45px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;h3.archives {   &lt;br /&gt;background: transparent url(images/h3_archives.gif) left center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;h3.resources {    &lt;br /&gt;background: transparent url(images/h3_resources.gif) left center no-repeat;&lt;br /&gt;}&lt;br /&gt;#linkList h3  span  {visibility: hidden;}&lt;br /&gt;&lt;br /&gt;Final &lt;a href="http://pics.cssbakery.com/pics/rose2bugs.html"&gt;html file&lt;/a&gt; after all the styles are applied.  The design is fluid so you can test it by expanding/shrinking your browser window.  A bulletproof design should hold up when you enlarge text size by three levels.  I have not tested IE yet but in Firefox, everything's good:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/rose2bugsH.jpg" alt="CSS Zen Garden" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/q6g.jpg" alt="" title="" /&gt;&lt;h4&gt;CSS Zen Garden Series &lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/04/positioning-extra-divs-in-css-zen.html"&gt;ExtraDiv1 Goes Where No Div's Gone Before, Part 8&lt;/a&gt; | &lt;a href="http://pics.cssbakery.com/pics/zenGardenFinal.html"&gt;Final Design&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/04/styling-css-zen-garden-menu.html"&gt;Styling the CSS Zen Garden Menu, Part 7&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/11/styling-zen-garden-footer.html"&gt;Styling the CSS Zen Garden Footer, Part 6&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/preamble-we-have-to-make-z-index-for.html"&gt;Styling the CSS Zen Garden Text Paragraphs, Part 5&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/in-our-last-post-we-took-stroll-through.html"&gt;Spider &amp;amp; Rose for CSS Zen Garden, Part 4&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/10/zen-garden-xhtml-elements.html"&gt;CSS Zen Garden HTML Elements, Part 3&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://websiteraising.blogspot.com/2009/09/zen-garden-markup.html"&gt;CSS Zen Garden Markup, Part 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2009/09/walking-over-to-css-zen-garden.html"&gt;Walking over to the Zen Garden, Part 1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2863621095452633668?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2863621095452633668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/04/styling-css-zen-garden-menu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2863621095452633668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2863621095452633668'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/04/styling-css-zen-garden-menu.html' title='Styling the CSS Zen Garden Menu'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4648522964841883603</id><published>2011-03-06T16:17:00.000-08:00</published><updated>2011-03-07T09:33:35.981-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SELECT'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Elements'/><category scheme='http://www.blogger.com/atom/ns#' term='Form Element'/><category scheme='http://www.blogger.com/atom/ns#' term='Input'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Forms'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='Form Tag'/><title type='text'>HTML Forms Quick Reference</title><content type='html'>&lt;h1&gt;THE FORM TAG&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Encloses a given form.&lt;/li&gt;&lt;li&gt;There can be multiple forms on a page.&lt;/li&gt;&lt;li&gt;Requires an action attribute:  &amp;lt;form action="myform.php"&amp;gt;&lt;/li&gt;&lt;li&gt;The action determines what URL will be used for submitting the form to the server&lt;/li&gt;&lt;li&gt;Also requires a method attribute: &amp;lt;form action="myform.php" method="post"&amp;gt;&lt;/li&gt;&lt;li&gt;The method determines whether HTTP GET or HTTP POST will be used for sending the form data to the server.&lt;/li&gt;&lt;li&gt;You'll almost always use method="post"&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;INPUT TAGS&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Used for several different purposes including: single line text, checkboxes, radio buttons, submit buttons, file upload buttons, passwords, and hidden data.&lt;/li&gt;&lt;li&gt;The &lt;em&gt;type&lt;/em&gt; attribute determines which type of UI element it will be, for example: type="text", type="checkbox"&lt;/li&gt;&lt;li&gt;The &lt;em&gt;name&lt;/em&gt; attribute is also very important: &amp;lt;input type="text" name="username"&amp;gt;&lt;/li&gt;&lt;li&gt;The &lt;em&gt;name&lt;/em&gt; attribute is sent to the server along with the value the user enters.  Without it, the server won't know what the data is for.&lt;/li&gt;&lt;li&gt;Yet another important attribute is: &lt;em&gt;value&lt;/em&gt;.  It holds the current value of the input field:  &amp;lt;input type="text" name="username" value="Eastwood"&amp;gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;INPUT A SINGLE LINE OF TEXT&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;For a single line of text use: &amp;lt;input type="text" name="username"&amp;gt;&lt;/li&gt;&lt;li&gt;Often you will want to initialize the input with an existing value.  Using PHP that would look like this:  &amp;lt;input type="text" name="username" value="&amp;lt;?php echo $username?&amp;gt;"&amp;gt;&lt;/li&gt;&lt;li&gt;Or, using PHP short tags (which I prefer): &amp;lt;input type="text" name="username" value="&amp;lt;?=$username?&amp;gt;"&amp;gt;&lt;/li&gt;&lt;li&gt;If the text is a password it's just like a single line of input text, except the browser will show asterisks instead of the password: &amp;lt;input type="password" name="password" value="&amp;lt;?=$password?&amp;gt;"&amp;gt; &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;TEXT AREAS&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;For multiple lines of text, use the &amp;lt;textarea&amp;gt; tag instead.&lt;/li&gt;&lt;li&gt;Specify rows and columns to control the size:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;textarea rows="5" cols="50" name="mytext"&amp;gt;&lt;br /&gt;Some text&lt;br /&gt;&amp;lt;/textarea&amp;gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Looks like this:&lt;br /&gt;&lt;textarea rows="5" cols="50" name="mytext"&gt;Some text&lt;/textarea&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;HIDDEN DATA&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Many situations arise where you need to put some hidden data in a form.  Often this is a database key value&lt;/li&gt;&lt;li&gt;Just use an input tag with type="hidden", and set the value attribute to hold the data:  &amp;lt;input type="hidden" value="somevalue" name="my_hidden_data"&amp;gt;&lt;/li&gt;&lt;li&gt;You do also need to give it a name attribute so the server will know what this data is for.&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;SELECT TAG&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Select lets you have a pull down input element:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;select name="mySelect"&amp;gt;&lt;br /&gt;    &amp;lt;option&amp;gt;Cat&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option selected="1"&amp;gt;Dog&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option&amp;gt;Rabbit&amp;lt;/option&amp;gt;&lt;br /&gt;    &amp;lt;option&amp;gt;Turtle&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;/select&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Produces this:  &lt;select name="mySelect"&gt;&lt;br /&gt;&lt;option&gt;Cat&lt;/option&gt;&lt;br /&gt;&lt;option selected="1"&gt;Dog&lt;/option&gt;&lt;br /&gt;&lt;option&gt;Rabbit&lt;/option&gt;&lt;br /&gt;&lt;option&gt;Turtle&lt;/option&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Notice how the default value was selected using the &lt;em&gt;selected&lt;/em&gt; attribute.&lt;/li&gt;&lt;li&gt;Later I will describe doing a select where you can select multiple options.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;SUBMITTING THE FORM&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;When the input is a submit button, the &lt;em&gt;value&lt;/em&gt; attribute determines what is written on the button.&lt;/li&gt;&lt;li&gt;Submit buttons always need a value: &amp;lt;input type="submit" name="Save" value="Save"&amp;gt;&lt;/li&gt;&lt;li&gt;Submit buttons can be represented by an image instead of a normal button.  In that case &lt;em&gt;type&lt;/em&gt; must be set to "image" instead of "submit", and the &lt;em&gt;src&lt;/em&gt; attribute points to the image:  &amp;lt;input type="image" name="Save" src="path/to/image.jpg"&amp;gt; &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;RESET&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;A 'reset' button clears all the form fields back to the state they were in when the page loaded.&lt;/li&gt;&lt;li&gt;A reset button is coded as follows: &amp;lt;input type="reset"&amp;gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Later I'll talk about how forms can be submitted with Javascript so that you can submit the form without leaving or reloading the current page.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4648522964841883603?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4648522964841883603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/03/html-forms-quick-reference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4648522964841883603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4648522964841883603'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/03/html-forms-quick-reference.html' title='HTML Forms Quick Reference'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8885639076993462504</id><published>2011-03-06T11:25:00.000-08:00</published><updated>2011-04-21T20:16:43.696-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>A Quiet Morning</title><content type='html'>I had no trouble getting up early today.   But even though I was up, I was kind of useless.  I'm walking towards my kayak and thinking, Can someone sleep and walk at the same time, I feel so tired. &lt;br /&gt;&lt;br /&gt;Quiet, cloudy morning in the marina, you can hear a pin drop this early.  While I am puttering around in the middle of the channel,  I hear a big but gentle swoosh.  The water around me has hundreds of ripples.  It's hard to see through the dark green water but one of them turns its belly sideways revealing its identity - it's a 10 inch (25 cm) silver fish.   This is an entire school. They keep coming back up, barely breaking the water surface and then just as quickly diving under.  It's not unusual to see a single fish jump but it's wonderful when there are so many and you are in the middle of it.  &lt;br /&gt;&lt;br /&gt;Along with me, someone else is watching the magic unfold.  Suddenly there's a huge splash.  I look behind and see a pelican swallowing his breakfast. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8885639076993462504?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8885639076993462504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/03/quiet-morning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8885639076993462504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8885639076993462504'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/03/quiet-morning.html' title='A Quiet Morning'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-6116708999437008333</id><published>2011-03-04T05:04:00.001-08:00</published><updated>2011-03-27T13:23:33.979-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP Syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='Tweet'/><title type='text'>PHP Quick Intro</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#pretzelcrjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='pretzelcrjpg' style='display:none;' src='http://pics.cssbakery.com/pics/pretzelcr.jpg' alt='Pretzel-Croissant&amp;lt;br&amp;gt;[a great combination]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;h1&gt;VARIABLES&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Start with a dollar sign,for example : $variable_name=2;&lt;/li&gt;&lt;li&gt;Do not need to be declared before use.&lt;/li&gt;&lt;li&gt;Can hold a string, or a number, or a boolean: $a="cat"; $b=42; $c=false;&lt;/li&gt;&lt;li&gt;Can store floating point numbers:  $b=42.06;&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;STRINGS&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Can be assigned to a variable:  $w = "world";&lt;/li&gt;&lt;li&gt;Can be concatenated with the period (.) operator:  "hello ".$w yields "hello world"&lt;/li&gt;&lt;li&gt;The concatenation operator is used a lot. Remember it.&lt;/li&gt;&lt;li&gt;You can get the length:  strlen($w) returns 5&lt;/li&gt;&lt;li&gt;You can get a substring:  substr($w,1,3); returns orl&lt;/li&gt;&lt;li&gt;Can be operated on by many PHP built in &lt;a href="http://www.php.net/manual/en/ref.strings.php"&gt;string functions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Can be enclosed by double quotes (") or single quotes ('):  $w = 'world';&lt;/li&gt;&lt;li&gt;There are differences between single and double quotes.&lt;/li&gt;&lt;li&gt;In double quotes, you can embed variables:  "hello $w" produces hello world - the variable is substituted (its name replaced by its value)&lt;/li&gt;&lt;li&gt;But if you try that with single quotes:  'hello $w' produces hello $w&lt;/li&gt;&lt;li&gt;That same idea applies to special chars: "hello\n" produces a newline&lt;/li&gt;&lt;li&gt;But 'hello\n' produces hello\n as a string (no newline) - taken literally with no substitution&lt;/li&gt;&lt;li&gt;You can put a double quote in a double quoted sting by escaping: "Hello \"World\"" produces Hello "World"&lt;/li&gt;&lt;li&gt;PHP strings act very differently than C character arrays. Much simpler to work with.&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;ARRAYS&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Create an empty one like this:  $myarray=array();&lt;/li&gt;&lt;li&gt;Create one with some elements:  $myarray=array("cat","dog","hamster");&lt;/li&gt;&lt;li&gt;Can hold a mixture of data types: $myarray=array("cat",42,false);&lt;/li&gt;&lt;li&gt;Start with index of 0:  echo $myarray[0]; // outputs: cat&lt;/li&gt;&lt;li&gt;Unless the keys are specified:  $myarray=array(1=&gt;"cat",2=&gt;42);&lt;/li&gt;&lt;li&gt;And the keys don't have to be numbers, they can be strings: $myarray=array("fluffy"=&gt;"cat","rover"=&gt;"dog");&lt;/li&gt;&lt;li&gt;Can append to an array like this:  $myarray[]="a new element"&lt;/li&gt;&lt;li&gt;Find out how many elements it has:  count($myarray)&lt;/li&gt;&lt;li&gt;Sort the array:  sort($myarray)&lt;/li&gt;&lt;li&gt;Sort the array by keys instead of values:  ksort($myarray)&lt;/li&gt;&lt;li&gt;Can be operated on by many built in PHP &lt;a href="http://php.net/manual/en/ref.array.php"&gt;array functions&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;FROM STRING TO ARRAY AND BACK AGAIN&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Here's a string: $s="Cat,Dog,Cow,Pig"&lt;/li&gt;&lt;li&gt;Create an array from it:  $a=explode(',',$s);&lt;/li&gt;&lt;li&gt;$a[0] is now Cat, $a[3] is Pig&lt;/li&gt;&lt;li&gt;Let's overwrite the Pig:  $a[3]="Goose";&lt;/li&gt;&lt;li&gt;Go back to a string:  $s=implode(',',$a);&lt;/li&gt;&lt;li&gt;$s is now: "Cat,Dog,Cow,Goose"&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;LOOPING&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;foreach loops through entire arrays:&lt;br /&gt;&lt;pre class="Blue"&gt;$myarray=array("fluffy"=&gt;"cat","rover"=&gt;"dog");&lt;br /&gt;  foreach ($myarray as $element) {&lt;br /&gt;    echo $element;&lt;br /&gt;  }&lt;br /&gt;  // Outputs: cat, dog&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;But you can also get at the array key values:&lt;br /&gt;&lt;pre class="Blue"&gt;$myarray=array("fluffy"=&gt;"cat","rover"=&gt;"dog");&lt;br /&gt;  foreach ($myarray as $k =&gt; $element) {&lt;br /&gt;    // We're using the concatenation operator here (period, remember?)&lt;br /&gt;    echo $k." is a ".$element;&lt;br /&gt;  }&lt;br /&gt;  // Outputs: fluffy is a cat, rover is a dog&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;There are &lt;a href="http://www.php.net/manual/en/language.control-structures.php"&gt;other ways to loop&lt;/a&gt;, but foreach covers 90% of what you'll ever need.&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;IF-ELSE&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Looks just like if-else in C and other languages.&lt;/li&gt;&lt;li&gt;Optionally, you can use a colon and endif statement, instead of braces:&lt;br /&gt;&lt;pre class="Blue"&gt;// using curly braces:&lt;br /&gt;  if ($w=="world") {&lt;br /&gt;    echo "hello ".$w;  // aside: note the concatenation operator (period)&lt;br /&gt;  }&lt;br /&gt;  // This is the same logic:&lt;br /&gt;  if ($w=="world):&lt;br /&gt;    echo "hello $w";  // aside: this time we didn't use concatenation!&lt;br /&gt;  endif;&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;There is a tertiary operator: echo ($w=="world") ? "hello $w" : "goodbye";&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;MIXING PHP WITH HTML&lt;/h1&gt;&lt;ul&gt;&lt;li&gt;Files ending with .php contain HTML and PHP&lt;/li&gt;&lt;li&gt;PHP must be enclosed within PHP tags: &amp;lt;?php echo "I'm PHP";?&amp;gt;&lt;/li&gt;&lt;li&gt;If it's not within PHP tags, it gets sent to the Browser unaltered.&lt;/li&gt;&lt;li&gt;So whatever is not within PHP tags should be valid HTML/CSS/Javascript&lt;/li&gt;&lt;li&gt;You can use the short PHP tag: &amp;lt;? echo "I'm PHP";?&amp;gt;&lt;/li&gt;&lt;li&gt;For an echo, this is most concise: &amp;lt?="I'm PHP"?&amp;gt;&lt;/li&gt;&lt;li&gt;Works well for variables: &amp;lt;div class="&amp;lt;?=$classname?&amp;gt;"&amp;gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-6116708999437008333?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/6116708999437008333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/03/php-quick-intro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6116708999437008333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6116708999437008333'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/03/php-quick-intro.html' title='PHP Quick Intro'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1286029725155478395</id><published>2011-03-01T23:25:00.001-08:00</published><updated>2011-03-02T10:29:10.756-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='E Ink'/><category scheme='http://www.blogger.com/atom/ns#' term='Kindle'/><title type='text'>E Ink: Kindle DX,  Reader and Nook</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#kindlewebjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='kindlewebjpg' style='display:none;' src='http://pics.cssbakery.com/pics/kindleweb.jpg' alt='Amazon Kindle DX and Nook&amp;lt;br&amp;gt;[E Ink]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;When &lt;a href="http://www.sonystyle.com"&gt;Sony&lt;/a&gt; came out with their Reader three, four years ago, it was the only device that used &lt;a href="http://eink.com/"&gt;e-ink&lt;/a&gt;, predating Amazon's Kindle.  The second generation Sony was not as nice a package as the first one but was faster.  I would have stayed loyal to the brand, had it not been for my PDF files that require a larger screen to view.  Along the way, I also acquired a Nook which has a touch screen for navigation but again not very useful to me because of its small screen. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Kindle-DX-Wireless-Reader-3G-Global/dp/B002GYWHSQ/ref=sr_1_7?ie=UTF8&amp;qid=1299006849&amp;sr=8-7"&gt;Kindle DX&lt;/a&gt; is so far working out fine for me.   There's still a lot of room for improvement - a simple page turn can take too long (I do not remember Sony Reader getting stuck this long), no SD card slot when first generation Sony Reader had one, and a flash when changing pages.  The faster these devices get, the more the transition between pages looks like a flash and catches your eye.  Minor issues: No cover, no stand.  The &lt;a href="http://www.amazon.com/Cole-Haan-Hand-Stained-Leather-Generation/dp/B002YQ2RKE/ref=sr_1_2?ie=UTF8&amp;s=fiona-hardware&amp;qid=1299052498&amp;sr=8-2"&gt;cover&lt;/a&gt; that I got for it keeps pressing buttons when closed.  &lt;br /&gt;&lt;br /&gt;People are also fond of iPads for reading books/documents.  They are nice but an iPad with a backlit screen and an e-ink device are two very different things.  If your eyes are tired from having to read backlit displays, an e-ink device can make a difference in your life.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1286029725155478395?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1286029725155478395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/03/e-ink-kindle-dx-reader-and-nook_01.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1286029725155478395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1286029725155478395'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/03/e-ink-kindle-dx-reader-and-nook_01.html' title='E Ink: Kindle DX,  Reader and Nook'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-148840154233606759</id><published>2011-02-27T03:02:00.001-08:00</published><updated>2011-05-30T03:55:53.002-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='font-face'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Webfonts'/><category scheme='http://www.blogger.com/atom/ns#' term='Cufon'/><title type='text'>Cufon, Google WebFonts Summary</title><content type='html'>&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/cufonicon.jpg" alt="summary of font related posts"  /&gt;&lt;h4&gt;google fonts + cufon + font-face&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/fixing-font-face-problems-in-ie.html"&gt;Fixing font-face Problems in IE&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/browser-caching-server-data.html"&gt;Caching Cufon Javascript Files via Apache HTTP Response Headers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/update-google-webfont-fout-flash-of.html"&gt;Update: Google WebFonts FOUT Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/google-web-fonts-flash-of-unstyled-text.html"&gt;Google WebFonts FOUT Problem with wf-active&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html"&gt;Fixing Firefox font-face Cross Domain Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html"&gt;Cufon with Variants of the Same Font Family&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-148840154233606759?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/148840154233606759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/cufon-google-webfonts-font-face.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/148840154233606759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/148840154233606759'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/cufon-google-webfonts-font-face.html' title='Cufon, Google WebFonts Summary'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5374716011390314705</id><published>2011-02-27T02:56:00.000-08:00</published><updated>2011-02-27T02:57:04.993-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FOUT'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Webfonts'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash of Unstyled Text'/><title type='text'>Update: Google WebFont FOUT (Flash of Unstyled Text)</title><content type='html'>I recently wrote about how I'm dealing with the Google WebFont FOUT (Flash of Unstyled Text).  On one occasion I saw a case where the Google script failed to load and I ended up with a blank area on my screen where the heading should have been.  So I put in one more small change so that after 10 seconds the h1 will be made visible no matter what else is going on.&lt;br /&gt;&lt;br /&gt;Here's the code I added:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;var showH1 = function() {&lt;br /&gt;      $("div.article h1").css({'visibility':'visible'});&lt;br /&gt;    }&lt;br /&gt;    setTimeout(showH1,10000);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5374716011390314705?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5374716011390314705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/update-google-webfont-fout-flash-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5374716011390314705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5374716011390314705'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/update-google-webfont-fout-flash-of.html' title='Update: Google WebFont FOUT (Flash of Unstyled Text)'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5033293093127565282</id><published>2011-02-26T15:49:00.000-08:00</published><updated>2011-02-26T15:49:19.406-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Windy Weekend</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#thismorningjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='thismorningjpg' style='display:none;' src='http://pics.cssbakery.com/pics/thismorning.jpg' alt='6:50am / 8:30am&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Got up at 6.  Took the first picture right before I left when things looked promising.  Water had some chop.  Grand canal entry was churning fast with a strong current.  No boats, no wakes. By the time I was back at 8:30, the wind had gotten much stronger, with a lot of clouds moving in. It felt very cold (picture on the right).  Bundled up and walked back home.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5033293093127565282?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5033293093127565282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/windy-weekend.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5033293093127565282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5033293093127565282'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/windy-weekend.html' title='Windy Weekend'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4045100130116275722</id><published>2011-02-25T18:46:00.000-08:00</published><updated>2012-02-15T11:13:46.920-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blockquotes'/><category scheme='http://www.blogger.com/atom/ns#' term='Pullqutoes'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>CSS Pullquotes and Blockquotes Summary</title><content type='html'>&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/quoteicon.jpg" alt="CSS Pullquotes and Blockquotes" title="CSS Pullquotes and Blockquotes" /&gt;&lt;h4&gt;CSS Pullquotes and Blockquotes&lt;/h4&gt;&lt;ul class="icons"&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/css-3-gradients-css-3-multiple.html"&gt;Blockquote with Multiple Background Images/Gradient&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/css-pullquotes.html"&gt;Pullquote Variations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/newspaper-style-pullquotes-using-css.html"&gt;Newspaper Style Pullquotes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html"&gt;HTML Blockquote, CSS Content, CSS Quote&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2012/01/writing-generic-css-blockquote-class.html"&gt;Writing a Generic Blockquote Class&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4045100130116275722?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4045100130116275722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/css-pullquotes-and-blockquotes-summary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4045100130116275722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4045100130116275722'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/css-pullquotes-and-blockquotes-summary.html' title='CSS Pullquotes and Blockquotes Summary'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8384577485069245127</id><published>2011-02-25T18:35:00.000-08:00</published><updated>2011-02-25T20:05:00.108-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS 3.0 Multiple Background Images'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Blockquote'/><category scheme='http://www.blogger.com/atom/ns#' term='-moz-border-radius'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS 3.0 Gradient'/><category scheme='http://www.blogger.com/atom/ns#' term='-moz-linear-gradient'/><category scheme='http://www.blogger.com/atom/ns#' term='border-radius'/><category scheme='http://www.blogger.com/atom/ns#' term='-webkit-gradient'/><title type='text'>CSS 3 Gradients, CSS 3 Multiple Background Images and HTML Blockquote</title><content type='html'>&lt;img src="http://pics.cssbakery.com/pics/chromelineard.jpg" alt="CSS3 Linear Gradient" title="CSS3 Linear Gradient" /&gt;&lt;br /&gt;-webkit-gradient(linear, left top, right top, from(#23262a), to(#2784ed))&lt;br /&gt;&lt;br /&gt;This post was really about blockquotes but since I used new CSS 3 features, I'm going to show the code for gradients and multiple background images. The blockquote was generated in the Chrome browser with CSS3.  The CSS is very similar to the &lt;a href="http://www.cssbakery.com/2011/02/css-pullquotes.html"&gt;pullquotes&lt;/a&gt; with most of the action taking place in the &lt;i&gt;openingbracediv&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;div.openingbracediv {&lt;br /&gt;    color: white; &lt;br /&gt;    font: bold 24px/27px arial;&lt;br /&gt;&lt;br /&gt;    /* this statement is for IE 8 and earlier versions */&lt;br /&gt;    background: url("images/openingbrace300DropS.png")  no-repeat 2% 70% #899bc8;&lt;br /&gt; &lt;br /&gt;    background: url("images/openingbrace300DropS.png")  no-repeat 2% 70%,   &lt;br /&gt;                      url("images/closingbrace300DropS.png")  no-repeat 98% 30%,      &lt;br /&gt;                     -moz-linear-gradient(100% 100% 245deg,  #2784ed, #23262a);&lt;br /&gt;     &lt;br /&gt;    background: url("images/openingbrace300DropS.png") no-repeat 2% 70%,       &lt;br /&gt;            url("images/closingbrace300DropS.png")   no-repeat 98% 30%,      &lt;br /&gt;           -webkit-gradient(linear, left top, right top, from(#23262a), to(#2784ed));&lt;br /&gt;    &lt;br /&gt;    background-color: #899bc8;&lt;br /&gt;   -moz-border-radius: 10px;&lt;br /&gt;    border-radius: 10px; &lt;br /&gt;    width: 550px;&lt;br /&gt;    }&lt;br /&gt;/* for IE - the closing brace graphic */&lt;br /&gt;.closingbracediv {&lt;br /&gt;    background: url("images/closingbrace300DropS.png") no-repeat 98% 30% transparent;&lt;br /&gt;   -moz-border-radius: 10px;&lt;br /&gt;    border-radius: 10px;  &lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;First background statement is for IE version &lt; 9.  The next two backgrounds are for Firefox and Chrome.  IE being IE pokes its nose into the Mozilla and Webkit backgrounds and by the time we are done with the three background statements,  IE no longer has a handle on what the background color should be.  This is why I had to add a standalone background color just to set IE straight.  Let's look at the second background statement written for Firefox.  The opening and closing braces with drop shadows are going to layer over the color gradient.  I purposefully positioned them asymmetrical along the y-axis to make things visually more interesting. In the &lt;i&gt;-moz-linear-gradient(100% 100% 245deg,  #2784ed, #23262a)&lt;/i&gt;, the percentages can be rewritten as &lt;i&gt;bottom right&lt;/i&gt; and you'd get the same results.&lt;br /&gt;&lt;br /&gt;Gradient is the final entry which renders a fading layer going from a dark blue to a brighter blue using a 245 degree angle.  Prior to CSS 3.0, our options were limited to uniform gradients that faded horizontally or vertically since we typically took a small slice of  a gradient and repeated it either in x or y direction. &lt;br /&gt;&lt;br /&gt;You might wonder if the order is important in the background statement.  It is.  If you were to move the gradient entry in between the opening and closing brace images, you will lose the closing brace from the final image because you'll write over it.  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/firefox245d.jpg" alt="CSS3 245Degree Gradient" title="CSS3 245Degree Gradient" /&gt;&lt;br /&gt;-moz-linear-gradient(100% 100% 245deg, #2784ed, #23262a);&lt;br /&gt;&lt;br /&gt;Background statements for Firefox and Chrome have three background images assigned to them.  Two brace images and since the gradient is considered an image, that brings the total to three.  Before version 3.0, we could only do a single background image per element which forced us to use a lot of unnecessary markup in order to layout all the images.  IE versions &lt; 9 are not equipped to handle multiple images so the extra div named &lt;i&gt;closingbracediv&lt;/i&gt; is there for putting out the closing brace in IE.  No support for rounded corners in IE 8.0.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/ied.jpg" alt="IE version"  /&gt;&lt;br /&gt;&lt;br /&gt;Browser Support for Multiple Backgrounds&lt;br /&gt;&lt;ul class="starlist"&gt;&lt;li&gt;Internet Explorer 9.0&lt;/li&gt;&lt;li&gt;Firefox 3.6&lt;/li&gt;&lt;li&gt;Opera 10.5&lt;/li&gt;&lt;li&gt;Safari (Webkit) 1.3&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;For the rest of the blockquote &lt;a href="http://pics.cssbakery.com/pics/restoftheCSS.txt"&gt;CSS&lt;/a&gt; and &lt;a href="http://pics.cssbakery.com/pics/blockquotemarkup.txt"&gt;HTML&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8384577485069245127?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8384577485069245127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/css-3-gradients-css-3-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8384577485069245127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8384577485069245127'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/css-3-gradients-css-3-multiple.html' title='CSS 3 Gradients, CSS 3 Multiple Background Images and HTML Blockquote'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4838648329590938895</id><published>2011-02-24T22:43:00.000-08:00</published><updated>2011-02-24T22:44:48.628-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Background Property'/><category scheme='http://www.blogger.com/atom/ns#' term='Pullqutoes'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Blockquote'/><title type='text'>CSS Pullquotes Continued</title><content type='html'>&lt;img src="http://pics.cssbakery.com/pics/bracequote1.jpg" alt="blockquote example with brace" /&gt;&lt;br /&gt;&lt;br /&gt;I made a &lt;a href="http://pics.cssbakery.com/pics/closingbrace300.png"&gt;png image&lt;/a&gt; of a closing brace in Photoshop (Yes, I finally bought another version of it. I should keep the new disk in a bank vault.) which gives us new looks for the pullquote example.&lt;br /&gt;&lt;br /&gt;Markup for the pullquote style that uses a brace image:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div class="suspended"&amp;gt;&lt;br /&gt;&amp;lt;div class="suspendedquotebrace"&amp;gt;&lt;br /&gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;The internet is built on a single simple idea: the IP Packet&lt;br /&gt;&amp;lt;span&amp;gt;-CSSBakery.com&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div class="linediv"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;For its CSS, see this &lt;a href="http://pics.cssbakery.com/pics/braceonwhitebgCSS.txt"&gt;file&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/bracequote3.jpg" alt="blockquote example with brace" /&gt;&lt;br /&gt;&lt;br /&gt;Example Markup for the pullquote style that uses a brace image on a black background:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div class="suspended"&amp;gt;&lt;br /&gt;&amp;lt;div class="suspendedquotebrace"&amp;gt;&lt;br /&gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;The internet is built on a single simple idea: the IP Packet&lt;br /&gt;&amp;lt;span&amp;gt;-CSSBakery.com&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div class="related_topics"&amp;gt;&lt;br /&gt;&amp;lt;h3&amp;gt;&lt;br /&gt;&amp;lt;b&amp;gt;RELATED TOPICS&amp;lt;/b&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href="http://www.ietf.org/"&amp;gt;Internet Eng'g Task Force&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href="http://www.w3.org/Protocols/"&amp;gt;Network Engineering&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For its CSS, see this &lt;a href="http://pics.cssbakery.com/pics/blackroundedCSS.txt"&gt;file&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4838648329590938895?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4838648329590938895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/css-pullquotes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4838648329590938895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4838648329590938895'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/css-pullquotes.html' title='CSS Pullquotes Continued'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7539921872492875070</id><published>2011-02-21T20:42:00.001-08:00</published><updated>2012-01-09T14:33:39.287-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Background Property'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Blockquote'/><category scheme='http://www.blogger.com/atom/ns#' term='DIV'/><category scheme='http://www.blogger.com/atom/ns#' term='ul'/><category scheme='http://www.blogger.com/atom/ns#' term='Padding and Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='clear'/><category scheme='http://www.blogger.com/atom/ns#' term='Classes and IDs'/><category scheme='http://www.blogger.com/atom/ns#' term='Pullqutoes'/><category scheme='http://www.blogger.com/atom/ns#' term='Descendant Selector'/><category scheme='http://www.blogger.com/atom/ns#' term='Floating'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='display:block; Fonts and Text'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Newspaper Style Pullquotes Using CSS and HTML</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#closeupfibersjpg').cssBakeryCaption({'opacity':'0.4','centerCaption':true,'round':true,'hide':true,'top':true,'color':'white','bgcolor':'#af06fd'});});&lt;/script&gt;&lt;br /&gt;It was on &lt;a href="http://www.cnn.com" target="_blank" alt="CNN" /&gt;CNN&lt;/a&gt; where I saw the pullquote styling that I'll be talking about in this post.   Using the blockquote element, I've shown you how to &lt;a href="http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html"&gt;style pullquotes&lt;/a&gt; before.  In the new example, the pullquotes will force the text to be indented as it flows around them, engaging the body of the text.  I am going to use material from a previous post to show you how it works.  I will list the CSS immediately after the newly styled, &lt;a href="http://www.cssbakery.com/2010/10/how-internet-works-ip-packets-routers.html"&gt;How the Internet Works&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="article"&gt;&lt;h1&gt;How the Internet Works&lt;/h1&gt;&lt;div class="byline"&gt;By &lt;b&gt;CSSBakery.com&lt;/b&gt;&lt;/div&gt;&lt;div class="timestamp"&gt;February 21, 2011 7:30 p.m. PST&lt;/div&gt;&lt;img class="captioned" id='closeupfibersjpg' style='display:none;' src='http://pics.cssbakery.com/pics/closeupfibers.jpg' alt='Fiberoptic Bundle&amp;lt;br&amp;gt; [ISO 6400]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;div class="article_summary"&gt;&lt;b&gt;HIGHLIGHTS&lt;/b&gt;&lt;br /&gt;&lt;ul class="starlistx"&gt;&lt;li&gt;IP Packets: IP Packets are similar to traditional snail-mail letters&lt;/li&gt;&lt;li&gt;IP Addressing: Each packet  has a from and to address&lt;/li&gt;&lt;li&gt;IP Routing: Routers do the delivery work&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;In a previous post I described &lt;a href="http://www.cssbakery.com/2010/09/web-server-basics-lamp-stack.html"&gt;TCP/IP&lt;/a&gt;. In this post I'll focus more on the lower layers of the protocol stack: the IP layer and below. One key thing to understand is that the Internet is built on a single simple idea: the IP Packet.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So what is it?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;An IP Packet is lot like a letter you send via the post office. In the case of IP Packets of course, we're really talking about an array of bytes in your computer memory, not a physical piece of mail. But there really are many similarities. In both case you have a From Address, a To Address, and inside it carries some contents that you want delivered at the other end.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;With both IP Packets and letters, once you send it you no longer have any control over it - it's out of your hands. It goes into the delivery system and you depend on that delivery system to get it where it's supposed to go. There is a small chance it could get delivered to the wrong place, or lost completely. &lt;br /&gt;&lt;/p&gt;&lt;div class="suspended"&gt;&lt;div class="suspendedquote"&gt;&lt;blockquote&gt;The Internet is a series of tubes&lt;br /&gt;&lt;span&gt;-US Senator Ted Stevens&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="linediv"&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;The contents could be examined by some third party, damaged so that they are unreadable, or even intentionally altered by some unscrupulous party before being delivered. There are protections against each of these bad outcomes, which I'll talk about in a later post.&lt;/p&gt;&lt;img style="clear: both; float:left; padding:0;" src="http://pics.cssbakery.com/pics/hill160px.jpg" alt="A B/W Adobe Posterized Image of Capitol Hill" title="A B/W Posterized Image of Capitol Hill" /&gt;&lt;p&gt;In the case of a letter, you write the from and to addresses on the outside of the envelope and place the contents inside the envelope. IP Packets have a similar idea. An IP Packet starts life as just a sequence of bytes in your computer memory. Typically the first 20 bytes or so are used like the outside of an envelope. This part of the packet is called the "IP Header".&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This is where the from and to IP Addresses are placed. IP Addresses are 4 bytes each(*), so those take up 8 of the 20 bytes. Some of the other bytes in the header are used by the delivery system for housekeeping. As an analogy, recall that the outside of an envelope has a stamp, and the postal service adds a post mark. Similar idea.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After the IP header, we place the bytes of the payload - the thing we want to get delivered to the recipient. Once we've got the payload, and the header constructed, we need to send it. With letters we need to get them to the post office. The equivalent in the IP World is your local Router. The router is responsible for looking at the destination IP address and figuring out where to send the packet next. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;That next hop is likely another router that is one step closer to the recipient - just as your local post office might send the letter to another postal facility to be sorted and forwarded on towards the destination address. &lt;br /&gt;&lt;/p&gt;&lt;div class="suspended"&gt;&lt;div class="suspendedquote"&gt;&lt;blockquote&gt;The internet is built on a single simple idea: the IP Packet&lt;br /&gt;&lt;span&gt;-CSSBakery.com&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="linediv"&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;The way we get the packet from your computer to your local router is over your local area network (WiFi or Ethernet). If you are hooked up directly to a DSL/Cable Modem, then your "local" router is really a router located at your Internet Sevice Provider. The main idea here is that you can send the IP Packet to the router directly over the underlying networking media, whether that is Ethernet, WiFi, DSL, or Dial-up. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;There is a whole other story on how the packet gets delivered over this media to the router, but for now just think of this media as your local mailman who picks up the letter and carries it to the post office (i.e. to the local Router). I can go into more details on Ethernet, WiFi, DSL etc. in a future post.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After an IP packet has been constructed in your computer memory, and carried to your local router via your local networking media, the router gets to work. It looks at the destination IP address, and matches this against a set of configured rules in a table. The rules are called "IP Routes", and the table is called the "IP Routing Table". By matching the destination IP address against the IP Routes, the router figures out the next place to send the packet. We call this the "next hop". &lt;br /&gt;&lt;/p&gt;&lt;div class="suspended"&gt;&lt;div class="suspendedquote"&gt;&lt;blockquote&gt;The next hop is going to be another router that will repeat the same process&lt;span&gt;-CSSBakery.com&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div class="linediv"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="related_topics"&gt;&lt;h3&gt;&lt;b&gt;RELATED TOPICS&lt;/b&gt;&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.ietf.org/"&gt;Internet Eng'g Task Force&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.w3.org/Protocols/"&gt;Hyptertext Transfer Protocol&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p&gt;Your IP packet might hop through a dozen routers. Finally it reaches a router that can talk directly to the recipient, and that becomes the final "next hop". The packet is sent from that final router to the destination over the local networking media, just like the mailman delivering mail.&lt;/p&gt;&lt;p&gt;The recipient (destination computer) opens up the packet. It can see the senders IP address, and it can read the contents. It's at this point that IP will hand the contents off to some higher layer protocol like TCP or UDP. IP has done it's job which is to get the contents of the packet from the sender to receiver. Any replies that go back to the sender will be determined by a higher layer protocol. For example, TCP may want to send an acknowledgment of the received packet. It will do this by forming yet another IP packet, with the original sender's IP address now placed in the new packet's IP header as the destination IP address (just like you would reply to someone who sent you a letter by sending them back a letter with the from/to addresses reversed).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In the world of TCP/IP networking there are a lot more details, more protocols, more ideas, as well as info on how you can write programs to directly use the TCP/IP protocol stack. There are entire books, and series of books on these subjects, but I hope in this post I've at least given you a flavor of how the Internet really works under the hood.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;Here's the CSS for the pullquotes shown above. If you are not on Blogger, then you will exclude parts of the selector that are in red.  &lt;i&gt;div.suspended&lt;/i&gt; has enough specificity for most users.  The pathnames for the two images are generic.  Replace them with your own pathnames.&lt;br /&gt;&lt;br /&gt;&lt;pre class='MiamiVice'&gt;&lt;span style="color:red;"&gt;&lt;br /&gt;#main-wrapper div.post-body&lt;/span&gt;  div.suspended {&lt;br /&gt;    color: #666666;&lt;br /&gt;    font: bold 24px/27px arial;&lt;br /&gt;    padding: 0 27px 0 0;&lt;br /&gt;    width: 244px;&lt;br /&gt;    float: left;&lt;br /&gt;    margin:0;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;.suspendedquote {&lt;br /&gt;    background: url("images/bluequote_58x48.jpg") no-repeat scroll  100% 100%  transparent;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;div.suspended blockquote {&lt;br /&gt;    margin: 0; padding: 0;&lt;br /&gt;    padding-bottom: 25px;&lt;br /&gt;    padding-right: 10px;&lt;br /&gt;    text-align: left;&lt;br /&gt;    line-height: 1.1em;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;div.suspended span {&lt;br /&gt;    color: #999999;&lt;br /&gt;    display: block;&lt;br /&gt;    font: 10px/12px arial;&lt;br /&gt;    padding: 18px 0 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div.article {&lt;br /&gt;    margin-left: auto;&lt;br /&gt;    margin-right: auto;&lt;br /&gt;    width: 570px;  &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;div.article p {&lt;br /&gt;    margin: 0;&lt;br /&gt;    padding: 0 24px 19px 186px;&lt;br /&gt; &lt;br /&gt;    color: #606060;&lt;br /&gt;    font-family: "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;&lt;br /&gt;    font-size: 13px;&lt;br /&gt;    line-height: 1.6em;&lt;br /&gt;    text-align: justify;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.linediv {&lt;br /&gt;    width: 180px; &lt;br /&gt;    background-color: #000000;&lt;br /&gt;    height: 3px;&lt;br /&gt;    margin: 25px 0 0 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.starlistx {&lt;br /&gt;    list-style-type: none;&lt;br /&gt;    margin: 9px 0 10px;&lt;br /&gt;    padding: 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.starlistx li {&lt;br /&gt;    background: url("images/star.gif") no-repeat scroll 0 2px transparent;&lt;br /&gt;    padding-left: 17px;&lt;br /&gt;    padding-bottom: 9px;&lt;br /&gt;    color: #333333;&lt;br /&gt;    font: 11px/14px arial;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article_summary {&lt;br /&gt;    float: left;&lt;br /&gt;    width: 160px;&lt;br /&gt;    color: black;&lt;br /&gt;    font: 12px /14px arial;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article  .captioned {&lt;br /&gt;    margin-bottom:35px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .byline, .article .timestamp {&lt;br /&gt;   font-family : Arial,Helvetica,sans-serif;&lt;br /&gt;   font-size : 12px;&lt;br /&gt;   color : #666666;&lt;br /&gt;   margin-bottom: 3px;&lt;br /&gt;   line-height: 15px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .timestamp {&lt;br /&gt;   margin-bottom: 20px;&lt;br /&gt;   font-size : 11px;&lt;br /&gt;}&lt;br /&gt;    &lt;br /&gt;.article .related_topics {&lt;br /&gt;   clear: left;&lt;br /&gt;   float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .related_topics h3 {&lt;br /&gt;   font-family: Arial,sans-serif;&lt;br /&gt;   font-size: 12px;&lt;br /&gt;   font-weight: 400;&lt;br /&gt;   color: #000000;&lt;br /&gt;   text-decoration: none;&lt;br /&gt;   letter-spacing: normal;&lt;br /&gt;   word-spacing: 0;&lt;br /&gt;   line-height: 18px;&lt;br /&gt;   padding: 0;&lt;br /&gt;   padding-top:5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .related_topics ul {&lt;br /&gt;   margin: 0; padding: 0;&lt;br /&gt;   margin-top: 6px;&lt;br /&gt;   font-family: arial;&lt;br /&gt;   font-size: 11px;&lt;br /&gt;   font-weight: bold;&lt;br /&gt;   font-style: normal;&lt;br /&gt;   color: #004276;&lt;br /&gt;   text-decoration:none;&lt;br /&gt;   letter-spacing: normal;&lt;br /&gt;   word-spacing: 0;&lt;br /&gt;   line-height:14px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .related_topics ul li {&lt;br /&gt;   list-style-type: none;&lt;br /&gt;   padding-bottom: 2px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .related_topics ul li a {&lt;br /&gt;   color: #767676;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.article .related_topics ul li a:hover {&lt;br /&gt;   color: #58c5fe;&lt;br /&gt;   text-decoration: none;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;For the markup, see &lt;a href="http://pics.cssbakery.com/pics/pullquote2.txt" target="_blank" alt="The Markup" /&gt;HTML&lt;/a&gt;.&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/pullquoteMARKUP.jpg" alt="pullquote markup" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7539921872492875070?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7539921872492875070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/newspaper-style-pullquotes-using-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7539921872492875070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7539921872492875070'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/newspaper-style-pullquotes-using-css.html' title='Newspaper Style Pullquotes Using CSS and HTML'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1995072031060298367</id><published>2011-02-20T10:19:00.000-08:00</published><updated>2011-02-20T22:59:56.157-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>The Sun is Racing Me</title><content type='html'>It was already bright by 6:20 am.  I had a hard time getting up today -  a combination of sleepiness and a tummy ache.  So I'm walking to my kayak reluctantly through the cold marina air and I see this woman walking her dog in her patterned flannel pajama bottoms.  I thought I completely understand her.  It's too early to dress properly.  The kayaking wasn't too bad because it turns out the fishermen sleep in on Sundays. Only one wake from a turning sailboat.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1995072031060298367?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1995072031060298367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/sun-is-racing-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1995072031060298367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1995072031060298367'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/sun-is-racing-me.html' title='The Sun is Racing Me'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3149255591988363502</id><published>2011-02-19T14:06:00.000-08:00</published><updated>2011-02-27T03:00:24.113-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wf-inactive'/><category scheme='http://www.blogger.com/atom/ns#' term='WebFontConfig'/><category scheme='http://www.blogger.com/atom/ns#' term='wf-active'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='FOUT'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS visibility'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM'/><category scheme='http://www.blogger.com/atom/ns#' term='wf-loading'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Webfonts'/><category scheme='http://www.blogger.com/atom/ns#' term='Meddon'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash of Unstyled Text'/><title type='text'>Google Web Fonts Flash of Unstyled Text (FOUT) Problem with wf-active</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#googlefontsjpg').cssBakeryCaption({'opacity':'0.7','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='googlefontsjpg' style='display:none;' src='http://pics.cssbakery.com/pics/googlefonts.jpg' alt='Google Fonts&amp;lt;br&amp;gt;[google.com/webfonts]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;I decided to use a font off of &lt;a href="http://www.google.com/webfonts"&gt;Google Web Fonts&lt;/a&gt; but quickly ran into the FOUT (Flash of Unstyled Text) in Firefox.  On the Web Fonts page, when you click on "use this font", the basic instructions tell you to put in a link to a stylesheet and then just use the new font family in your CSS.  With that approach Firefox will first display the text in a native font, and then replace it with the new font once it's downloaded.  So you get the FOUT.&lt;br /&gt;&lt;br /&gt;So back to the Web Fonts page and on the "use this font" page towards the bottom there's a link for &lt;i&gt;Advanced Techniques&lt;/i&gt;.  You'll then see a link to the &lt;a href="http://code.google.com/apis/webfonts/docs/webfont_loader.html"&gt;WebFont loader documentation&lt;/a&gt;.  At first glance it looks like all you need to do is use their script and put the following type of styles in your stylesheet:&lt;br /&gt;&lt;pre class="Blue"&gt;.wf-loading h1 {&lt;br /&gt;        font-family: serif&lt;br /&gt;      }&lt;br /&gt;      .wf-inactive h1 {&lt;br /&gt;        font-family: serif&lt;br /&gt;      }&lt;br /&gt;      .wf-active h1 {&lt;br /&gt;        font-family: 'Meddon', serif&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The wf-loading, wf-inactive, and wf-active classes are added to your document &amp;lt;html&amp;gt; tag by Google's script at various points in time to reflect the state of what's happening with the font download.  With that in mind I tried this:&lt;br /&gt;&lt;pre class="Blue"&gt;.wf-loading h1 {&lt;br /&gt;        font-family: serif;&lt;br /&gt;      }&lt;br /&gt;      .wf-inactive h1 {&lt;br /&gt;        font-family: serif;&lt;br /&gt;      }&lt;br /&gt;      .wf-active h1 {&lt;br /&gt;        font-family: 'Meddon', serif;&lt;br /&gt;        visibility: visible;&lt;br /&gt;      }&lt;br /&gt;      h1 {&lt;br /&gt;        visiblity: hidden;&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The idea is that the h1's will initially be hidden and will only change to visible once the wf-active class is added to the html tag.  It seemed that this should work fine, but &lt;em&gt;it didn't&lt;/em&gt;.  I'm not sure if this issue is specific to Blogger or not, but what I found is that I still get the FOUT.  It's as if the Google script is adding wf-active class too soon, before the font is really ready.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;BACK TO THE DRAWING BOARD&lt;/h1&gt;&lt;br /&gt;So I went back to the WebFont loader documentation and dug a little deeper.  The WebFont loader can be configured to invoke callback functions that you provide.  One of the events that you can set a callback on is "active" - meaning that the font is loaded.  I decided to try using this callback to make my text visible, so I changed the stylesheet to look like this:&lt;br /&gt;&lt;pre class="Blue"&gt;.wf-loading h1 {&lt;br /&gt;        font-family: serif;&lt;br /&gt;      }&lt;br /&gt;      .wf-inactive h1 {&lt;br /&gt;        font-family: serif;&lt;br /&gt;      }&lt;br /&gt;      .wf-active h1 {&lt;br /&gt;        font-family: 'Meddon', serif;&lt;br /&gt;      }&lt;br /&gt;      h1 {&lt;br /&gt;        visibility: hidden;&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Notice that I no longer have visibility: visible in the wf-active rule.  I'm now going to take care of making it visible in the active callback.  Here's my first attempt at setting the callback function as part of the WebFontConfig object:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;  WebFontConfig = {&lt;br /&gt;    google: { families: [ 'Meddon' ] },&lt;br /&gt;    &lt;span style='color:red'&gt;active: function() {&lt;br /&gt;      $('h1').css({'visibility':'visible';});&lt;br /&gt;    }&lt;/span&gt;&lt;br /&gt;  };&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So all I'm saying here is: when the font goes 'active', set the visibility of my h1's to visible (I'm using jQuery to access all the h1's).  This &lt;em&gt;almost&lt;/em&gt; worked.  In fact it worked about 50% of the time, but half the time the page loaded and the h1 did not show up at all.  &lt;br /&gt;&lt;br /&gt;I eventually concluded that the problem occurs in cases where the font is downloaded, and the active callback is firing,  &lt;em&gt;before&lt;/em&gt; the document itself is fully downloaded.  In those cases, setting the h1 visibility doesn't work because the h1 doesn't exist yet in the DOM.  So, my second attempt, which so far has worked 100% of the time, looks like this:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;script type='text/javascript'&amp;gt;&lt;br /&gt;  WebFontConfig = {&lt;br /&gt;    google: { families: [ 'Meddon' ] },&lt;br /&gt;    active: function() {&lt;br /&gt;      $('h1').css({'visibility':'visible';});&lt;br /&gt;      &lt;span style='color:red'&gt;$(document).ready(function() {&lt;br /&gt;        $('h1').css({'visibility':'visible';});&lt;br /&gt;      });&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;  };&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What I've added is a callback to be executed when the document is ready using the usual jQuery approach (the 'ready' method).  So now those cases where the document is still downloading when the font become active are covered.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/mydaffodils.jpg" alt="summary of font related posts"  /&gt;&lt;h4&gt;google fonts + cufon + font-face&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/update-google-webfont-fout-flash-of.html"&gt;Update: Google WebFonts FOUT Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/02/google-web-fonts-flash-of-unstyled-text.html"&gt;Google WebFonts FOUT Problem with wf-active&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html"&gt;Fixing Firefox font-face Cross Domain Problem&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3149255591988363502?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3149255591988363502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/google-web-fonts-flash-of-unstyled-text.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3149255591988363502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3149255591988363502'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/google-web-fonts-flash-of-unstyled-text.html' title='Google Web Fonts Flash of Unstyled Text (FOUT) Problem with wf-active'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1610956891977559157</id><published>2011-02-19T12:28:00.000-08:00</published><updated>2011-02-19T14:44:49.828-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Gusting Winds</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#friBW2jpg').cssBakeryCaption({'opacity':'0.1','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#00dec2'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='friBW2jpg' style='display:none;' src='http://pics.cssbakery.com/pics/friBW2.jpg' alt='Friday Evening&amp;lt;br&amp;gt;[rain and wind]&amp;lt;br&amp;gt;&amp;copy; 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Last night was cold and rainy with 20+ mph gusting winds so I thought this morning would be a no go.  Mistake.  I got up later than usual and the sun is shining. We have 70% chance rain which will hit in the afternoon.  There's always tomorrow morning. :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1610956891977559157?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1610956891977559157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/gusting-winds.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1610956891977559157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1610956891977559157'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/gusting-winds.html' title='Gusting Winds'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3338403995109198053</id><published>2011-02-14T16:52:00.000-08:00</published><updated>2011-02-15T21:44:50.678-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP sort'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP count'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP in_array'/><title type='text'>PHP Arrays</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#pretzelsjpg').cssBakeryCaption({'opacity':'0.7','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'#e80560'});});&lt;/script&gt;&lt;img id='pretzelsjpg' style='display:none;' src='http://pics.cssbakery.com/pics/pretzels.jpg' alt='[Salted Pretzels + Melted Chocolate + Nonpareil]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;These pretzels that I made awhile back seem perfect for today's Array post. Happy Valentine's Day!  :-)&lt;br /&gt;&lt;br /&gt;Arrays are data structures that hold multiple rows of data, usually of the same type.   There are languages (like PHP) which allow you to store elements of different types in the same array.  Arrays just like matrices in mathematics can be single or multi-dimensional.   &lt;br /&gt;&lt;br /&gt;When you declare an array variable in C, the compiler allocates a block of memory to be used by the elements of the array.  For example, int numbers[10] declaration will set aside 40 bytes for the numbers array in a 32-bit architecture system. The number inside the square brackets is how you tell the compiler how many elements there are in an array.  The first element of the array can be referenced by index zero as in numbers[0].  An index of an array counts from the beginning of the array, indicating the ordinal number of the element.  C, C++ indexes start from 0. &lt;br /&gt;&lt;br /&gt;If you're going to write any kind of significant PHP application, you are going to use arrays.  You'll quickly find that PHP arrays are not like C, C++, or Java arrays - they are much more powerful.  They are powerful because they really aren't "arrays" at all, but "ordered maps".  An ordered map is a data structure that associates &lt;em&gt;values&lt;/em&gt; to &lt;em&gt;keys&lt;/em&gt;.  PHP arrays are not preallocated with fixed size elements.  They can function a lot like C or Java arrays by using numeric keys:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;$a[0] = "first";&lt;br /&gt;$a[1] = "second";&lt;br /&gt;$a[2] = "third";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;But the keys are not limited to numbers:&lt;br /&gt;&lt;pre class="Blue"&gt;$a['apple'] = "red";&lt;br /&gt;$a['grape'] = "green";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And the values can be just about anything, including other arrays:&lt;br /&gt;&lt;pre class="Blue"&gt;$a['fruits'] = array("apple","grape","strawberry");&lt;br /&gt;$a['veggies'] = array("cabbage","carrot","lettuce"); &lt;br /&gt;&lt;/pre&gt;When you assign arrays within arrays like this, you've created PHP's version of multi-dimensional arrays.  You can access elements of this multi-dimensional array by specifying two key values.  For example:&lt;br /&gt;&lt;pre class="Blue"&gt;echo $a['fruits'][0]; // outputs: apple&lt;br /&gt;  echo $a['veggies'][1]; // outputs:  carrot&lt;br /&gt;&lt;/pre&gt;You'll run into mult-dimensional arrays when accessing databases.  The set of records returned from a query will be in an array.  Within that array each element will be an array that represents all the fields of a particular record. &lt;br /&gt;&lt;br /&gt;Before you use an array, you should declare it, like this:&lt;br /&gt;&lt;pre class="Blue"&gt;$a = array();&lt;br /&gt;&lt;/pre&gt;(Note however, that if you are getting an array back from a database query, then you don't have to declare it, since the function you called to execute the query will do that for you.)&lt;br /&gt;&lt;br /&gt;You can also put some entries into the array as you create it:&lt;br /&gt;&lt;pre class="Blue"&gt;$a = array("Mercury","Venus","Earth","Mars");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When you create an array this way, the keys will be numbers starting from zero:&lt;br /&gt;&lt;pre class="Blue"&gt;0 =&gt; "Mercury",&lt;br /&gt;1 =&gt; "Venus",&lt;br /&gt;2 =&gt; "Earth",&lt;br /&gt;3 =&gt; "Mars"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can get the same result using the append syntax, which adds a new element at the end of the array, and increments a numeric key value:&lt;br /&gt;&lt;pre class="Blue"&gt;$a = array();&lt;br /&gt;$a[] = "Mercury",&lt;br /&gt;$a[] = "Venus",&lt;br /&gt;$a[] = "Earth",&lt;br /&gt;$a[] = "Mars"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If you need the keys to be something other than integers, you can specify them like this:&lt;br /&gt;&lt;pre class="Blue"&gt;$a = array("Hottest"=&gt;"Mercury","Hot"=&gt;"Venus","JustRight"=&gt;"Earth","Cold"=&gt;"Mars");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Giving you:&lt;br /&gt;&lt;pre class="Blue"&gt;$a["Hottest"] equal to: "Mercury",&lt;br /&gt;$a["Hot"] equal to: "Venus",&lt;br /&gt;$a["Just Right"] equal to: "Earth",&lt;br /&gt;$a["Cold"] equal to: "Mars"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;LOOPING THROUGH PHP ARRAYS&lt;/h1&gt;&lt;br /&gt;To loop through an array, your best bet is the foreach statement:&lt;br /&gt;&lt;pre class="Blue"&gt;foreach ($a as $planet) {&lt;br /&gt;  echo $planet; &lt;br /&gt;}&lt;br /&gt;// outputs: Mercury, Venus, Earth, Mars&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If you need it, you can also access the key value, with this syntax:&lt;br /&gt;&lt;pre class="Blue"&gt;// $temp will be the array element's key.&lt;br /&gt;// $planet will be the array element's value.&lt;br /&gt;  foreach ($a as $temp =&gt; $planet) {&lt;br /&gt;    echo "$planet is $temp ";&lt;br /&gt;  }&lt;br /&gt;  // outputs: Mercury is Hottest, Venus is Hot, Earth is Just Right, Mars is Cold&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;But, you should not think that foreach is the only way to iterate over an array.  There are times when you need something else.  If you know the array has numeric keys starting from zero, you can write a traditional for loop, looking a lot like C:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;for ($i=0; $i&amp;lt;count($a); $i++) {&lt;br /&gt;  echo $a[$i];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or you can make use of the internal array pointer that PHP maintains for each array.  This is especially useful if you have a loop where you might need to process more than one array element on a single pass through the loop:&lt;br /&gt;&lt;pre class="Blue"&gt;reset($a);  // reset internal pointer to the first element of array&lt;br /&gt;while ($planet = current($a)) {  // get the current array element.&lt;br /&gt;  echo $planet;&lt;br /&gt;  next($a);  // advance to the next array element.&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When the end of the array is reached, current() will return false and the loop will end.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;PHP ARRAY FUNCTIONS&lt;/h1&gt;&lt;br /&gt;Now that you've got an array, you can use the many &lt;a href="http://php.net/manual/en/ref.array.php"&gt;PHP array functions&lt;/a&gt; to do things with it.  Some of the more important of these are:&lt;br /&gt;&lt;ul class="starlist"&gt;&lt;li&gt;count() - return the number of elements in the array.&lt;/li&gt;&lt;li&gt;sort() - sort array elements.&lt;/li&gt;&lt;li&gt;in_array() - check to see if a value exists in the array.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3338403995109198053?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3338403995109198053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/php-arrays_14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3338403995109198053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3338403995109198053'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/php-arrays_14.html' title='PHP Arrays'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1422082736790699870</id><published>2011-02-12T11:36:00.000-08:00</published><updated>2011-02-13T13:58:43.712-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>No Bad Days</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#nobaddaysjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'#FAF1E3','bgcolor':'black'});});&lt;/script&gt;&lt;img id='nobaddaysjpg' style='display:none;' src='http://pics.cssbakery.com/pics/nobaddays.jpg' alt='Sunrise&amp;lt;br&amp;gt;[summer 2010]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;Good Morning! :-)  &lt;br /&gt;&lt;br /&gt;I got up at 6:30 today.  By 7 am, I was out walking to my kayak.   The only way to avoid heavy boat traffic is to get on the water earlier.   I kayaked over an hour, going all the way to the entrance of the marina.   Although I was able to avoid the sailboats,  guys who fish had the same idea  and were motoring out.  Some of these boats are rather large with powerful twin engines which makes kayaking next to them a little dicey.   My wide ocean kayak, its length around 14 feet, is quite stable or it would be only a matter time before I get tossed out into the cold water because of their wakes.   When I got finished,  my legs were covered with dried salt from the ocean water.  Sun is getting stronger.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1422082736790699870?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1422082736790699870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/no-bad-days.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1422082736790699870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1422082736790699870'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/no-bad-days.html' title='No Bad Days'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7493704057514644905</id><published>2011-02-10T18:45:00.000-08:00</published><updated>2011-02-10T18:47:59.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='localhost'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP count'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP foreach'/><category scheme='http://www.blogger.com/atom/ns#' term='XAMPP'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache Server on Local Environment'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='server side'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP empty'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP if'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache'/><category scheme='http://www.blogger.com/atom/ns#' term='Friends of Apache'/><title type='text'>Programming with PHP in a Local Environment</title><content type='html'>The &lt;a href="http://www.cssbakery.com/2011/02/developing-with-php-phpmyadmin-apache.html"&gt;previous post&lt;/a&gt; shows how to set up a local environment with XAMPP.  In this post we start developing PHP code.&lt;br /&gt;&lt;br /&gt;I have two files, &lt;a href="http://pics.cssbakery.com/pics/main.txt" alt="main php file"&gt;main.php&lt;/a&gt; and &lt;a href="http://pics.cssbakery.com/pics/register.txt" alt="register PHP file"&gt;register.php&lt;/a&gt; that I've been editing.  I renamed their extensions to .txt so that you can view them here.  If I had left them as .php's, they'll try to run when you click on the filenames.  You'll see that they are nothing fancy, just an initial draft to get you started.  So, now I'd like to show you how to execute those files.  I told you my directory name at the beginning of the post.  So, type into your browser:&lt;br /&gt;&lt;br /&gt;"localhost/eclipseworkspace/projectX/main.php"&lt;br /&gt;&lt;br /&gt;If I had named it "index.php" instead  of main, then you could skip the filename.  This code shows how you can validate the fields of the form in PHP, and give the user an error message if something is wrong.  It works fine except for one problem:  if there are multiple errors, such as a zero length username AND a zero length password, then only one error message is displayed to the user.   In this case it's the password error message, since that check occurs later in the code.&lt;br /&gt;&lt;br /&gt;To fix this, we can change the code to keep an array of error messages.  Here's how we'll do that:&lt;br /&gt;&lt;br /&gt;1.  Instead of setting $error=false, lets instead create an empty array, and let's make the variable plural $errors instead of $error.  Of course, you know that a compiler, or in this case the PHP interpreter, does not really distinguish between singular and plural form.  It just helps make the variable names more meaningful for us:&lt;br /&gt;&lt;pre class="Blue"&gt;$errors = array(); // create an empty array&lt;/pre&gt;&lt;br /&gt;Now, when we detect an error, instead of just assigning a string to $error, we will append the error string to the array.  For example:&lt;br /&gt;&lt;pre class="Blue"&gt;$errors[] = "Error: Please enter a username";&lt;/pre&gt;&lt;br /&gt;We make that same change for all other error messages.  Note that we are making use of PHP syntax for appending to an array.  That's where you have the array variable name followed by empty square brackets, like this: $arrayName[] = "string to append"&lt;br /&gt;&lt;br /&gt;Now we need to change the test for whether we encountered any errors or not.  Currently the code says:&lt;br /&gt;&lt;pre class="Blue"&gt;if (!$error) {&lt;/pre&gt;&lt;br /&gt;We change that to instead test whether there is anything in the array.  If there is nothing in the array (count of elements is zero), then there were no errors:&lt;br /&gt;&lt;pre class="Blue"&gt;if (count($errors)== 0) {&lt;/pre&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/php1.jpg" alt="PHP" title="PHP" /&gt;&lt;br /&gt;So far so good.  Now the only thing remaining is to change the code that displays the error to the user.  Here's what we've got right now. The PHP &lt;i&gt;empty&lt;/i&gt; function will return true if your string is set to either FALSE, an empty string or an empty array or zero:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;?php // Old code to be removed:&lt;br /&gt;  if (!empty($error)):?&amp;gt;&lt;br /&gt;    &amp;lt;p class="error"&amp;gt;&amp;lt;?php echo $error?&amp;gt&amp;lt/p&amp;gt;&lt;br /&gt;  &amp;lt;?php endif;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;Now we want to change that to:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt?php // New code:&lt;br /&gt;  foreach($errors as $e):?&gt;&lt;br /&gt;    &amp;lt;p class="error"&amp;gt;&amp;lt;?php echo $e?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;?php endforeach;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;Note that we no longer have an if statement here.  That's because in the case where there were no errors the array will be empty and we'll never execute the body of the foreach statement.  On the other hand if there are one or two or more errors in the array, we will loop through them and display all of them one by one.&lt;br /&gt;&lt;br /&gt;If you are not familiar with the PHP foreach syntax, it just provides an easy way to iterate over all the elements of an array.  The loop starts with the first element in the array and continues with the next element until the end.  Each time through the loop the value of the current element is assigned to the variable specified after the "as" ($e in the example code above).  Basically says step through this array and for each element assign that value to my variable $e, then run the body of the loop.&lt;br /&gt;&lt;br /&gt;There are certainly other ways you could code this loop.  For example, this would be equivalent:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;?php for ($i=0; $i&amp;lt;count($errors); $i++):?&amp;gt;&lt;br /&gt;    &amp;lt;p class="error"&amp;gt;&amp;lt;?php echo $errors[$i]?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;?php endfor;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The syntax above will feel very familiar and comforting but although this form of the loop works, the former method is more bulletproof since it will work for any array no matter what the array keys are.  In this case the keys happen to be integer values starting with 0 and incrementing, but PHP arrays are associative arrays, so you can do things like $myarray['banana']='yellow' and $myarray['apple']='red'.  In such a case the former loop will still work, but the latter loop that depends on numeric keys will not.&lt;br /&gt;&lt;br /&gt;For more on PHP foreach syntax, see &lt;a href="http://php.net/manual/en/control-structures.foreach.php"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="hilite"&gt; Note 1: &lt;/span&gt; A quick &lt;a href="http://pics.cssbakery.com/pics/longshortTAG.jpg" alt="Long Tag-Short Tag" /&gt; visual comparison&lt;/a&gt; of the long and short tags of PHP.&lt;br /&gt;&lt;br /&gt;&lt;span class="hilite"&gt; Note 2: &lt;/span&gt; The switching symbols used below to go between PHP and HTML making you queasy?  Feels like a PHP-HTML-PHP carousel.  &lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;?php &lt;br /&gt;  if (!empty($error)):?&amp;gt;&lt;br /&gt;    &amp;lt;p class="error"&amp;gt;&amp;lt;?php echo $error?&amp;gt&amp;lt/p&amp;gt;&lt;br /&gt;  &amp;lt;?php endif;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;An alternative way to write this would be:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;?php &lt;br /&gt;  if (!empty($error)):&lt;br /&gt;    echo "&amp;lt;p class='error'&amp;gt;$error&amp;lt/p&amp;gt";&lt;br /&gt;  endif;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;In this case where it's just one line of HTML to be output, that's not a bad way to do it.  But when sending long stretches of HTML I think the format where you jump back and forth between PHP and HTML is the way to do.  You end up with a file that looks more like HTML code with PHP sprinkled in, rather than an onslaught of PHP echo statements.  That might be hard to visualize with just a small example like this, but if you code up an entire page you'll see what I mean.&lt;br /&gt;&lt;br /&gt;The idea of echo'ing all output from a PHP program would be similar to writing a C program where you printf all the HTML.  Come to think of it, you could actually write all this pure C.  You could have an Apache module that links in your C code as a shared library.  It would handle the TCP connection from the browser, doing printf's to send the HTML and other content to the browser.  In other words, you'd be generating the HTML from your C program entirely.  All the things that we are doing with PHP, you could do it with C instead in which case you would not need to switch between PHP and HTML.  However, it'd be more complex.  Say you needed to make a change, with PHP you just edit the file and you are done; with C, you have the extra step of compiling which will slow you down.  Then you have to restart the web server process.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7493704057514644905?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7493704057514644905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/programming-with-php-in-local.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7493704057514644905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7493704057514644905'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/programming-with-php-in-local.html' title='Programming with PHP in a Local Environment'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4796422874333063781</id><published>2011-02-08T19:03:00.000-08:00</published><updated>2011-02-22T10:10:53.571-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='localhost'/><category scheme='http://www.blogger.com/atom/ns#' term='IDE'/><category scheme='http://www.blogger.com/atom/ns#' term='server side'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><category scheme='http://www.blogger.com/atom/ns#' term='Notepad++'/><category scheme='http://www.blogger.com/atom/ns#' term='XAMPP'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache Server on Local Environment'/><category scheme='http://www.blogger.com/atom/ns#' term='Friends of Apache'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache'/><title type='text'>Setting Up a Local Development Environment with XAMPP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#cssbirthday2jpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'green'});});&lt;/script&gt;&lt;img id='cssbirthday2jpg' style='display:none;' src='http://pics.cssbakery.com/pics/cssbirthday2.jpg' alt='I started this blog two years ago&amp;lt;br&amp;gt;Happy Birthday to us!&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;If you are going to install PHP, Apache, phpMyAdmin, and MySQL on your local computer, you can download and configure each one separately but it's a little time consuming and can be painful to get them all set up and working correctly.  This is probably more true for Windows than Linux because in Linux you can easily install things with a package manager.  But then again different distributions of Linux tend to have little variations in how they do things - including different package managers - which can add some confusion.  &lt;br /&gt;&lt;br /&gt;Fortunately, Friends of Apache have done all the legwork and created one package that installs and configures these on your local machine.  If you read the introduction by XAMPP, they write, "&lt;i&gt;Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl&lt;/i&gt;".  For the remainder of this post I'll be talking about installing on Windows since I think that's where XAMPP adds the most value.  &lt;br /&gt;&lt;br /&gt;You can download the current Windows version of XAMPP 1.7.4 from &lt;a href="http://www.apachefriends.org/en/xampp-windows.html"&gt;here&lt;/a&gt;.  You'll get:&lt;br /&gt;&lt;ul class="starlist"&gt;&lt;li&gt;Apache 2.2.17&lt;/li&gt;&lt;li&gt;MySQL 5.5.8&lt;/li&gt;&lt;li&gt;PHP 5.3.5&lt;/li&gt;&lt;li&gt;phpMyAdmin 3.3.9&lt;/li&gt;&lt;li&gt;FileZilla FTP Server 0.9.37&lt;/li&gt;&lt;li&gt;Tomcat 7.0.3 (with mod_proxy_ajp as connector)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h1&gt;STARTING XAMPP&lt;/h1&gt;&lt;br /&gt;Via the Windows start menu, start XAMPP.  If it's not in your start menu, then from Windows Explorer navigate to the Install directory and find XAMPP-control.exe and drag a shortcut to your desktop or Start Menu. Ok, that should get you covered.  Here's what the control panel looks like:&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/xamppintro.jpg" alt="xampp" title="xampp" /&gt;&lt;br /&gt;I do not click on the Service checkboxes because I do not want to start Apache and MySql everytime I start my machine.  I'd rather do it manually, when I need it.   To start Apache and MySql, click the Start buttons next to them.  In a new tab in your browser, type in localhost.  If Apache started successfully, you will get the XAMPP main page.  &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;SECURITY SETTINGS&lt;/h1&gt;&lt;br /&gt;Since you are now running both web server and MySQL processes on your computer, you should setup some security so that someone from the Internet doesn't connect into these servers when you really only need them for your local use.  On the XAMPP control panel click on Security.  You'll get a page like &lt;a href="http://pics.cssbakery.com/pics/xampp_security.jpg"&gt;this one&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now click the link further down that page for fixing the security settings and follow the directions.  It'll have you specify a MySQL root password and a username/password for your local XAMPP pages as well.  Don't forget the passwords that you use, as you will need them later.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;WHERE TO PUT YOUR CODE&lt;/h1&gt;&lt;br /&gt;Now you are ready to start coding but you want to put your code in a place where Apache can find it.  This directory happens to be "c:\xampp\htdocs\" (your path may vary, depending on where you installed XAMPP).  I always create a subdirectory under that called "\EclipseWorkspace\".  You can call it anything you want such as "\myprojectX\".&lt;br /&gt;&lt;br /&gt;To edit your code, you need a programmer's text editor or an IDE, an integrated development environment.  You can use the Eclipse IDE which has become an industry standard, but you can also use Notepad++ which is written in C++. I don't know what happened to Brief, I once saw it in an unrecognizable form on a Borland product. I think they made their money and are now sipping margaritas down in the Caribbean.  For this post, I'm going to use Notepad++.  You can download it from &lt;a href="http://notepad-plus-plus.org/download"&gt;here&lt;/a&gt;.  One advantage of Notepad++ is that it comes up fast compared to Eclipse.  And unlike Eclipse, it does not drive you crazy when you want to reset its colors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4796422874333063781?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4796422874333063781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/developing-with-php-phpmyadmin-apache.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4796422874333063781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4796422874333063781'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/developing-with-php-phpmyadmin-apache.html' title='Setting Up a Local Development Environment with XAMPP'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1759306977826357379</id><published>2011-02-05T19:23:00.000-08:00</published><updated>2011-02-06T11:24:17.324-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Art'/><title type='text'>Canvas Frame for a Painting</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#finalcanvasjpg').cssBakeryCaption({'opacity':'0.7','center':true,'centerCaption':true,'round':true, 'top':true,'hide':false,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img src="http://pics.cssbakery.com/pics/myframe2.jpg" alt="" title="" /&gt;&lt;br /&gt;No software today.  Been busy making a frame for a large painting.  After two Home Depot trips, a lot of &lt;a href="http://pics.cssbakery.com/pics/myframe.jpg"&gt;measuring&lt;/a&gt;, &lt;a href="http://pics.cssbakery.com/pics/mitrebox.jpg"&gt;cutting&lt;/a&gt;, and &lt;a href="http://pics.cssbakery.com/pics/framenails.jpg"&gt;nailing&lt;/a&gt; later, it's finished.  The steps in pictures:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/framecorner.jpg" alt="" title="" /&gt;&lt;br /&gt;The corners are cut at 45 degree angles.  The reason the edges are beveled is for  keeping the wide part of the frame from hitting the surface.  You get the beveled effect by placing a narrower, curved piece over the rectangular wood - all cut at the hardware store.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/canvasinplace.jpg" alt="" title="" /&gt;&lt;br /&gt;After this picture, I tucked the fabric in for a clean finish.  &lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;img id='finalcanvasjpg' style='display:none;' src='http://pics.cssbakery.com/pics/finalcanvas.jpg' alt='Finished Canvas&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1759306977826357379?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1759306977826357379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/canvas-frame-for-painting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1759306977826357379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1759306977826357379'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/canvas-frame-for-painting.html' title='Canvas Frame for a Painting'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2181860393114733365</id><published>2011-02-02T08:10:00.000-08:00</published><updated>2011-02-02T08:25:19.008-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bing'/><category scheme='http://www.blogger.com/atom/ns#' term='Search Engine'/><category scheme='http://www.blogger.com/atom/ns#' term='Google'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Recycled Search Results: Bing Copying Google Search Data</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#bingjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='bingjpg' style='display:none;' src='http://pics.cssbakery.com/pics/bing.jpg' alt='Bing UI&amp;lt;br&amp;gt;[search engine]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;When Google slammed Microsoft for copying their search results,  Microsoft took it as a compliment.  Here's the &lt;a href="http://www.cnn.com/2011/TECH/web/02/02/google.bing.sting/index.html?iref=NS1"&gt;story&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2181860393114733365?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2181860393114733365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/recycled-search-results-bing-copying.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2181860393114733365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2181860393114733365'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/recycled-search-results-bing-copying.html' title='Recycled Search Results: Bing Copying Google Search Data'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5676701877679319512</id><published>2011-02-02T01:24:00.000-08:00</published><updated>2011-04-24T14:06:39.960-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Driver'/><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='WIFI'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking Driver'/><category scheme='http://www.blogger.com/atom/ns#' term='API'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Developing a Windows Networking Driver to Keep a Computer from Connecting  to Different WiFi Networks</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#sunsetjpg').cssBakeryCaption({'opacity':'0.5','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'#83756a'});});&lt;/script&gt;&lt;img id='sunsetjpg' style='display:none;' src='http://pics.cssbakery.com/pics/sunset.jpg' alt='Sunset&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;When you connect to your wireless LAN (this is a standard term for local area network), you'll see a long list of nearby networks.   Occasionally your computer on its own might actually connect to a network other than yours.  There is always an unsecured network available in the air wherever you go, making a random connection possible.  &lt;br /&gt;&lt;br /&gt;It'll be good to just block out all but your own network from even showing up in the list of wireless networks, or at least making sure that you are only connecting to your own network.  With a few exceptions, people don't really need to see all the networks around them, and definitely don't want to connect to them - just your own.  So, I'm looking into writing some Windows code that will do this - possibly a networking driver.   I downloaded the Windows Device Driver Kit (DDK) and started looking through the documentation.&lt;br /&gt;&lt;br /&gt;Before long I came across this:&lt;br /&gt;&lt;blockquote&gt;The msDot11DesiredSSIDList MIB object specifies the list of 802.11 service set identifiers (SSIDs) that the 802.11 station uses when connecting to a basic service set (BSS) network. After OID_DOT11_CONNECT_REQUEST is set, the 802.11 station will attempt to connect to a BSS with an service set identifier (SSID) that matches an entry from this list.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;That sounds like if we could set the msDot11DesiredSSIDList with only your own network name, then the networking drivers would only connect to your network.  Now just need to see how that could be set.  Looking further I also found a regular Windows API that might be able to control WiFi connections.  Here's what the Microsoft documentation says:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;The Wireless LAN Win32 API enables developers to build applications that manage wireless adapters, wireless connections, and wireless profiles. The APIs consist of the following functionalities:&lt;br /&gt;&lt;br /&gt;Operational API: Applications can request the adapter to scan, connect/disconnect to/from a wireless network and query attributes of the current connection. (etc...)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;So those are two possible leads I've found so far.  On the 2nd one - the Wireless LAN API - it turns out there is a Microsoft SDK sample program (called "wlsample") that shows you how to retrieve the name of the current WiFi network you are connected to, as well as how to disconnect from the current network.  With some additional logic this could monitor which network you are connected to and promptly disconnect you if you happen to connect to the wrong one.  It could then attempt to re-connect to your approved network. This could be run as a Windows Service that starts up and runs in the background.&lt;br /&gt;&lt;br /&gt;Update: Now I've got the program working that detects if I'm on the wrong network, but I need to turn it into a Windows service that starts automatically when Windows boots, and keeps running.  Looks like there are multiple paths to developing a service.  Here are my leading candidates:&lt;br /&gt;&lt;ul class="starlist"&gt;&lt;li&gt;From a pure C example in the SDK that uses Win32 APIs directly&lt;/li&gt;&lt;li&gt;From a C++ example based on the CAtlServiceModule&lt;/li&gt;&lt;li&gt;From a C# example generated from a Visual Studio "Windows Service" project template.&lt;/li&gt;&lt;/ul&gt;The code for the C# example is the simplest, and the C example is probably the most complex, with the C++ example somewhere in between.  The code I've written so far is in C and would need some work to convert to C#.  So I'm debating which one to go with.  I may start with the C example and see how it goes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5676701877679319512?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5676701877679319512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/02/writing-windows-networking-driver-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5676701877679319512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5676701877679319512'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/02/writing-windows-networking-driver-to.html' title='Developing a Windows Networking Driver to Keep a Computer from Connecting  to Different WiFi Networks'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1950507606757942307</id><published>2011-01-31T20:42:00.000-08:00</published><updated>2011-01-31T20:42:02.882-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='RSS Feed'/><title type='text'>Programming a Custom Blog Search</title><content type='html'>&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/mytulip.jpg" alt="Programming a Custom Blog Search" title="Programming a Custom Blog Search" /&gt;&lt;h4&gt;Programming a Custom Blog Search&lt;/h4&gt;&lt;ul class="icons"&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/01/another-interface-to-my-custom-blog.html"&gt;Another Interface to Custom Blog Search&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/01/php-parsing-searching-rss-feed-and-cron.html"&gt;PHP Parsing, Searching an RSS Feed&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/01/javascript-for-my-custom-search.html"&gt;Javascript for My Custom Search&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/01/working-on-search.html"&gt;Improving Search with Regular Expressions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/12/parsing-rss-feeds-with-php_24.html"&gt;Parsing RSS Feeds with PHP&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1950507606757942307?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1950507606757942307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/programming-custom-blog-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1950507606757942307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1950507606757942307'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/programming-custom-blog-search.html' title='Programming a Custom Blog Search'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7656512431741336908</id><published>2011-01-13T19:10:00.001-08:00</published><updated>2011-01-13T21:09:08.229-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Stephen Hawking'/><category scheme='http://www.blogger.com/atom/ns#' term='Caltech'/><title type='text'>Stephen Hawking Talk at Caltech</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#feynmanjpg').cssBakeryCaption({'opacity':'1','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'#ff8f2b'});});&lt;/script&gt;&lt;img id='feynmanjpg' style='display:none;' src='http://pics.cssbakery.com/pics/feynman.jpg' alt='[Caltech]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;This coming Tuesday on January 18, &lt;a href="http://www.hawking.org.uk/"&gt;Stephen Hawking&lt;/a&gt; will speak at &lt;a href="http://events.caltech.edu/events/event-8081.html"&gt;Caltech&lt;/a&gt; in Pasadena.  It's free for the public with the talk targeted to a general audience. So if you are in the Los Angeles area, it'll be a great way to spend your evening.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7656512431741336908?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7656512431741336908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/stephen-hawking-talk-at-caltech.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7656512431741336908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7656512431741336908'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/stephen-hawking-talk-at-caltech.html' title='Stephen Hawking Talk at Caltech'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4391567788760352900</id><published>2011-01-11T05:35:00.000-08:00</published><updated>2012-01-21T09:59:36.096-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Code Igniter'/><title type='text'>Another Interface to My Custom Blog Search</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#goingbackjpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'blue'});});&lt;/script&gt;&lt;img id='goingbackjpg' style='display:none;' src='http://pics.cssbakery.com/pics/goingback.jpg' alt='Returning Home&amp;lt;br&amp;gt;[sunday]&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;4:45 am.  January 11, 2010.  No, it's 2011.  I'm not used to the new year change yet.  Fell asleep at 8 pm last night so I am up early writing this post before the day starts.&lt;br /&gt;&lt;br /&gt;I've written several posts about creating my own Blog search tool.  Up until now I was only using it to bring up results for my various category links in the right sidebar.  But now I want to also use it for the "site search" form, so you can type in a phrase to search for.  Site search is the small blue form at the upper right corner.  I'm going to leave the web search form alone.&lt;br /&gt;&lt;br /&gt;I've already got the search mechanism, so this just take a bit of Javascript to handle the form submit event and run the custom search.  Here's the code:&lt;br /&gt;&lt;br /&gt;&lt;pre class="MiamiVice"&gt;$('#searchthis').submit(function() {&lt;br /&gt;     var q = $('#searchthis .sbox').attr('value');&lt;br /&gt;        var href='http://tools.cssbakery.com/search/?q='+q+'&amp;title=Search Results:&amp;callback=?';&lt;br /&gt;        $.getJSON(href, process);&lt;br /&gt;        return false;&lt;br /&gt;    });&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The first line sets up a function to be called when the form is submitted.  The function that gets called first grabs the value from the search input field, then builds a URL to run the search tool.  It performs an Ajax call via getJSON() and invokes the 'process' function when the results come back.  I already had the process function from the existing implementation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4391567788760352900?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4391567788760352900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/another-interface-to-my-custom-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4391567788760352900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4391567788760352900'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/another-interface-to-my-custom-blog.html' title='Another Interface to My Custom Blog Search'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-719236809950711570</id><published>2011-01-08T21:15:00.000-08:00</published><updated>2011-01-21T07:43:01.969-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Cron Job'/><category scheme='http://www.blogger.com/atom/ns#' term='RSS Feed'/><category scheme='http://www.blogger.com/atom/ns#' term='Searching RSS Feed'/><category scheme='http://www.blogger.com/atom/ns#' term='Code Igniter'/><category scheme='http://www.blogger.com/atom/ns#' term='Parsing RSS Feed'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>PHP Parsing, Searching an RSS Feed and a Cron Job</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#myshoalmarkerjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='myshoalmarkerjpg' style='display:none;' src='http://pics.cssbakery.com/pics/myshoalmarker2.jpg' alt='Shoal Marker&amp;lt;br&amp;gt;[shoals are underwater hills]&amp;lt;br&amp;gt;© Copyright 2011 www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Kayaked for over an hour.   Going out at 9:30 am would've been impossible in the summer.  These days, it's so chilly out over the water that the sun is a non-issue.   I went all the way to the shoal marker at the entrance where I had the &lt;a href="http://www.cssbakery.com/2010/08/cssjquery-image-captioning-with.html"&gt;summer encounter&lt;/a&gt; with the shark.&lt;br /&gt;&lt;br /&gt;My custom search tool has two major parts:  a &lt;a href="http://www.cssbakery.com/2011/01/javascript-for-my-custom-search.html"&gt;Javascript client component&lt;/a&gt;, and a PHP server component.  This post describes the PHP server code.  This is built on the CodeIgniter framework, so it has three parts: a Model, a View, and a Controller.&lt;br /&gt;&lt;br /&gt;The Controller's job is to receive the request from the Browser, then call the Model and View as needed.  The code for the controller is listed below.  It has a constructor function Search(), which just loads some CodeIgniter helper libraries, then loads in our Model, called rssfeed_model.  &lt;br /&gt;&lt;br /&gt;The second function in the controller, index() handles the GET request from the Browser.  It first calls the model to load in the RSS feed (described more below), then it reads in some URL parameters, q, title, and callback.  The q parameter contains the search string, the title holds the title we want to display for the search, and callback tells us whether or not this is a JSONP GET request.&lt;br /&gt;&lt;br /&gt;Once the parameters are read, the search is performed by calling the model's search() method.  The returned results are then sorted so that the ones with the most relevance will appear first in the displayed results.  Finally, we call the view to actually send the results.  We call either the "search_view" or the "search_json_view", depending upon whether or not the "callback" parameter was set to anything in the URL.&lt;br /&gt;&lt;br /&gt;&lt;pre class='MiamiVice'&gt;class Search extends Controller {&lt;br /&gt;  function Search() {&lt;br /&gt;    parent::Controller();    &lt;br /&gt;    $this-&amp;gt;load-&amp;gt;helper('form');  &lt;br /&gt;    $this-&amp;gt;load-&amp;gt;helper('url');&lt;br /&gt;    $this-&amp;gt;load-&amp;gt;helper('html');   &lt;br /&gt;    $this-&amp;gt;load-&amp;gt;model('rssfeed_model');&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  function index() {&lt;br /&gt;    $this-&amp;gt;rssfeed_model-&amp;gt;loadfeed('blogsearch/cssbakery.rss');&lt;br /&gt;    $q = $this-&amp;gt;input-&amp;gt;get("q");&lt;br /&gt;    $this-&amp;gt;data['q'] = $q;    &lt;br /&gt;    $this-&amp;gt;data['title'] = $this-&amp;gt;input-&amp;gt;get("title");&lt;br /&gt;    $callback = $this-&amp;gt;input-&amp;gt;get("callback");&lt;br /&gt;    $this-&amp;gt;data['callback'] = $callback;&lt;br /&gt;    // Perform the search&lt;br /&gt;    $this-&amp;gt;data['results'] = $this-&amp;gt;rssfeed_model-&amp;gt;search($q,!empty($debug));&lt;br /&gt;    usort($this-&amp;gt;data['results'],"cmp");&lt;br /&gt;    if (empty($callback)) {   &lt;br /&gt;      $this-&amp;gt;load-&amp;gt;view("search_view",$this-&amp;gt;data);&lt;br /&gt;    } else {&lt;br /&gt;      $this-&amp;gt;load-&amp;gt;view("search_json_view",$this-&amp;gt;data);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}    &lt;/pre&gt;&lt;br /&gt;Next we look at the rssfeed_model.  It has two methods:  loadfeed() and search().  Loadfeed() is pretty simple, it just calls PHP's simplexml_load_file to load in the RSS feed data.  RSS is an XML-based format so this results in loading the entire Blog content into a data structure.  The search() function searches through that data structure looking for matches with the search phrase.  &lt;br /&gt;&lt;br /&gt;The search function uses XML Xpath searches to parse things out of the RSS XML.  One slightly tricky part of this is that each call to PHP's xpath() search function must be preceded by a call to registerXPathNamespace().  This is because the RSS feed specifies a namespace, and Xpath won't parse it unless you specify that namespace.  The search uses regular expressions to match search terms against the blog content. This was discussed in a &lt;a href="http://www.cssbakery.com/2011/01/working-on-search.html"&gt;previous post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre class='MiamiVice'&gt;class rssfeed_model extends Model {&lt;br /&gt;  private $xml;&lt;br /&gt;  &lt;br /&gt;  function rssfeed_model() {&lt;br /&gt;    parent::Model();&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  function loadfeed($url='http://www.cssbakery.com/feeds/posts/default?max-results=10') {&lt;br /&gt;    $this-&amp;gt;xml = simplexml_load_file($url);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  function search($q,$debug=false) {&lt;br /&gt;    if (empty($q)) { &lt;br /&gt;      return array(); &lt;br /&gt;    }&lt;br /&gt;    $q = trim(strtolower($q));&lt;br /&gt;    $fc=substr($q,0,1);&lt;br /&gt;    $lc=substr($q,-1,1);&lt;br /&gt;    if ((($fc=="'") || ($fc=='"')) &amp;&amp; (($lc=="'") || ($lc=='"'))) {&lt;br /&gt;      $qarray = array(substr($q,1,-1));&lt;br /&gt;    } else {&lt;br /&gt;      $qarray = explode(" ",$q);&lt;br /&gt;    }&lt;br /&gt;    $r = array();&lt;br /&gt;    $this-&amp;gt;xml-&amp;gt;registerXPathNamespace('atm', 'http://www.w3.org/2005/Atom');&lt;br /&gt;    $posts = $this-&amp;gt;xml-&amp;gt;xpath('//atm:entry');&lt;br /&gt;    foreach ($posts as $k=&amp;gt;$post) {&lt;br /&gt;      $count = 0;&lt;br /&gt;      foreach ($qarray as $q) {&lt;br /&gt;        $termcount = 0;&lt;br /&gt;        if (empty($q)) continue; &lt;br /&gt;        $content = strip_html_tags(strtolower($post-&amp;gt;content));&lt;br /&gt;        $title = strip_tags(strtolower($post-&amp;gt;title));&lt;br /&gt;        $termcount += 1000*preg_match_all('/([^a-z]|^)'.$q.'([^a-z]|$|(s[^a-z]))/',$title,$matches);&lt;br /&gt;        $termcount += preg_match_all('/([^a-z]|^)'.$q.'([^a-z]|$|(s[^a-z]))/',$content,$matches);&lt;br /&gt;        $post-&amp;gt;registerXPathNamespace('atm', 'http://www.w3.org/2005/Atom');&lt;br /&gt;        $categories = $post-&amp;gt;xpath('atm:category');&lt;br /&gt;        foreach ($categories as $category) {&lt;br /&gt;          $tag = strtolower($category['term']);&lt;br /&gt;          $termcount += 1000*preg_match_all('/([^a-z]|^)'.$q.'([^a-z]|$|(s[^a-z]))/',$tag,$matches);&lt;br /&gt;        }&lt;br /&gt;        $post-&amp;gt;registerXPathNamespace('atm', 'http://www.w3.org/2005/Atom');&lt;br /&gt;        $links = $post-&amp;gt;xpath('atm:link[@rel="alternate"]');&lt;br /&gt;        foreach ($links as $link) {&lt;br /&gt;          $href = $link['href'];&lt;br /&gt;        }&lt;br /&gt;        $count += $termcount;&lt;br /&gt;        if ($debug &amp;&amp; ($termcount&amp;gt;0)) {&lt;br /&gt;          echo "Term: $q scored $termcount for post: '".(string)$post-&amp;gt;title."'&amp;lt;br&amp;gt;\n";&lt;br /&gt;        }&lt;br /&gt;      } &lt;br /&gt;      if ($count &amp;gt; 0) {&lt;br /&gt;        $r[] = array("title"=&amp;gt;(string)$post-&amp;gt;title,"link"=&amp;gt;$href,"count"=&amp;gt;$count);&lt;br /&gt;      }        &lt;br /&gt;    } &lt;br /&gt;    return $r; &lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Now we turn to the View.  The search_json_view builds a JSON structured string, placing it all in the $r variable, and echo'ing it out to the Browser at the end.&lt;br /&gt;&lt;pre class='MiamiVice'&gt;&amp;lt;?php&lt;br /&gt;$r = $callback.'(';&lt;br /&gt;  $r .= '{ "q": "'.str_replace('"',"'",$q).'",';&lt;br /&gt;  $r .= '"title":"'.$title.'",';&lt;br /&gt;  $r .= '"result": [';&lt;br /&gt;  foreach ($results as $result) {&lt;br /&gt;    $r .= '{ "count":"'.$result['count'].'", "title":"'.&lt;br /&gt;          str_replace('"','',$result['title']).'", "link":"'.$result['link'].'" },'."\n";&lt;br /&gt;  }&lt;br /&gt;  $r .= ']}';&lt;br /&gt;$r .= ')';&lt;br /&gt;echo $r;&lt;br /&gt;?&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;CRON JOB&lt;/h1&gt;&lt;br /&gt;One thing you might have noticed is that the search currently loads in the RSS data from a local file on the server.  I didn't want every single search to re-download the whole RSS feed, so I just store the feed in that local file.  But that raises the question of how to keep the results up to date.  I do that with a &lt;a href="http://www.cssbakery.com/2010/09/web-server-basics-lamp-stack.html"&gt;cron job&lt;/a&gt; that runs every hour on the server.  Here's how I set that up.&lt;br /&gt;&lt;br /&gt;First, I created a file containing a command that downloads the RSS feed and puts it in a file.  I called the file searchCron:&lt;br /&gt;&lt;br /&gt;&lt;pre class='MiamiVice'&gt;File searchCron:&lt;br /&gt;curl http://www.cssbakery.com/feeds/posts/default?max-results=9999 &amp;gt; blogsearch/cssbakery.rss&lt;br /&gt;&lt;/pre&gt;This uses the popular "curl" command to retrieve the URL.&lt;br /&gt;&lt;br /&gt;Next, I need to schedule this command to run every hour.  So I create another file, which I called mycron, to tell the cron scheduler how to run it:&lt;br /&gt;&lt;pre class="MiamiVice"&gt;File mycron:&lt;br /&gt;    20 * * * * searchCron&lt;/pre&gt;&lt;br /&gt;The first five fields specify when to run the command.  In my case I have it run at 20 minutes after the hour, every hour, every day, every month, every year.  If I wanted to just run it once a day, say at 10:30am every morning, I'd change this file as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre class="MiamiVice"&gt;30 10 * * * searchCron&lt;/pre&gt;Now to actually schedule the job, I run the crontab command on the server:&lt;br /&gt;&lt;pre class="MiamiVice"&gt;crontab mycron&lt;/pre&gt;And that should get the cron job scheduled... However, I did run into a problem.  For some reason my cron job wasn't working.  If you run the command "crontab -l" it will list all your cron jobs.  It showed that mine was scheduled just fine, but still the RSS feed file wasn't being updated at all!&lt;br /&gt;&lt;br /&gt;My next step was to look in the system log:&lt;br /&gt;&lt;pre class="MiamiVice"&gt;tail /var/www/syslog&lt;/pre&gt;In there I saw this entry:&lt;br /&gt;&lt;pre class="MiamiVice"&gt;Jan  8 17:20:01 /USR/SBIN/CRON[12525]: (web) CMD (searchCron^M)&lt;br /&gt;&lt;/pre&gt;The thing that got my attention was the "^M" at the end of the command.  As it turned out I had edited the "mycron" file on Windows and uploaded it.  That left the Windows carriage return-line feed sequence in the file, and that extra character - from the Linux point of view - was causing the failure.  So, I re-created the file on Linux (using vi) and that solved the problem.  The cron job now runs every hour.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-719236809950711570?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/719236809950711570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/php-parsing-searching-rss-feed-and-cron.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/719236809950711570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/719236809950711570'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/php-parsing-searching-rss-feed-and-cron.html' title='PHP Parsing, Searching an RSS Feed and a Cron Job'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2595546119951102829</id><published>2011-01-03T23:38:00.000-08:00</published><updated>2011-01-04T08:23:54.100-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Ordered Lists'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Javascript for My Custom Search</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#myjibjpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='myjibjpg' style='display:none;' src='http://pics.cssbakery.com/pics/beowolf.jpg' alt='[Beowolf]&amp;lt;br&amp;gt;my good luck charm ;-)&amp;lt;br&amp;gt;© 2011 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;I'm using my new custom search tool to drive the category links in my right sidebar.  I have some Javascript that captures the mouse click, does an Ajax call to my search engine, and displays the results.  Here's the code:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;function process(d) {&lt;br /&gt; var r=d.result;&lt;br /&gt; var arLen=r.length;&lt;br /&gt; var high = r[0].count;&lt;br /&gt; h="&amp;lt;div class='searchresults'&amp;gt;";&lt;br /&gt; h+="&amp;lt;h3 class='post-title entry-title'&amp;gt;"+d.title+"&amp;lt;/h3&amp;gt;";&lt;br /&gt; h+="&amp;lt;ol&amp;gt;";&lt;br /&gt; for ( var i=0, len=arLen; i&amp;lt;len; ++i ){&lt;br /&gt;   if ((high&amp;gt;=1000) &amp;&amp; (r[i].count&amp;lt;1000)) {&lt;br /&gt;    h+="&amp;lt;div class='divider'&amp;gt;&amp;lt;/div&amp;gt;"&lt;br /&gt;    high=0;&lt;br /&gt;   }&lt;br /&gt;   h+="&amp;lt;li&amp;gt;&amp;lt;a href='"+r[i].link+"'&amp;gt;"+r[i].title+"&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;";&lt;br /&gt; }&lt;br /&gt; h+="&amp;lt;/ol&amp;gt;&amp;lt;/div&amp;gt;";&lt;br /&gt; $("#main-wrapper").html(h);&lt;br /&gt; Cufon.replace('.searchresults h3');&lt;br /&gt; window.scrollTo(0,0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$(document).ready(function() {&lt;br /&gt;    $('.categories_div ul li a').click(function() { &lt;br /&gt;        var href='http://tools.cssbakery.com/search?showform=1&amp;&lt;br /&gt;        '+$(this).attr('href').replace(/^(.)*\?/,'')+"&amp;title="+$(this).attr('title');&lt;br /&gt;        href = href.replace(/site%3Acssbakery.com/,'');&lt;br /&gt;        href = href.replace('+','');&lt;br /&gt;        href = href.replace('[','');&lt;br /&gt;        href = href.replace(']','');&lt;br /&gt;        href = href.replace(/"/g,"'");&lt;br /&gt;        href = href+'&amp;callback=?'&lt;br /&gt;        $.getJSON(href, process);&lt;br /&gt;        return false; &lt;br /&gt;    });&lt;br /&gt;})  &lt;/pre&gt;&lt;br /&gt;Here's the breakdown on how this works:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;$(document).ready(function() {&lt;br /&gt;    $('.categories_div ul li a').click(function() { &lt;br /&gt;        var href='http://tools.cssbakery.com/search?showform=1&amp;&lt;br /&gt;'+$(this).attr('href').replace(/^(.)*\?/,'')+"&amp;title="+$(this).attr('title');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This uses jQuery.  The first line registers a callback function with jQuery to be executed when the page is loaded.  The function itself then registers a click handler using the selector .categories_div ul li a.  That selector targets all my category links.&lt;br /&gt;&lt;br /&gt;When a click actually occurs, I construct a URL for the search and store it in the href variable.  This is built by pulling out part of the link's href, as well as the link's title attribute and building the URL string from those components.  Next we delete any undesirable characters from the URL:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;href = href.replace(/site%3Acssbakery.com/,'');&lt;br /&gt;        href = href.replace('+','');&lt;br /&gt;        href = href.replace('[','');&lt;br /&gt;        href = href.replace(']','');&lt;br /&gt;        href = href.replace(/"/g,"'");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I see that I probably could have reduced the code by using a regular expression in the replace, like this: href.replace(/[\[\]\+"]/g,'') instead of doing all the individual replace calls.&lt;br /&gt;&lt;br /&gt;Now we make the Ajax call to the server:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;href = href+'&amp;callback=?'&lt;br /&gt;        $.getJSON(href, process);&lt;br /&gt;        return false; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This call goes to a different domain (tools.cssbakery.com) so I use a JSONP call (which is done by adding the callback=? string to the URL).  When the Ajax call returns, it will call the function 'process'.  Finally we return false to keep the user's mouse click from triggering the default action, which would be to follow the link (we don't want the Browser to follow the clicked link since we are already handling the click in our Javascript).&lt;br /&gt;&lt;br /&gt;Next we look at the 'process' function that handles the search results.  First we just grab some information from the results.  The array of results is stored in local variable r.  We get the length of that array and store it in arLen.  We then pull out the highest score from the results and put it in local variable high:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;function process(d) {&lt;br /&gt; var r=d.result;&lt;br /&gt; var arLen=r.length;&lt;br /&gt; var high = r[0].count;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we start constructing a HTML fragment and putting it into local variable h.  We put in the searchresults div, an h3 for the title, then begin an ordered list:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;h="&amp;lt;div class='searchresults'&amp;gt;";&lt;br /&gt; h+="&amp;lt;h3 class='post-title entry-title'&amp;gt;"+d.title+"&amp;lt;/h3&amp;gt;";&lt;br /&gt; h+="&amp;lt;ol&amp;gt;";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we loop over all the results and append list item and link markup to the h variable for each individual result.  Also when we see that the scores drop below 1000 we output the divider div:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;for ( var i=0, len=arLen; i&amp;lt;len; ++i ){&lt;br /&gt;   if ((high&amp;gt;=1000) &amp;&amp; (r[i].count&amp;lt;1000)) {&lt;br /&gt;    h+="&amp;lt;div class='divider'&amp;gt;&amp;lt;/div&amp;gt;"&lt;br /&gt;    high=0;&lt;br /&gt;   }&lt;br /&gt;   h+="&amp;lt;li&amp;gt;&amp;lt;a href='"+r[i].link+"'&amp;gt;"+r[i].title+"&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;";&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we just finish off the ordered list, insert the html fragment into the main wrapper of the page, then call Cufon to make sure the h3 title is rendered correctly, and as a final touch we scroll the Browser window to the very top so the results can be seen.&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;h+="&amp;lt;/ol&amp;gt;&amp;lt;/div&amp;gt;";&lt;br /&gt; $("#main-wrapper").html(h);&lt;br /&gt; Cufon.replace('.searchresults h3');&lt;br /&gt; window.scrollTo(0,0);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And that's it for the Javascript component of the search tool.  In another post I'll go into more detail on the PHP that handles the Ajax call on the server side.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2595546119951102829?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2595546119951102829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/javascript-for-my-custom-search.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2595546119951102829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2595546119951102829'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/javascript-for-my-custom-search.html' title='Javascript for My Custom Search'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5382011305306859711</id><published>2011-01-02T23:59:00.000-08:00</published><updated>2011-01-03T11:40:46.402-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Regular Expression'/><category scheme='http://www.blogger.com/atom/ns#' term='Styling a Page'/><title type='text'>Improving Search with Regular Expressions</title><content type='html'>This weekend my focus was on improving the search function and making it work smoothly with the existing categories.  I want to add new sections to the categories sidebar later. The footer's slowly coming together.  I put in a new background which has a gradient on top of it.  If you see banding, let me know.   &lt;br /&gt;&lt;br /&gt;Originally I was using Blogger search and sometime later I switched to Google Blog search for my categories sidebar links.  I wasn't happy with either one.  Their searches were not robust and I didn't have much control over how the results were presented.  The purpose of this post is to show you how you can write your own search and stop relying on Google or Blogger.  Here's what my category search markup used to look like:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;li class='categories'&amp;gt;&lt;br /&gt;&amp;lt;a href='http://cssbakery.blogspot.com/search/label/Modifying%20Blogger'&lt;br /&gt;target='_blank'&amp;gt;&amp;lt;div id='cat1'/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;a href='http://cssbakery.blogspot.com/search/label/Modifying%20Blogger'&lt;br /&gt;target='_blank'&amp;gt;Modifying Blogger with CSS/HTML&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/li&amp;gt;&lt;br /&gt;&lt;/pre&gt;Note that the %20 you see in the URLs just means a space character. So in my Blogger template I actually typed "Modifying Blogger", and when I save it, Blogger converts it to "Modifying%20Blogger".  Anyway, here's what the same category links look like now with the new category search tool:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;a href='http://blogsearch.google.com/blogsearch?q=site%3Acssbakery.com+Blogger' &amp;gt;&lt;br /&gt;Modifying Blogger with CSS/HTML&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I have some Javascript that pulls out the "q=" part of the URL and uses it for my own custom search tool (so I actually ignore the blogsearch.google.com part of this URL.  I still have it point to google as a backup just in case my Javascript file hasn't loaded or the user has Javascript disabled).&lt;br /&gt;&lt;br /&gt;At first my search algorithm was just looking for substring matches using the PHP substr_count($haystack,$needle) function.  That function returns the number of occurrences of $needle in $haystack.  The problem with that was that when I searched for strings like "id", it would match parts of whole words like "Holidays".  I didn't want that, so instead of using substr_count(), I switched to using function preg_match_all($regex,$haystack,$matches).&lt;br /&gt;&lt;br /&gt;With preg_match_all(), you pass in a regular expression, and it returns the number of matches found in $haystack (it also returns a set of matches via the 3rd parameter, but for my purposes I'm only interested in the number of matches).  So the most difficult part of this is coming up with a good regular expression.&lt;br /&gt;&lt;br /&gt;Regular expressions are used for pattern matching.  They consist of strings written in a special syntax that specifies what to match.  The regular expression is interpreted by a processing engine that uses it to determine a set of matches within a body of text.  PHP's regular expression engine uses a syntax that is common among Unix/Linux based languages and tools.  Certain characters have special meaning. The caret symbol (^) matches the beginning of a line of text.  The dollar sign ($) matches end of line.  So for example, the pattern ^abc$ would match a complete line that consisted of only the letters abc.  Regular expressions can get very complex, but are very powerful.  You can read more about PHP's regular expressions &lt;a href="http://www.php.net/manual/en/book.pcre.php"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We want to match occurrences where the search term is surrounded by spaces, as in: "the id attribute", but we also want to match cases like these:  "set the id." (the search term is followed by a period), "Id is important" (search term at beginning of sentence), and even plurals like: "set all the ids for these divs".  It should also handle cases where the search term is followed immediately by some whitespace character such as a newline, or a tab.&lt;br /&gt;&lt;br /&gt;Here is what I came up with that I think satisfies all those criteria:&lt;br /&gt;&lt;pre class="MiamiVice"&gt;$count = preg_match_all('/([^a-z]|^)'.$needle.'([^a-z]|$|(s[^a-z]))/',$haystack,$matches);&lt;br /&gt;&lt;/pre&gt;The first part of the regular expression is: ([^a-z]|^)  This says the character immediately preceding the search term can be anything except characters a thru z, or it can be the beginning of line (^).  &lt;br /&gt;&lt;br /&gt;The second part of the expression is ([^a-z]|$|(s[^a-z])).  This says the character following the search term can be anything except a thru z, or it can be end of line ($), or an 's' character followed by any character that is not a thru z.  (This last part handles the plural of the search term, so we match "ids" as well as "id", but not "idsay" for example.)&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;a href='http://blogsearch.google.com/blogsearch?q=site%3Acssbakery.com+Internet' &lt;br /&gt;target='_blank' title='Internet'&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;img alt='web' src='http://pics.cssbakery.com/pics/webcake.jpg' title='Internet'/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;a href='http://blogsearch.google.com/blogsearch?q=site%3Acssbakery.com+Internet' &lt;br /&gt;target='_blank' title='Internet'&amp;gt;The Internets&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/li&amp;gt;  &lt;/pre&gt;&lt;br /&gt;Another thing that I do in my search algorithm is to give more weight to posts where the search term appears in the title of the post, or in the labels.  Posts where the title or label matches the search term will always appear at the top of my search results.  If the match is only in the text of the post, it will still be listed, but further down the list.  In fact, I even put a separator in the output so you can see the title/label matches above the separator, and the other matches below it.  The algorithm also ranks posts higher in the list based on how many times the search term appears in the title, labels, as well as the body of the post.&lt;br /&gt;&lt;br /&gt;In the CSS, I styled an ordered list which comes with sequential numbers instead of bullets:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;.searchresults ol {&lt;br /&gt;  padding-left: 25px; &lt;br /&gt;}&lt;br /&gt;.searchresults ol li {&lt;br /&gt;  margin-top: 5px;&lt;br /&gt;}&lt;br /&gt;.searchresults ol li a, .searchresults ol {&lt;br /&gt;  font-family: "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;&lt;br /&gt;  font-size: 13px;&lt;br /&gt;  color: #606060;&lt;br /&gt;  font-weight: normal;&lt;br /&gt;}&lt;br /&gt;.searchresults ol li a:hover {&lt;br /&gt;  color: #30AECE;&lt;br /&gt;}&lt;br /&gt;.searchresults {&lt;br /&gt;  margin-top: 45px;&lt;br /&gt;}&lt;br /&gt;.searchresults div.divider {&lt;br /&gt;  margin: 40px 0;&lt;br /&gt;}&lt;br /&gt;.searchresults h3 {&lt;br /&gt;  color: #CC6600;&lt;br /&gt;  font-size: 30px;&lt;br /&gt;  font-weight: normal;&lt;br /&gt;  font-family: "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;&lt;br /&gt;}  &lt;/pre&gt;&lt;br /&gt;Another minor thing I did is to have the page automatically scroll to the top when you click on a category search.  I did this with the following Javascript statement:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;window.scrollTo(0,0);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'll explain more about the Javascript and PHP code in a later post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5382011305306859711?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5382011305306859711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2011/01/working-on-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5382011305306859711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5382011305306859711'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2011/01/working-on-search.html' title='Improving Search with Regular Expressions'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3839416918849131836</id><published>2010-12-31T12:17:00.000-08:00</published><updated>2010-12-31T12:17:02.877-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>My New Favorite Candy</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#ricolajpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'yellow'});});&lt;/script&gt;&lt;img id='ricolajpg' style='display:none;' src='http://pics.cssbakery.com/pics/ricola.jpg' alt='On a cavity making mission&amp;lt;br&amp;gt;[Ricola]&amp;lt;br&amp;gt;© Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;The picture pretty much sums up my last five days.   My tongue has gone numb sucking on lemon throat drops.   The sore throat persists.   Here's to feeling better tomorrow?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3839416918849131836?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3839416918849131836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/my-new-favorite-candy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3839416918849131836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3839416918849131836'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/my-new-favorite-candy.html' title='My New Favorite Candy'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3138934702845223598</id><published>2010-12-24T14:28:00.001-08:00</published><updated>2011-01-06T22:00:53.812-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='RSS Feed'/><category scheme='http://www.blogger.com/atom/ns#' term='Parsing RSS Feed'/><title type='text'>Parsing RSS Feeds with PHP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#xmas3jpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;img id='xmas3jpg' style='display:none;' src='http://pics.cssbakery.com/pics/xmas5.jpg' alt='Holiday Parade&amp;lt;br&amp;gt;[looks like focus was on reflections and not the boat]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;12/24 Morning&lt;br /&gt;Post Office open today?  I wouldn't have thought so but that's what it says on their site.  I need to make a trip over there.  I am still working on the footer while also programming a search tool.&lt;br /&gt;&lt;br /&gt;12/24 @2:26PM&lt;br /&gt;I neglected my subject categories long enough so this Christmas Eve, I've sat down to write a search tool that will help people find what they are looking for.  &lt;br /&gt;&lt;br /&gt;I wrote the following PHP code to pull down my CSSBakery RSS feed, then parse and dump it out:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;function dumpXmlDoc($node,$d=0) {&lt;br /&gt;    if ($d==0) { echo "&amp;lt;pre&amp;gt;"; }&lt;br /&gt;    echo str_repeat(" ",$d).$node-&amp;gt;getName()."\n";&lt;br /&gt;    foreach ($node-&amp;gt;attributes() as $k=&amp;gt;$v) {&lt;br /&gt;      echo str_repeat(" ",$d+2)."($k='$v')\n";&lt;br /&gt;    }&lt;br /&gt;    echo str_repeat(" ",$d+2).":".(string)$node."\n";&lt;br /&gt;    foreach($node-&amp;gt;children() as $child) {&lt;br /&gt;      dumpXmlDoc($child,$d+2);&lt;br /&gt;    } &lt;br /&gt;    if ($d==0) { echo "&amp;lt;/pre&amp;gt;"; }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  $xml = simplexml_load_file('http://www.cssbakery.com/feeds/posts/default?max-results=10');&lt;br /&gt;  dumpXmlDoc($xml);  &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;RSS feeds are formatted as XML documents, so I'm using PHP's SimpleXML extension.  The following line of PHP code does a lot for us:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;$xml = simplexml_load_file('http://www.cssbakery.com/feeds/posts/default?max-results=10');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This causes SimpleXML to load the feed document from my Blog, parse it, and construct a corresponding data structure in memory.  This function can load files off the server's filesystem, but it can also retrieve them over HTTP, which is what we are doing here.  Note that in the URL I am specifying a query parameter of max-results=10.  That tells Blogger to only give me the latest 10 posts.  &lt;br /&gt;&lt;br /&gt;Next we want to just dump out the XML structure that we now have in memory.  For this I wrote a small recursive function, dumpXmlDoc() to dump out the XML tree.  The function takes two parameters:  a node that is the root of the sub-tree to dump out, and an optional depth variable I called $d.  If a 2nd parameter is not specified, it defaults to zero.&lt;br /&gt;&lt;br /&gt;We call dumpXmlDoc() on the root of the tree, letting the 2nd parameter default to zero:&lt;br /&gt;&lt;pre class="Blue"&gt;dumpXmlDoc($xml);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If the dump function sees that the depth ($d) is zero, it will wrap the output in a &amp;lt;pre&amp;gt; tag to preserve formatting:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;function dumpXmlDoc($node,$d=0) {&lt;br /&gt;    if ($d==0) { echo "&amp;lt;pre&amp;gt;"; }&lt;br /&gt;    ... (do the dumping logic) ...&lt;br /&gt;    if ($d==0) { echo "&amp;lt;/pre&amp;gt;"; }&lt;br /&gt;  }&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;It dumps out the name, attributes, and value of the current node.  The calls to str_repeat() are there to provide some indenting of the output by generating a number of spaces based on the current depth ($d):&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;echo str_repeat(" ",$d).$node-&amp;gt;getName()."\n";&lt;br /&gt;    foreach ($node-&amp;gt;attributes() as $k=&amp;gt;$v) {&lt;br /&gt;      echo str_repeat(" ",$d+2)."($k='$v')\n";&lt;br /&gt;    }&lt;br /&gt;    echo str_repeat(" ",$d+2).":".(string)$node."\n";&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;Then it loops over all children of the current node and recursively calls itself on each child, passing in a computed value of depth that is greater than the current depth:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;foreach($node-&amp;gt;children() as $child) {&lt;br /&gt;      dumpXmlDoc($child,$d+2);&lt;br /&gt;    } &lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;And that's all there is to it.  We can use this as a basis for writing some interesting applications to process RSS feeds.&lt;br /&gt;&lt;br /&gt;You can see the live output of this code &lt;a href="http://pics.cssbakery.com/treats/contents/top.php"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3138934702845223598?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3138934702845223598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/parsing-rss-feeds-with-php_24.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3138934702845223598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3138934702845223598'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/parsing-rss-feeds-with-php_24.html' title='Parsing RSS Feeds with PHP'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-714203151839054612</id><published>2010-12-21T11:24:00.001-08:00</published><updated>2010-12-24T14:34:46.875-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>Lights</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#xmas1jpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'orange'});});&lt;/script&gt;&lt;img id='xmas1jpg' style='display:none;' src='http://pics.cssbakery.com/pics/xmas1.jpg' alt='Rock n Roll Parade&amp;lt;br&amp;gt;[December 11, 2010]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Time to bring out my fake snowfall.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-714203151839054612?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/714203151839054612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/parade.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/714203151839054612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/714203151839054612'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/parade.html' title='Lights'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-5948977455067765556</id><published>2010-12-12T00:56:00.000-08:00</published><updated>2010-12-12T08:58:13.709-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP Array of Arrays'/><category scheme='http://www.blogger.com/atom/ns#' term='Network Address Translation'/><category scheme='http://www.blogger.com/atom/ns#' term='Array'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='th'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP foreach'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Table'/><category scheme='http://www.blogger.com/atom/ns#' term='Class'/><category scheme='http://www.blogger.com/atom/ns#' term='td'/><title type='text'>PHP:  Displaying a Simple Table</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#xmas4jpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'pink'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='xmas4jpg' style='display:none;' src='http://pics.cssbakery.com/pics/xmas4.jpg' alt='Dusk on Saturday&amp;lt;br&amp;gt;[12/11/2010]&amp;lt;br&amp;gt;© Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;I was trying to post something for Saturday.  I didn't notice how late it had become. It's after midnite here so this will be a Sunday post. :)&lt;br /&gt;&lt;br /&gt;After my previous post on Scrolling Tables with Fixed Headings, I realized that some people who are starting out in PHP might be interested in some of the simple PHP code I used to generate the table examples.  So in this post I'll list that PHP code and explain it.&lt;br /&gt;&lt;br /&gt;One thing I did not want to do was duplicate the table data in multiple files.  So I have put all the table data in one PHP file called tabledata.php. Here's an excerpt from that file:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;$cruises = array(&lt;br /&gt;    array("Seabourne Sun","Seabourn Cruise Line","1988","","Ended service in 2002,&lt;br /&gt;           currently operating as Prinsendam"),&lt;br /&gt;    array("Adventures of the Seas","Royal Caribbean International","2001","138,000","Operating"),    &lt;br /&gt;    array("Oceanic Independence","American Hawaiian Cruises / American Global Line","1974",&lt;br /&gt;          "23,719","Named formerly (1951—1974) and subsequently renamed &lt;br /&gt;           (1982—2006) the Independence, renamed the Oceanic (2006), sold &lt;br /&gt;           for scrap in 2008 but remains in mothballs"),&lt;br /&gt;    array("Cunard Ambassador","Cunard Line","1972","14,160","Burnt 1974, &lt;br /&gt;           rebuilt into a livestock carrier, renamed Linda Clausen, later Procyon, Raslan. &lt;br /&gt;           Scrapped 1984 after a second fire."),&lt;br /&gt;    array("Aegean Beauty","Voyages to Antiquity","1973","11,563","Formerly Aegean Dolphin &lt;br /&gt;           and Aegean I. Operating"),&lt;br /&gt;    array("Serenade of the Seas","Royal Caribbean International","2003","90,090","Operating"),&lt;br /&gt;    array("Queen Elizabeth 2","Cunard Line","1969","70,327","Left fleet in November 2008"),&lt;br /&gt;    array("Queen Elizabeth","Cunard Line","2010","92,000","Operating"),&lt;br /&gt;    array("Regent Sea","Regency Cruises","1957","","Began operation in 1957 as the Gripsholm (II) &lt;br /&gt;           for Swedish America Line. Ended operation when Regency went bankrupt in 1995. &lt;br /&gt;           Was to be converted to a casino ship, but later marked for scrap. Prior to scrapping,&lt;br /&gt;           was looted by pirates, then sank in heavy seas in 2001."),&lt;br /&gt;    array("Allure of the Seas","Royal Caribbean International","2010","225,000",&lt;br /&gt;           "Starts service in December 2010"),&lt;br /&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is a PHP array of arrays.  Each inner array represents one row in the table we will render.  In each PHP file where I need to show the table I simply include the file with the array(include "tabledata.php";).  Then the only trick is to loop through the outer array and generate the table:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;table class="cruises"&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Operator&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Began operation&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Tonnage&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Status&amp;lt;/th&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;?php foreach ($cruises as $cruise): ?&amp;gt;&lt;br /&gt;          &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&amp;lt;?=$cruise[0]?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&amp;lt;?=$cruise[1]?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&amp;lt;?=$cruise[2]?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&amp;lt;?=$cruise[3]?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&amp;lt;?=$cruise[4]?&amp;gt;&amp;lt;/td&amp;gt;                        &lt;br /&gt;          &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;?php endforeach; ?&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;    &lt;/pre&gt;&lt;br /&gt;The key here is the "foreach" loop.  In PHP you can code this with a colon and an "endforeach", as I did here, or using the traditional curly braces.  Inside the loop each inner array gets assigned to the $cruise variable.  We then access individual fields by indexing into $cruise with offsets from zero through four.&lt;br /&gt;&lt;br /&gt;If I think of something to add, I'll do that tomorrow when I wake up.  Good nite. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-5948977455067765556?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/5948977455067765556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/php-displaying-simple-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5948977455067765556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/5948977455067765556'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/php-displaying-simple-table.html' title='PHP:  Displaying a Simple Table'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7848464049451883460</id><published>2010-12-04T22:00:00.000-08:00</published><updated>2010-12-06T19:48:06.185-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='DIV'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Layout'/><category scheme='http://www.blogger.com/atom/ns#' term='Scrolling Tables'/><category scheme='http://www.blogger.com/atom/ns#' term='Stu Nicholls'/><category scheme='http://www.blogger.com/atom/ns#' term='th'/><category scheme='http://www.blogger.com/atom/ns#' term='Class'/><category scheme='http://www.blogger.com/atom/ns#' term='td'/><category scheme='http://www.blogger.com/atom/ns#' term='overflow'/><category scheme='http://www.blogger.com/atom/ns#' term='tbody'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Cells'/><category scheme='http://www.blogger.com/atom/ns#' term='Tables with Fixed Headings'/><category scheme='http://www.blogger.com/atom/ns#' term='thead'/><category scheme='http://www.blogger.com/atom/ns#' term='Truncation'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Table'/><category scheme='http://www.blogger.com/atom/ns#' term='Absolute Positioning'/><title type='text'>CSS Scrolling Tables with Fixed Headings</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#diningtablejpg').cssBakeryCaption({'opacity':'0.5','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='diningtablejpg' style='display:none;' src='http://pics.cssbakery.com/pics/dr400.jpg' alt='Dining Table&amp;lt;br&amp;gt;[with scrolling legs]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;CSS Scrolling Tables is a big topic.  Lots of people have asked questions about how to keep the headings fixed, but are not always finding good answers. It took me one day (Saturday) to figure out the problem and part of today (Sunday) to write this post.  I'm working on a project where I needed a scrolling table with fixed headings.  That's where the table headings stay fixed in place, and you can scroll the data portion of the table. I tried a couple of things that didn't work, then resorted to a quick Google search that landed me at Stu Nicholls' CSSPlay site where he has a post on &lt;a href="http://www.cssplay.co.uk/menu/tablescroll"&gt;CSS Scrolling Tables&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Stu's solution is very clean compared to some others I found, however it didn't handle the very complex table I was dealing with.  It does work fine when the data in each column of the table are close to the same width, but my table has one column where there is text that varies from a few words to a lengthy paragraph.  To make things even worse, there are occasional cases in my data where a column will have a LongUnbrokenStringThatJustKeepsGoing.  Those long strings create havoc in tables as the browser tries to adjust column widths to accommodate the longest string it sees. &lt;br /&gt;&lt;br /&gt;That combination of long paragraph data, and long unbroken strings broke Stu's solution.&lt;br /&gt;&lt;br /&gt;The problem is that with variable length data in the cells, the browser ends up adjusting the width of the data cells based on content, but does not adjust the width of the fixed heading cells.  So you end up with the column heading cells having different widths than the data cells, and they do not align.  The frustrating thing is that if you allow the headings to scroll along with the data, then the browser will adjust the heading widths and all is well.  But as soon as you start keeping the headings fixed, they no longer align.&lt;br /&gt;&lt;br /&gt;I tried a few things to fix it.&lt;br /&gt;&lt;br /&gt;First I set table-layout to fixed, thinking that would cause the Browser to use fixed cell width, which would be the same for headings and data cells.  Didn't work.&lt;br /&gt;&lt;br /&gt;Next, I allowed the Browser to load the whole page with the headings allowed to scroll (not fixed), then using Javascript I set the headings to be fixed.  I was thinking, 'Well, I'll let the Browser figure out all the right widths for the headings, then sneak in with Javascript and tell it to not scroll them'.  No luck! As soon as the Javascript ran, the headings no longer aligned with the data cells.  &lt;br /&gt;&lt;br /&gt;Then, I decided to give every column a class name, on both the heading and data cells, and use CSS to set the width explicitly on each column, like .col1 { width: 6em; }.  Same result! The headings still didn't align with the data.&lt;br /&gt;&lt;br /&gt;A little research revealed that when it comes to Tables, Browsers take your width statements as "suggestions" rather than as "commands".  They'll try to accommodate you, but if there's some long string in a table cell, they can decide on a different width.  &lt;br /&gt;&lt;br /&gt;At this point I was about ready to ditch the table markup completely and just render it all with div's.  I even coded it up, and quickly discovered that I could make fixed headings and data rows align correctly, but there was one thing that wasn't working.  HTML tables do have the benefit that they render all the cells in a row with the same height.  That wasn't true in my div-based markup.  I had rows with cells of varying height, and that made it difficult to use borders to render a nice grid for the table.  &lt;br /&gt;&lt;br /&gt;For a second I thought about a way to make my div-based tables work using Javascript, but then another idea struck me:  Go back to using table markup, but in each heading and data cell, put in an extra div to wrap the content, and give those divs explicit widths via CSS.  Amazingly, this worked.  I just wished I had thought of it sooner.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;AN EXAMPLE: CRUISE SHIPS&lt;/h1&gt;&lt;br /&gt;I have linked to a series of self contained example files that illustrate various problems, and the ultimate solution.  (note: the table data is a subset of the table in this &lt;a href="http://en.wikipedia.org/wiki/List_of_cruise_ships"&gt;Wikipedia article&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest0.php"&gt;tableTest0&lt;/a&gt; - This file contains just the initial table markup, and some minimal styling.  This is what the table would look like with no scrolling.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest1.php"&gt;tableTest1&lt;/a&gt; - In this file we start having the table scroll.  But notice that the headings scroll as well.  What we're going for is to have the headings stay fixed, and only have the data portion of the table scroll.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest2.php"&gt;tableTest2&lt;/a&gt; - Here, we've got the headings fixed in place, but they are the wrong widths.  The Browser is treating them like a separate table with respect to calculating their widths.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest3.php"&gt;tableTest3&lt;/a&gt; - In this file we change the markup to add a class on every table cell (both heading and data cells).  We then apply widths to each cell class.  At first this seems to work, but it's actually got a problem.  As soon as you introduce one of those LongStringsWithNoSpaces, then this solution breaks.  This is shown in &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest4.php"&gt;tableTest4&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest5.php"&gt;tableTest5&lt;/a&gt; we solve the problem by changing the markup to put div's in all the table cells, and those div's are all given widths.  Below we'll take a closer look at the details of this solution.  &lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest6.php"&gt;tableTest6&lt;/a&gt; is the final result after I applied some additional tweaks to improve the appearance of the table.  These tweaks are described later in the post.  &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;THE SOLUTION MARKUP &amp;amp; CSS&lt;/h1&gt;&lt;br /&gt;Here is the markup for the tableTest5 solution (this is prior to the tweaks applied in the next section of this post):&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div class="scrollableContainer"&amp;gt;&lt;br /&gt;  &amp;lt;div class="scrollingArea"&amp;gt;&lt;br /&gt;   &amp;lt;table class="cruises scrollable"&amp;gt;&lt;br /&gt;     &amp;lt;thead&amp;gt;&lt;br /&gt;     &amp;lt;tr&amp;gt;&lt;br /&gt;         &amp;lt;th&amp;gt;&amp;lt;div class="name"&amp;gt;Name&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;         &amp;lt;th&amp;gt;&amp;lt;div class="operator"&amp;gt;Operator&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;         &amp;lt;th&amp;gt;&amp;lt;div class="began"&amp;gt;Began operation&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;         &amp;lt;th&amp;gt;&amp;lt;div class="tonnage"&amp;gt;Tonnage&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;         &amp;lt;th&amp;gt;&amp;lt;div class="status"&amp;gt;Status&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;     &amp;lt;/tr&amp;gt;&lt;br /&gt;    &amp;lt;/thead&amp;gt;&lt;br /&gt;    &amp;lt;tbody&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;          &amp;lt;td&amp;gt;&amp;lt;div class="name"&amp;gt;Name of ship&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;          &amp;lt;td&amp;gt;&amp;lt;div class="operator"&amp;gt;Who operates&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;          &amp;lt;td&amp;gt;&amp;lt;div class="began"&amp;gt;Began service when&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;          &amp;lt;td&amp;gt;&amp;lt;div class="tonnage"&amp;gt;How big&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;          &amp;lt;td&amp;gt;&amp;lt;div class="status"&amp;gt;Current status&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;                        &lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;       ... more rows ...&lt;br /&gt;      &amp;lt;/tbody&amp;gt;&lt;br /&gt;   &amp;lt;/table&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;  &lt;/pre&gt;One thing you'll notice is I've wrapped the table in two DIVs.  The outer div holds the whole thing and has some padding at the top that will be used for rendering the fixed headings (we'll absolutely position the headings over the top padding).  &lt;br /&gt;&lt;br /&gt;The inner div defines the area that will scroll.  The key to producing the scrolling area is giving this div a height and setting the overflow property to 'auto'.&lt;br /&gt;&lt;br /&gt;The other change in the markup is that I've wrapped the contents of each cell (both th's and td's) with divs, and given those divs class names that correspond to the name of the column.  I hesitated in putting in this extra markup, tried several ways to avoid it, but in the end I found it absolutely necessary in order to take control of the column widths.  Without it you end up with cases like my 4th example file: &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest4.php"&gt;tableTest4&lt;/a&gt;.  In fact the only difference between this example and the final solution (&lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest5.php"&gt;tableTest5&lt;/a&gt;) was the addition of the divs wrapping the cell contents.&lt;br /&gt;&lt;br /&gt;Here's the CSS of the solution presented in the tableTest5 example.  This is prior to the various tweaks we apply in the next section to improve the appearance of the table (to see the final code do a "view source" on &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest6.php"&gt;tableTest6&lt;/a&gt;, or follow the individual changes described in the next section.):&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;* { padding: 0; margin: 0; }&lt;br /&gt;  table.cruises { &lt;br /&gt;    font-family: verdana, arial, helvetica, sans-serif;&lt;br /&gt;    font-size: 11px;&lt;br /&gt;    cellspacing: 0; &lt;br /&gt;    border-collapse: collapse; &lt;br /&gt;    width: 535px;    &lt;br /&gt;    }&lt;br /&gt;  table.cruises th, table.cruises td { &lt;br /&gt;    border-right: 1px solid #999; &lt;br /&gt;    border-bottom: 1px solid #999; &lt;br /&gt;    }&lt;br /&gt;  table.cruises th { background: #aab; }&lt;br /&gt;  table.cruises td { background: #eee; }&lt;br /&gt;  &lt;br /&gt;  div.scrollableContainer { &lt;br /&gt;    position: relative; &lt;br /&gt;    width: 552px; &lt;br /&gt;    padding-top: 1.7em; &lt;br /&gt;    margin: 40px;    &lt;br /&gt;    border: 1px solid #999;&lt;br /&gt;    background: #aab;&lt;br /&gt;    }&lt;br /&gt;  div.scrollingArea { &lt;br /&gt;    height: 240px; &lt;br /&gt;    overflow: auto; &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  table.scrollable thead tr {&lt;br /&gt;    left: 0; top: 0;&lt;br /&gt;    position: absolute;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  table.cruises .name     { width: 108px; }&lt;br /&gt;  table.cruises .operator { width: 126px; }&lt;br /&gt;  table.cruises .began    { width: 76px; text-align:center; }&lt;br /&gt;  table.cruises .tonnage  { width: 60px; text-align:center; }&lt;br /&gt;  table.cruises .status   { width: 160px; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Let's break down the CSS one part at a time.  This first part is really just styling the table, and is not directly involved in the scrolling aspects of the design:&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises { &lt;br /&gt;    font-family: verdana, arial, helvetica, sans-serif;&lt;br /&gt;    font-size: 11px;&lt;br /&gt;    cellspacing: 0; &lt;br /&gt;    border-collapse: collapse; &lt;br /&gt;    width: 535px;    &lt;br /&gt;    }&lt;br /&gt;  table.cruises th, table.cruises td { &lt;br /&gt;    border-right: 1px solid #999; &lt;br /&gt;    border-bottom: 1px solid #999; &lt;br /&gt;    }&lt;br /&gt;  table.cruises th { background: #aab; }&lt;br /&gt;  table.cruises td { background: #eee; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In the next part we style the two wrapper div's that I mentioned earlier.  The outer container is set to position: relative so it becomes the positioning context for all elements under it.  We also add some padding at the top of this div.  That padding area is the place where we will position the column headings (using absolute positioning, explained below).  We also set the width to 552px.  This has to be wide enough to accommodate both the table and the vertical scroll bar.  You'll probably want to tweak your width to get things just right.  The only other thing we do with this div is set it's border and background to match the colors we are using with the table.&lt;br /&gt;&lt;br /&gt;In the inner div, all we need to do is set the height of the scrolling area and set overflow to auto.  This creates the scrolling area of the table.&lt;br /&gt;&lt;pre class="Blue"&gt;div.scrollableContainer { &lt;br /&gt;    position: relative; &lt;br /&gt;    width: 552px; &lt;br /&gt;    padding-top: 1.7em; &lt;br /&gt;    margin: 40px;    &lt;br /&gt;    border: 1px solid #999;&lt;br /&gt;    background: #aab;&lt;br /&gt;    }&lt;br /&gt;  div.scrollingArea { &lt;br /&gt;    height: 240px; &lt;br /&gt;    overflow: auto; &lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In the final part of the CSS, we first setup the absolute positioning of the column headings.  We just put them as 0,0 of the positioning context, which is the outer div (class='scrollableContainer').  So, what we're doing here is positioning the column headings over the top of the padding we had created in that outer div. &lt;br /&gt;&lt;br /&gt;The only other thing we need to do is set the widths of each column.  You need to adjust these widths for the final presentation of the table.  You want the last column to end just before the vertical scroll bar, but don't make the table too wide or you'll get a horizontal scroll bar.  In my case the column widths add up to 530px.  The total width of the outer div is 552px.  The difference of 22px is taken up by the vertical scroll bar.  If you want to center any columns, you can do that here too, as I do with the 'began' and 'tonnage' columns.&lt;br /&gt;&lt;br /&gt;&lt;pre class="Blue"&gt;table.scrollable thead tr {&lt;br /&gt;    left: 0; top: 0;&lt;br /&gt;    position: absolute;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  table.cruises .name     { width: 108px; }&lt;br /&gt;  table.cruises .operator { width: 126px; }&lt;br /&gt;  table.cruises .began    { width: 76px; text-align:center; }&lt;br /&gt;  table.cruises .tonnage  { width: 60px; text-align:center; }&lt;br /&gt;  table.cruises .status   { width: 160px; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;ADDITIONAL TWEAKS&lt;/h1&gt;&lt;h2&gt;Hiding Cell Overflow&lt;/h2&gt;After a few final tweaks, here is my &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest6.php"&gt;final example&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you looked at each of the examples I linked to above, one thing you might have noticed in &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest5.php"&gt;tableTest5&lt;/a&gt; is that the text in the 2nd column of the 9th row overflows into the next cell.  Since we are taking full control of the column widths, and no longer allowing the Browser to determine widths based on LongStringsWithNoSpaces, then we also have to be responsible for making sure our column widths are wide enough.  &lt;br /&gt;&lt;br /&gt;If you have just a few cells that overflow and you don't want to make the whole column wider just for them, you have two choices:  (1) Let them overflow into the next cell, or (2) truncate them.  You can truncate them by setting overflow: hidden on the table cells.  Adding that to the CSS of my example, would look like this:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises td { background: #eee; overflow: hidden; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Fixing Scroll Bar Interaction&lt;/h2&gt;Another issue I found is that putting the cell borders on the right, as I have done, is causing some strange interaction with the scroll bar in some browsers, leaving artifacts while scrolling.  The solution is to move the cell borders to the left and bottom, instead of right and bottom, like this:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises th, table.cruises td { &lt;br /&gt;    border-left: 1px solid #999; &lt;br /&gt;    border-bottom: 1px solid #999; &lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;But then you'll notice that the headings are mis-aligned by one pixel.  The reason for this is that we absolutely positioned the headers at 0,0 - which worked fine when there was no left border.  But adding the left border shifted the headers over by one pixel.  The solution for this is easy:  just absolutely position at -1,0 instead:&lt;br /&gt;&lt;pre class="Blue"&gt;table.scrollable thead tr {&lt;br /&gt;    left: -1px; top: 0;&lt;br /&gt;    position: absolute;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;Colored Columns&lt;/h2&gt;Next, I wanted to do something different, and give the columns different colors.  To do this I decided to change the markup a bit by moving the class names off of the divs in each cell, up to the enclosing td or th.  Like this:&lt;br /&gt;&lt;pre class="Blue"&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;    &amp;lt;th class="name"&amp;gt;&amp;lt;div&amp;gt;Name&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;    &amp;lt;th class="operator"&amp;gt;&amp;lt;div&amp;gt;Operator&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;  ...&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;    &amp;lt;td class="name"&amp;gt;&amp;lt;div&amp;gt;Queen Elizabeth&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;td class="operator"&amp;gt;&amp;lt;div&amp;gt;Cunard Line&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;    &lt;br /&gt;  ...&lt;br /&gt;&lt;/pre&gt;That markup change requires adjusting the CSS selectors for each column to target the divs, using descendant selectors:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises .name     div { width: 108px; }&lt;br /&gt;  table.cruises .operator div { width: 126px; }&lt;br /&gt;  table.cruises .began    div { width: 76px;  text-align:center; }&lt;br /&gt;  table.cruises .tonnage  div { width: 60px;  text-align:center; }&lt;br /&gt;  table.cruises .status   div { width: 160px; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, with that markup change in place, I can now set the colors of the various columns, like this:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises td.operator { background: #ebcb4d; }&lt;br /&gt;  table.cruises td.tonnage  { background: white; }&lt;br /&gt;  table.cruises td.name     { background: #C7E0C1; }  &lt;br /&gt;  table.cruises td.began    { background: #B7C3E8; }&lt;/pre&gt;&lt;h2&gt;Adding Padding&lt;/h2&gt;The next tweak is to add some padding in all the cells:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises th, table.cruises td { &lt;br /&gt;    ...&lt;br /&gt;    padding: 2px 4px;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;That padding makes the table wider, so we also adjust the width of the outer div up to 592px (this avoids the horizontal scroll bar):&lt;br /&gt;&lt;pre class="Blue"&gt;div.scrollableContainer { &lt;br /&gt;    position: relative; &lt;br /&gt;    width: 592px; &lt;br /&gt;    ...&lt;br /&gt;&lt;/pre&gt;&lt;h2&gt;Styling the Headings&lt;/h2&gt;Finally we'll change the headings to different color and background, and set them to render in "small-caps".  We also change the color of the scrollableContainer div to match the new color of the heading backgrounds:&lt;br /&gt;&lt;pre class="Blue"&gt;table.cruises th { &lt;br /&gt;    background: #6b6164;&lt;br /&gt;    color: white;&lt;br /&gt;    font-variant: small-caps;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  div.scrollableContainer { &lt;br /&gt;    ...&lt;br /&gt;    background: #6b6164;&lt;br /&gt;    }    &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/complextable2.jpg" alt="complex html table" /&gt;&lt;br /&gt;&lt;br /&gt;The screenshot of the table does not show the scroll bar on the right.  Once again &lt;a href="http://pics.cssbakery.com/treats/scrollingtable/tableTest6.php"&gt;final working version&lt;/a&gt; with a scrollbar can be seen here.  Do a "view source" to see the final CSS and Markup.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;h1&gt;&lt;br /&gt;CONCLUDING NOTES&lt;/h1&gt;&lt;br /&gt;If you are having trouble with headings mis-aligning with the data by a few pixels, try increasing the width of the columns, starting on the left with the first column that is mis-aligned.  It's best to do this in Firebug by placing your cursor on the width value and bumping it up (you can use the 'up arrow' key for this, or just edit in a new value).  Once you've got the right widths in Firebug, remember to copy the value to your code.&lt;br /&gt;&lt;br /&gt;If you are out there struggling with fixed table headings on a complex table (as I was for a full day), I hope this post will help you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7848464049451883460?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7848464049451883460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/css-scrolling-tables-with-fixed.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7848464049451883460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7848464049451883460'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/css-scrolling-tables-with-fixed.html' title='CSS Scrolling Tables with Fixed Headings'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4965791579753445678</id><published>2010-12-03T22:02:00.001-08:00</published><updated>2010-12-05T09:48:49.385-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cascade'/><category scheme='http://www.blogger.com/atom/ns#' term='Inheritance'/><category scheme='http://www.blogger.com/atom/ns#' term='Specificity'/><title type='text'>CSS Inheritance and Cascading</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#bigboatjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='bigboatjpg' style='display:none;' src='http://pics.cssbakery.com/pics/bigboatf3.jpg' alt='Zenji&amp;lt;br&amp;gt;[somebody&amp;#39;s ship, cough, sailboat]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;When you are first starting out with CSS, you may have some confusion about the concepts of inheritance and cascading, as well as &lt;a href="http://www.cssbakery.com/2009/06/in-nutshell-how-cascade-works.html"&gt;specificity&lt;/a&gt;.  Let's take a look at these ideas and see if we can make them clearer.  We'll start with inheritance.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Inheritance&lt;/h2&gt;&lt;br /&gt;Let's say your HTML looks like this:&lt;br /&gt;&lt;pre class="blue"&gt;&amp;lt;body&amp;gt;&lt;br /&gt;  &amp;lt;div&amp;gt;&lt;br /&gt;     &amp;lt;h1&amp;gt;The Title&amp;lt;/ht&amp;gt;&lt;br /&gt;     &amp;lt;p&amp;gt;&lt;br /&gt;         Some text.&lt;br /&gt;     &amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;/pre&gt;&lt;br /&gt;That results in a document tree that looks like this:&lt;br /&gt;&lt;pre class="blue"&gt;body&lt;br /&gt;    |-div&lt;br /&gt;        |-h1&lt;br /&gt;        |-p&lt;br /&gt;&lt;/pre&gt;If you add more elements the tree will become more complex, but even this simple document can demonstrate what CSS inheritance is all about.  Suppose you have the following CSS:&lt;br /&gt;&lt;br /&gt;body {&lt;br /&gt;color: green;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This will cause both the h1 heading and the text of the paragraph to be rendered in green.  The reason is that the div inherits the color green from it's parent, the body element.  Then the h1 and p inherit the color from their parent, the div.  This is just like a trait such as eye color being passed down from one generation of people to the next.&lt;br /&gt;&lt;br /&gt;Now suppose we add something else to the CSS:&lt;br /&gt;&lt;br /&gt;body {&lt;br /&gt;color: green;&lt;br /&gt;border: 1px solid red;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;What do you think will happen here?  &lt;br /&gt;Will everything be green with a red border?  &lt;br /&gt;&lt;br /&gt;No it won't because the border property is defined by the CSS standard to not be inheritable.  For each CSS property the W3C CSS specification tells you whether it is or isn't inheritable.  So think of things like borders as being like tattoos: they can change the appearance of the parent, but they aren't inherited to the next generation.&lt;br /&gt;&lt;br /&gt;Now consider what would happen if we add the following CSS rule:&lt;br /&gt;&lt;br /&gt;p {&lt;br /&gt;color: navy;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The heading will still be green, but now the paragraph text will be navy.  Furthermore, if there were more elements underneath the p, then they would all inherit 'navy' from their p parent.  &lt;br /&gt;&lt;br /&gt;The key idea here is that the value of an inheritable property p, for element x, are taken from the parent element *unless* some CSS rule - &lt;em&gt;any CSS rule&lt;/em&gt; - has something to say about that property's value.  So any applicable CSS rule, will override inheritance from the parent.  Think of CSS rules like Cosmic Rays that come in and modify the genes of a child so that her eyes are brown instead of blue like the parent.  Inheritance doesn't matter when a CSS rule makes a specific change to a property.&lt;br /&gt;&lt;br /&gt;So far, so good.  Now let's talk about Cascading.  &lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Cascading&lt;/h2&gt;&lt;br /&gt;For cascading, try to forget all about the structure of the HTML document and the parent-child relationships we talked about above.  Cascading has more to do with the many CSS rules that can apply to an individual HTML element, and deciding which rules really apply to the element's appearance.  An analogy is a persons education level, like "High School Graduate", "Bachelor Degree", "Masters Degree", "PhD".  It has nothing to do with inheritance, and is instead an attribute of the individual.&lt;br /&gt;&lt;br /&gt;To carry the analogy a little further, imagine that 100 people from the town of Smallville all graduated from Smallville High School together.  50 of those 100 went on to get Bachelor degrees at Bigtown U.  Now all 100 are technically high school graduates.  But we commonly refer to the ones who finished college as "college graduates", and the ones who only finished high school as "high school graduates".&lt;br /&gt;&lt;br /&gt;Now imagine that we attach properties to each person, where the properties are "home-town" and "education-level".  For 50 people the values will be:&lt;br /&gt;&lt;br /&gt;home-town:  smallville&lt;br /&gt;education-level:  high-school-graduate&lt;br /&gt;&lt;br /&gt;and the other 50 will be:&lt;br /&gt;&lt;br /&gt;home-town:  smallville&lt;br /&gt;education-level:  college-graduate&lt;br /&gt;&lt;br /&gt;We can derive these values from a couple of simple rules:&lt;br /&gt;&lt;br /&gt;1. All 100 people are from Smallville and graduated from Smallville High School.&lt;br /&gt;&lt;br /&gt;2. 50 people graduate from Bigtown U.&lt;br /&gt;&lt;br /&gt;A very similar process goes on in the Browser as it's trying to figure out all the CSS properties that apply to a given element.  Here's how to think about it:&lt;br /&gt;&lt;br /&gt;First, every given element on the page there is a set of properties (just like home-town, and education-level).  &lt;br /&gt;&lt;br /&gt;These properties will have default values set by the Browser.&lt;br /&gt;&lt;br /&gt;The default values are over-written by values inherited from parents.&lt;br /&gt;&lt;br /&gt;The inherited values are over-written by values in applicable CSS rules.  This is where the cascade comes into play.  The cascade works like this:&lt;br /&gt;&lt;br /&gt;a. Find all CSS rules where the selector applies to this element.&lt;br /&gt;b. Sort those CSS rules by &lt;a href="http://www.cssbakery.com/2009/06/in-nutshell-how-cascade-works.html"&gt;specificity&lt;/a&gt;, with low specificity rules at the top of the list, and high specificity at the bottom.&lt;br /&gt;c. For those rules where specificity is the same, put rules that appear later in the code closer to the bottom of the list.&lt;br /&gt;d.  Now starting at the top of the list, when you see a property value, write it down.  If you see that same property again further down the list, cross out the old value and use the new one.  So the values found further down the list take precedence.&lt;br /&gt;&lt;br /&gt;So, for example, let's say you have these five rules, and we're working out the property values for the paragraph in the example markup given earlier:&lt;br /&gt;&lt;br /&gt;p { color: pink; font-size: 10px; }&lt;br /&gt;body p { color: green; font-size: 20px;}&lt;br /&gt;body div p { color: yellow; }&lt;br /&gt;body div p { color: red; }&lt;br /&gt;body div { color: blue; }&lt;br /&gt;&lt;br /&gt;After we choose only those rules that apply to the p tag, and sort by &lt;a href="http://www.cssbakery.com/2009/06/in-nutshell-how-cascade-works.html"&gt;specificity&lt;/a&gt; (and secondarily by order of occurrence), the list looks like this:&lt;br /&gt;&lt;br /&gt;(Less specific)&lt;br /&gt;p { color: pink; font-size: 10px; }&lt;br /&gt;body p { color: green; font-size: 20px; }&lt;br /&gt;body div p { color: yellow; }&lt;br /&gt;body div p { color: red; }&lt;br /&gt;(More specific)&lt;br /&gt;&lt;br /&gt;Note that we don't include the rule for "body div" because that selector does not target the p element that we are working on.  Now to determine the property values that will apply to the p element, we walk down the list looking for property values.  We find color: pink right away and write that down.  As we keep going we find green, then yellow, then red.  In each case we replace the value with the one further down the list, so we end up with color: red. &lt;br /&gt;&lt;br /&gt;We do the same thing with font-size.  First we see font-size: 10px, and write it down.  Then we find font-size: 20px, cross out the 10px and write down 20px.  So our final properties that are set via the CSS cascade are:&lt;br /&gt;&lt;br /&gt;color: red;&lt;br /&gt;font-size: 20px;&lt;br /&gt;&lt;br /&gt;This whole process of finding the set of applicable CSS rules, and then determining how they affect the properties of the element, is what Cascading is all about.  Look again at the sorted list of CSS rules and notice how the font-size "cascades" down through multiple rules, even though those rules are more specific.&lt;br /&gt;&lt;br /&gt;To summarize, the key idea of Cascading is looking at all the CSS rules that apply to a given HTML element, and determining which property values to pull from those rules and apply to the element.&lt;br /&gt;&lt;br /&gt;And finally, remember that any properties of the element that are &lt;em&gt;not&lt;/em&gt; affected directly by the CSS cascade can end up being set by inheritance, or by Browser default values, or even by Browser runtime calculations (e.g. width and height).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4965791579753445678?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4965791579753445678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/inheritance-and-cascading.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4965791579753445678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4965791579753445678'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/inheritance-and-cascading.html' title='CSS Inheritance and Cascading'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7146644246356810007</id><published>2010-12-02T21:40:00.000-08:00</published><updated>2012-02-15T11:11:52.203-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blockquotes'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML Blockquote'/><category scheme='http://www.blogger.com/atom/ns#' term=':after'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Content Property'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Quote Property'/><category scheme='http://www.blogger.com/atom/ns#' term='Pseudo Element'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term=':before'/><category scheme='http://www.blogger.com/atom/ns#' term='p element'/><title type='text'>HTML Blockquote Element, CSS Content and Quote Properties</title><content type='html'>For an update, please see this &lt;a href="http://www.cssbakery.com/2012/01/writing-generic-css-blockquote-class.html"&gt;post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;9:40 PM.  Chilly Evening.  Quoting one of my favorite authors, I'm going to write an example for the HTML blockquote element and show you how to style it.  In &lt;a href=" http://www.amazon.com/Im-Stranger-Here-Myself-Returning/dp/076790382X/ref=sr_1_8?s=books&amp;ie=UTF8&amp;qid=1289943245&amp;sr=1-8"&gt;I'm a Stranger Here Myself&lt;/a&gt;,  Bill Bryson wrote:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="nu"&gt;&lt;img src="http://pics.cssbakery.com/pics/bryson.jpg" alt="" /&gt;In the oddest ways airlines continue to act as if it is still 1955. Take the safety demonstration.  Why after all these years do the flight attendants still put a life vest over their heads and show you how to pull the little cord that inflates it?  In the entire history of commercial aviation no life has been saved by the provision of a life vest.  &lt;br /&gt;&lt;br /&gt;I am especially fascinated by the way they include a little plastic whistle on each vest.  I always imagine myself plunging vertically toward the ocean at 1,200 miles an hour and thinking: "Well, Thank gosh I've got this whistle."&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Bill Bryson, &lt;a href=" http://www.amazon.com/Im-Stranger-Here-Myself-Returning/dp/076790382X/ref=sr_1_8?s=books&amp;ie=UTF8&amp;qid=1289943245&amp;sr=1-8"&gt;I'm a Stranger Here Myself&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;I set the background color of the blockquote to blue and painted a plane image with lowered opacity in both x and y directions.  The corners of the element are rounded by 4 pixels.  There's also the image of the author which I floated to the left and two oversized quotation marks.  As insignificant as those marks may seem, the coding behind them is not, possibly because most people are not familiar with the properties being used.  &lt;br /&gt;&lt;br /&gt;&lt;h1&gt;CSS CONTENT PROPERTY&lt;/h1&gt;&lt;br /&gt;&lt;blockquote class="nu narrow"&gt;&lt;img src="http://pics.cssbakery.com/pics/bill3.jpg" alt="" /&gt;In the oddest ways airlines continue to act as if it is still 1955. Take the safety demonstration.  Why after all these years do the flight attendants still put a life vest over their heads and show you how to pull the little cord that inflates it?  In the entire history of commercial aviation no life has been saved by the provision of a life vest.  &lt;br /&gt;&lt;br /&gt;I am especially fascinated by the way they include a little plastic whistle on each vest.  I always imagine myself plunging vertically toward the ocean at 1,200 miles an hour and thinking: "Well, Thank gosh I've got this whistle."&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Bill Bryson, &lt;a href=" http://www.amazon.com/Im-Stranger-Here-Myself-Returning/dp/076790382X/ref=sr_1_8?s=books&amp;ie=UTF8&amp;qid=1289943245&amp;sr=1-8"&gt;I'm a Stranger Here Myself&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;I'll be repeating the same passage from the book because I don't want to quote extensively from the same source.  The CSS "content" property allows us to add more content to the page without changing our HTML markup.  We generally use it with the :before and :after pseudo-selectors.  These pseudo selectors allow us to target the part of the page content just before, or after, a regular element's content.  For example, you can use this to target every paragraph on a page and insert something just before or after the paragraph text.  The way this works is we say something like: p:before { content: 'Paragraph: '; color: red; } and now every paragraph on the page will start with the word 'Paragraph', in red.&lt;br /&gt;&lt;br /&gt;In the blockquotes you see at the top of this post I use the 'content' property to insert the quotes before and after the quoted text. So as you can imagine, that might look a lot like the rule above, but replacing the word Paragraph, with a quote character, and changing the selector to the blockquote element, like this:&lt;br /&gt;&lt;br /&gt;blockquote:before { content: '"'; }&lt;br /&gt;blockqutoe:after  { content: '"'; }&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;CSS QUOTES PROPERTY&lt;/h1&gt;&lt;br /&gt;And that does work, but the resulting quotes are pretty boring.  We want some nice looking quotes where the opening and closing quotes are rendered differently.  The way to make this happen is with the CSS 'quotes' property, and the 'open-quote' and 'close-quote' values.   So, the above rules can be re-written as:&lt;br /&gt;&lt;br /&gt;blockquote { quotes: '"' '"'; }&lt;br /&gt;blockquote:before { content: open-quote; }&lt;br /&gt;blockquote:after  { content: close-quote; }&lt;br /&gt;&lt;br /&gt;This works fine, but it still gives us the same old boring quotes.  But one more small change to the quotes property will fix it:&lt;br /&gt;&lt;br /&gt;blockquote { quotes: '\201C' '\201D'; }&lt;br /&gt;blockquote:before { content: open-quote; }&lt;br /&gt;blockquote:after  { content: close-quote; }&lt;br /&gt;&lt;br /&gt;Now we are using some special character codes for the quote values.  You can find these in a table in the &lt;a href="http://www.w3.org/TR/CSS2/generate.html#propdef-quotes"&gt;CSS spec&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'm including the table here for easy reference:&lt;br /&gt;&lt;style type="text/css"&gt;  table { background: #D1D1E6; border-collapse: collapse; }  table td, table th { border: 1px solid #999; font-size: 20px; text-align: center; color: black; }  table th, table td.code, table td.des { font-size: 10px; }  table th{ background: #eec; padding: 0 5px; }  table td { padding: 0 8px; }  table td.des { text-align: left; }&lt;/style&gt;&lt;br /&gt;&lt;table cellspacing="0"&gt;&lt;tr&gt;&lt;th&gt;Character&lt;/th&gt;&lt;th&gt;Approximate rendering&lt;/th&gt;&lt;th&gt;ISO 10646 code (hex)&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;"&lt;/td&gt;&lt;td&gt;"&lt;/td&gt;&lt;td class="code"&gt;0022 &lt;/td&gt;&lt;td class="des"&gt;QUOTATION MARK [the ASCII double quotation mark] &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;'&lt;/td&gt;&lt;td&gt;'&lt;/td&gt;&lt;td  class="code"&gt;0027 &lt;/td&gt;&lt;td class="des"&gt;APOSTROPHE [the ASCII single quotation mark]     &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;‹&lt;/td&gt;&lt;td&gt;&amp;lt;&lt;/td&gt;&lt;td  class="code"&gt;2039   &lt;/td&gt;&lt;td class="des"&gt;SINGLE LEFT-POINTING ANGLE QUOTATION MARK      &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;›&lt;/td&gt;&lt;td&gt;&amp;gt;&lt;/td&gt;&lt;td  class="code"&gt;203A   &lt;/td&gt;&lt;td class="des"&gt;SINGLE RIGHT-POINTING ANGLE QUOTATION MARK     &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;«&lt;/td&gt;&lt;td&gt;«&lt;/td&gt;&lt;td  class="code"&gt;00AB   &lt;/td&gt;&lt;td class="des"&gt;LEFT-POINTING DOUBLE ANGLE QUOTATION MARK        &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;»&lt;/td&gt;&lt;td&gt;»&lt;/td&gt;&lt;td  class="code"&gt;00BB   &lt;/td&gt;&lt;td class="des"&gt;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK       &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;‘&lt;/td&gt;&lt;td&gt;`&lt;/td&gt;&lt;td  class="code"&gt;2018 &lt;/td&gt;&lt;td class="des"&gt;LEFT SINGLE QUOTATION MARK [single high-6]       &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;’&lt;/td&gt;&lt;td&gt;'&lt;/td&gt;&lt;td  class="code"&gt;2019 &lt;/td&gt;&lt;td class="des"&gt;RIGHT SINGLE QUOTATION MARK [single high-9]      &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;“&lt;/td&gt;&lt;td&gt;``&lt;/td&gt;&lt;td  class="code"&gt;201C &lt;/td&gt;&lt;td class="des"&gt;LEFT DOUBLE QUOTATION MARK [double high-6]        &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;”&lt;/td&gt;&lt;td&gt;''&lt;/td&gt;&lt;td  class="code"&gt;201D &lt;/td&gt;&lt;td class="des"&gt;RIGHT DOUBLE QUOTATION MARK [double high-9]      &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;„&lt;/td&gt;&lt;td&gt;,,&lt;/td&gt;&lt;td class="code"&gt;201E &lt;/td&gt;&lt;td class="des"&gt;DOUBLE LOW-9 QUOTATION MARK [double low-9]       &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;As one final touch, you can also set the font properties to affect how the quotes are rendered:&lt;br /&gt;&lt;br /&gt;p:before, p:after { font-family: 'Times New Roman'; font-weight: bold; font-size: 3em; }&lt;br /&gt;&lt;br /&gt;The other thing we need to do is float the closing quote to the right, to position it correctly at the lower right part of the blockquote:&lt;br /&gt;&lt;br /&gt;blockquote:after { content: close-quote; float: right; }&lt;br /&gt;&lt;br /&gt;We can also style the blockquote itself to add some styling and color.  Following is the entire listing for the CSS.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;STYLING THE BLOCKQUOTE ELEMENT&lt;/h1&gt;&lt;br /&gt;div.post-body blockquote.nu img { float: left;  margin-right: 25px; }&lt;br /&gt;&lt;br /&gt;div.post-body blockquote.nu span { float: right; }&lt;br /&gt;&lt;br /&gt;blockquote.nu:before, blockquote.nu:after {&lt;br /&gt;font-weight: bold; &lt;br /&gt;font-size: 3em; &lt;br /&gt;}&lt;br /&gt;.post blockquote.nu {&lt;br /&gt;width: 490px;&lt;br /&gt;/* an alternative look with the quote narrower and floated to the right &lt;br /&gt;of screen  float: right;   margin-left: 20px;  width: 200px;  */&lt;br /&gt;&lt;br /&gt;margin: 0px;&lt;br /&gt;padding: 30px;&lt;br /&gt;&lt;br /&gt;background: #C6E0FB url('images/aero.png') top left repeat;&lt;br /&gt;&lt;br /&gt;-moz-border-radius: 4px 4px 4px 4px;&lt;br /&gt;-webkit-border-radius: 4px;&lt;br /&gt;-goog-ms-border-radius: 4px 4px 4px 4px;&lt;br /&gt;border-radius: 4px 4px 4px 4px; &lt;br /&gt;&lt;br /&gt;quotes: "\201C" "\201D";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;blockquote.nu:before { content: open-quote;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;blockquote.nu:after  { content: close-quote; &lt;br /&gt;float: right; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hilite"&gt;First Note:&lt;/span&gt;  In the CSS above, I've added a class to all the blockquote selectors, so instead of blockquote:after, I'm writing blockquote.nu:after.  That is just to limit the scope of these rules to blockquotes of class "nu", instead of affecting all blockquotes globally.  When ever you are selecting by class, you can write .classname, or you can use the element type followed with .classname (with no spaces).  In this case I chose to say "blockquote.nu:after  for clarity, instead of writing: ".nu:after".&lt;br /&gt;&lt;br /&gt;&lt;span class="hilite"&gt;Second Note:&lt;/span&gt; If you are not on the Blogger, do not get thrown off by "div.post-body" or ".post" descendant selectors.  Your selectors will be simpler because chances are you don't have to watch out for specificity.  If I don't write my selector as  "div.post-body blockquote.nu img", my rule will be overwritten by another that's higher on the specificity scale.  For you, writing them as,&lt;br /&gt;&lt;br /&gt;blockquote.nu img { float: left;  margin-right: 25px; }&lt;br /&gt;&lt;br /&gt;blockquote.nu span { float: right; }&lt;br /&gt;&lt;br /&gt;should work.  If you have to build descendant selectors, you need to look at your containing elements.  Remember "post-body" or "post" are Blogger specific unless you happen to use the same naming convention.&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;BLOCKQUOTE: CSS FOR THE NARROW VERSION&lt;/h1&gt;&lt;br /&gt;I'm using double class structure, essentially writing over properties set by the previous blockquote class nu:&lt;br /&gt;&lt;br /&gt;.post blockquote.narrow {&lt;br /&gt;background-color: #e8e4b5;&lt;br /&gt;width: 280px;&lt;br /&gt;float: right;   &lt;br /&gt;padding: 25px 20px 20px;&lt;br /&gt;margin-left: 20px;&lt;br /&gt;font-size: 12px;&lt;br /&gt;}&lt;br /&gt;div.post-body blockquote.narrow img { float: right;  margin-right: 0; &lt;br /&gt;margin-left: 15px;}&lt;br /&gt;&lt;br /&gt;The Markup looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;blockquote class="nu narrow"&amp;gt;&lt;br /&gt;&amp;lt;img src="images/bill3.jpg" alt="" /&amp;gt;In the oddest&lt;br /&gt;ways airlines continue ..... of a life vest.  &lt;br /&gt;&lt;br /&gt;I am especially fascinated ..... Thank gosh I've got this whistle."&lt;br /&gt;&lt;br /&gt;&amp;lt;span&amp;gt;Bill Bryson, &amp;lt;a href=" http://www.amazon.com/..."&amp;gt;&lt;br /&gt;I'm a Stranger Here Myself&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/blockquote&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;CHANGING THE MARKUP TO TARGET P ELEMENTS&lt;/h1&gt;&lt;br /&gt;We can improve the look further by placing the end quote right after the text before the author name and book title.  Unfortunately there's not a way to do this using the blockquote element but if we changed the markup by specifying a first and last paragraph, we can hook into the p element instead.  In the following CSS, I highlighted everything that changed in yellow.  First the new markup:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;blockquote class="nuu"&amp;gt;&lt;br /&gt;&amp;lt;img src="images/bryson.jpg" alt="" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p class="first"&amp;gt;&lt;br /&gt;In the oddest ways airlines continue to act as if it is still 1955. Take the safety demonstration.  &lt;br /&gt;Why after all these years do the flight attendants still put a life vest over their heads and &lt;br /&gt;show you how to pull the little cord that inflates it?  In the entire history of commercial &lt;br /&gt;aviation no life has been saved by the provision of a life vest.&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p class="last"&amp;gt;&lt;br /&gt;I am especially fascinated by the way they include a little plastic whistle on each vest.  I &lt;br /&gt;always imagine myself plunging vertically toward the ocean at 1,200 miles an hour and thinking: &lt;br /&gt;"Well, Thank gosh I've got this whistle."&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;span&amp;gt;&lt;br /&gt;Bill Bryson, &amp;lt;a href=" http://www......"&amp;gt;I'm a Stranger Here Myself&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;/blockquote&amp;gt;  &lt;/pre&gt;&lt;br /&gt;div.post-body blockquote.nuu img { float: left;  margin-right: 25px; }&lt;br /&gt;&lt;span class="hilite"&gt;div.post-body blockquote.nuu span { float: right; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="hilite"&gt;blockquote.nuu p.first:before,  blockquote.nuu p.last:after&lt;/span&gt; {&lt;br /&gt;font-weight: bold;&lt;br /&gt;font-size: 3em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.post blockquote.nuu {&lt;br /&gt;width: 490px;&lt;br /&gt;margin: 0px;&lt;br /&gt;padding: 30px;&lt;br /&gt;background: #e8e4b5 url('images/aero.png') &lt;br /&gt;top left repeat;&lt;br /&gt;&lt;br /&gt;-moz-border-radius: 4px 4px 4px 4px;&lt;br /&gt;-webkit-border-radius: 4px;&lt;br /&gt;-goog-ms-border-radius: 4px 4px 4px 4px;&lt;br /&gt;border-radius: 4px 4px 4px 4px; &lt;br /&gt;&lt;br /&gt;quotes: "\201C" "\201D";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="hilite"&gt;blockquote.nuu p.first:before&lt;/span&gt; { content: open-quote; }&lt;br /&gt;&lt;span class="hilite"&gt;blockquote.nuu p.last:after &lt;/span&gt;{ &lt;br /&gt;content: close-quote; &lt;br /&gt;float: right; &lt;br /&gt;&lt;span class="hilite"&gt;padding-top:20px;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;&lt;blockquote class="nuu"&gt;&lt;div&gt;&lt;/div&gt;&lt;p class="first"&gt;In the oddest ways airlines continue to act as if it is still 1955. Take the safety demonstration.  Why after all these years do the flight attendants still put a life vest over their heads and show you how to pull the little cord that inflates it?  In the entire history of commercial aviation no life has been saved by the provision of a life vest.&lt;/p&gt;&lt;p class="last"&gt;I am especially fascinated by the way they include a little plastic whistle on each vest.  I always imagine myself plunging vertically toward the ocean at 1,200 miles an hour and thinking: "Well, Thank gosh I've got this whistle."&lt;/p&gt;&lt;br /&gt;&lt;span&gt;Bill Bryson, &lt;a href=" http://www.amazon.com/Im-Stranger-Here-Myself-Returning/dp/076790382X/ref=sr_1_8?s=books&amp;ie=UTF8&amp;qid=1289943245&amp;sr=1-8"&gt;I'm a Stranger Here Myself&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7146644246356810007?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7146644246356810007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7146644246356810007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7146644246356810007'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/html-blockquote-element-css-content-and.html' title='HTML Blockquote Element, CSS Content and Quote Properties'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2471019869422961191</id><published>2010-12-01T18:29:00.000-08:00</published><updated>2010-12-02T08:45:38.237-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IP Address'/><category scheme='http://www.blogger.com/atom/ns#' term='Network Address Translation'/><category scheme='http://www.blogger.com/atom/ns#' term='Dual Stack'/><category scheme='http://www.blogger.com/atom/ns#' term='IPv6'/><category scheme='http://www.blogger.com/atom/ns#' term='IPv4'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>IPv6 : Internet Protocol Version 6</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#greenfiberopticjpg').cssBakeryCaption({'opacity':'0.4','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='greenfiberopticjpg' style='display:none;' src='http://pics.cssbakery.com/pics/greenfiberoptic.jpg' alt='Fiberoptics&amp;lt;br&amp;gt;[form the backbone of the internet]&amp;lt;br&amp;gt;© 2010 Image Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;Got a bad sore throat going on for a week.  I was trying to heal it by drinking copious amounts of hot beverages but tonight my ear's hurting also.  So if I disappear again, you know why.  I said that I would talk about the new Internet standard so let's do that before we go back to CSS.  For the last decade, widespread use of IPv6 has always been "just a couple of years away".  It never happened.  But now things may really start to change, as the IPv4 address space is finally being exhausted.&lt;br /&gt;&lt;br /&gt;Today's Internet runs on IP version 4, or IPv4.  Every device on the Internet gets a unique IPv4 address (with some exceptions I'll mention below).  IPv4 addresses are four bytes - or 32 bits - long, and are typically written like this:  98.137.10.42.  Since it's a 32 bit number, the total number of IPv4 addresses is 2^32, or about 4.3 Billion (4,294,967,296 to be exact).  But, there are currently over 6.7 Billion people on the Earth, so you can see right away there aren't enough IPv4 addresses to go around.&lt;br /&gt;&lt;br /&gt;Of course, not everyone is on the Internet, but many people are consuming multiple addresses (e.g. one for the cell phone, one for their Kindle, one for their PC, etc..).  There are also many IPv4 address ranges that are reserved as private addresses, so aren't available in the public pool.&lt;br /&gt;&lt;br /&gt;The situation is helped a little by allowing multiple devices to share one public IP address.   If you have a home router, and four PCs connecting through that router, then you are really only using up a single public IPv4 address because the router is running a protocol called Network Address Translation (NAT).  NAT allows all four PCs to share a single public address assigned to the router.  So this helps with conserving the number of IPv4 addresses being used, but even with NAT, the number of IPv4 addresses available for allocation is dwindling.&lt;br /&gt;&lt;br /&gt;Current &lt;a href="http://www.potaroo.net/tools/ipv4/index.html"&gt;projections from the IPv4 Address Report&lt;/a&gt; site show IPv4 addresses being exhausted in March of 2011.  &lt;br /&gt;&lt;br /&gt;What then?  &lt;br /&gt;&lt;br /&gt;The answer is IPv6.  IPv6 addresses are 128 bits long.  That gives you 2^128 addresses, which is a *lot* of addresses.  The only problem right now with IPv6 is that not every device or web site is setup to use it.  All modern operating systems already have "dual stack" support - that's a networking stack with both IPv4 and IPv6 sitting side by side.  But the IPv6 stack might not be configured, or you might be connecting to an ISP that's not ready to hand out IPv6 addresses, or you might have a home router that just does not have IPv6 support.  &lt;br /&gt;&lt;br /&gt;The bottom line is if you were on an IPv6 only device right now, you could only see a part of the web - the parts that are already IPv6 ready.  That situation will have to change in the coming years, once the IPv4 address range is completely used up, and more and more users are only connected via IPv6.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2471019869422961191?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2471019869422961191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/12/ipv6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2471019869422961191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2471019869422961191'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/12/ipv6.html' title='IPv6 : Internet Protocol Version 6'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8147370601564040575</id><published>2010-11-30T18:43:00.000-08:00</published><updated>2010-12-01T08:41:22.919-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Horizontal Bar Graph'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS Bar Graphs'/><category scheme='http://www.blogger.com/atom/ns#' term='The Site'/><title type='text'>CSSBakery on the Web</title><content type='html'>Before we are done with November, just want to mention that in the beginning of the month, &lt;a href="http://speckyboy.com"&gt;Paul Andrew&lt;/a&gt; featured two of my graphs that you've seen here in his &lt;a href="http://speckyboy.com/2010/11/04/10-awesome-pure-css-graph-and-chart-techniques/"&gt;"10 Awesome Pure CSS Graph and Chart Techniques"&lt;/a&gt;roundup.  Thank you Paul!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8147370601564040575?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8147370601564040575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/cssbakery-on-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8147370601564040575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8147370601564040575'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/cssbakery-on-web.html' title='CSSBakery on the Web'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2376067585542798342</id><published>2010-11-28T14:07:00.000-08:00</published><updated>2010-12-01T08:41:45.090-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='z-index'/><category scheme='http://www.blogger.com/atom/ns#' term='display:block; Cookie Cutter Method'/><category scheme='http://www.blogger.com/atom/ns#' term='Class'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Absolute Positioning'/><title type='text'>CSS Cookie Cutter Revisited</title><content type='html'>After seeing &lt;a href="http://stackoverflow.com/questions/3182683/css-image-mask-overlay"&gt;this post on StackOverflow&lt;/a&gt; I decided to take a look at my &lt;a href="http://www.cssbakery.com/2009/06/background-image.html"&gt;cookie cutter method&lt;/a&gt; again to see how I could help people use it correctly.  First I took Neil's example and tried it out, providing my own images.  The result looks good to me, so I'm not clear where he was having a problem.  I tested in IE7, IE8, Firefox 3.6, and Chrome.  (IE6 clearly doesn't work due to lack of transparent png support.) The CSS, markup, and resulting image is shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;.filler {&lt;br /&gt;    padding-left:20px;&lt;br /&gt;    height:448px;&lt;br /&gt;    width:500px;&lt;br /&gt;    float:left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.filler-mask {&lt;br /&gt;    background: url('images/filler-mask.png') repeat;&lt;br /&gt;    position: absolute;&lt;br /&gt;    left:0; top:0;&lt;br /&gt;    height: 448px;&lt;br /&gt;    width: 500px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.filler-picture {&lt;br /&gt;    z-index: 0;&lt;br /&gt;    background: url('http://pics.cssbakery.com/pics/cubic2.jpg') no-repeat;&lt;br /&gt;    position: relative;&lt;br /&gt;    height: 448px;&lt;br /&gt;    width: 500px;&lt;br /&gt;    display: block;&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;&amp;lt;div class="filler"&amp;gt;&lt;br /&gt;    &amp;lt;div class="filler-picture"&amp;gt;&lt;br /&gt;        &amp;lt;img src="http://pics.cssbakery.com/pics/cubic2.jpg" alt="test" /&amp;gt;&lt;br /&gt;        &amp;lt;div class="filler-mask"&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#cookieCutjpg').cssBakeryCaption({'opacity':'0.5','center':true,'centerCaption':true,'round':false,'hide':true,'color':'#666666','bgcolor':'orange'});});&lt;/script&gt;&lt;br /&gt;I used a circular "cookie cutter" mask over an image of a boat:&lt;br /&gt;&lt;br /&gt;&lt;img id='cookieCutjpg' style='display:none;' src='http://pics.cssbakery.com/treats/images/maskedBoat.jpg' alt='Cookie Cutter Mask Applied to a Photo&amp;lt;br&amp;gt;[an aluminum hull ketch under morning sun]&amp;lt;br&amp;gt;© Copyright www.cssbakery.com All Rights Reserved' /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;Next I decided to re-write the example a bit and see if I could streamline the code some:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;* { margin:0; padding:0; }&lt;br /&gt;&lt;br /&gt;.framed, .framed img {&lt;br /&gt;  width:500px;&lt;br /&gt;  height:448px;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;.picture {&lt;br /&gt;  position: relative;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;.mask {&lt;br /&gt;  background: url('images/filler-mask.png') repeat;&lt;br /&gt;  position: absolute;&lt;br /&gt;  left:0; top:0;&lt;br /&gt;  }&lt;br /&gt;...&lt;br /&gt;&amp;lt;div class="framed"&amp;gt;&lt;br /&gt;    &amp;lt;div class="framed picture"&amp;gt;&lt;br /&gt;        &amp;lt;img src="http://pics.cssbakery.com/pics/cubic2.jpg" alt="test" /&amp;gt;&lt;br /&gt;        &amp;lt;div class="framed mask"&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Only the class names have been changed in the markup, and now the CSS is considerably shorter. The &lt;a href="http://pics.cssbakery.com/treats/csstest2.html"&gt;resulting image&lt;/a&gt; is the same.  &lt;br /&gt;&lt;br /&gt;What this technique really boils down to is using the png mask image as a background on a div, and then displaying that div directly over the top of the photo we want to make the cuts from.  We do that using absolute positioning, making sure that we have a parent div that provides a positioning context.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2376067585542798342?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2376067585542798342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/css-cookie-cutter-revisited.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2376067585542798342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2376067585542798342'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/css-cookie-cutter-revisited.html' title='CSS Cookie Cutter Revisited'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-2422119200736588313</id><published>2010-11-27T21:18:00.000-08:00</published><updated>2010-11-28T12:15:46.049-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='display:block;'/><category scheme='http://www.blogger.com/atom/ns#' term='Adjusting Blogger Profile Image'/><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><category scheme='http://www.blogger.com/atom/ns#' term='width'/><category scheme='http://www.blogger.com/atom/ns#' term='Descendant Selector'/><category scheme='http://www.blogger.com/atom/ns#' term='height'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='Modifying Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='img'/><title type='text'>Blogger Profile Pictures and "Excuse me, Have You Seen a Chicken?"</title><content type='html'>Weaving between the chilly palm tree shaded spots and patches of evening sun,  I was walking yesterday when I got stopped by two very cute, chubby 10 years olds. A boy and a girl with dark hair, bundled up in jackets, faces red from the cold.  They asked me if I had seen a chicken "just wandering around".  For a second, I stood there wondering if I heard them right as they looked up to me with hope.  So I say, "Did you lose one?".   They answer, "Yes".  I smile and tell them that no, I hadn't seen a chicken.  I noticed that one of them was carrying a net with a handle to scoop up the bird.  As we continued to walk in opposite directions, I kept an eye out for the errant chicken.  :-)&lt;br /&gt;&lt;br /&gt;Blogger profiles come with an image that you can upload either from your machine or by a URL.  I recently added one which looked like this:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/bloggerimageprofile1.jpg" alt="Blogger Profile Image" /&gt;&lt;br /&gt;&lt;br /&gt;The CSS that managed the look was:&lt;br /&gt;&lt;br /&gt;.profile-img { &lt;br /&gt;float: $startSide; &lt;br /&gt;margin-top: 0;&lt;br /&gt;margin-$endSide: 5px;&lt;br /&gt;margin-bottom: 5px;&lt;br /&gt;margin-$startSide: 0;&lt;br /&gt;padding: 4px;&lt;br /&gt;border: 1px solid $bordercolor;&lt;br /&gt;}&lt;br /&gt;(NOTE: the strings that start with dollar sign ($) are Blogger variables.  Blogger takes care of replacing those in the final CSS sent to the browser.)&lt;br /&gt;&lt;br /&gt;I did not like the way this crowded the image and the blogger's name into the same line.  I thought a bigger image and the person's name on a separate line would look better so I wrote the following, doing away with the float and specifying image width to preempt stretching:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#Profile1 .profile-img { &lt;br /&gt;display: block; &lt;br /&gt;float: none; &lt;br /&gt;width: 140px; &lt;br /&gt;height: 109px; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;150 pixels is the width of my right sidebar.  Since I have 4 pixel margins on each side of the profile image, and a single pixel border around the image, I subtracted 10 pixels from my total of 150. Don't forget to give it a height also (need to get this number from your image editor).  I did not want to be ignored so I increased specificity by writing a #Profile1 descendant selector.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/bloggerimageprofile2.jpg" alt="Blogger Profile Image" /&gt;&lt;br /&gt;&lt;br /&gt;Blogger Instructions: To make this change in Blogger, update the CSS from DESIGN &gt; Edit HTML tab.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-2422119200736588313?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/2422119200736588313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/blogger-profile-pictures-and-excuse-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2422119200736588313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/2422119200736588313'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/blogger-profile-pictures-and-excuse-me.html' title='Blogger Profile Pictures and &quot;Excuse me, Have You Seen a Chicken?&quot;'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4002859209629368217</id><published>2010-11-08T00:41:00.000-08:00</published><updated>2011-01-06T12:46:37.823-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Website Design'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>My Web Development Toolkit</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#webdevjpg').cssBakeryCaption({'opacity':'0.5','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='webdevjpg' style='display:none;' src='http://pics.cssbakery.com/pics/webdev.jpg' alt='list of things that ive been using for development&amp;lt;br&amp;gt;[google maps == google maps API]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;List of things that I've been using for development.  Google Maps == Google Maps API.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4002859209629368217?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4002859209629368217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/necessary-attributes-of-web-developer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4002859209629368217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4002859209629368217'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/necessary-attributes-of-web-developer.html' title='My Web Development Toolkit'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4864274131879493933</id><published>2010-11-07T22:55:00.000-08:00</published><updated>2010-11-08T10:22:49.659-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CEO'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Tech CEOs</title><content type='html'>The person who wrote this article asks if tech CEOs are expected to be young in the era of Facebook.  Here's &lt;a href="http://www.cnn.com/2010/TECH/innovation/11/02/seth.priebatsch.scvngr/index.html?hpt=C1"&gt;someone&lt;/a&gt; with no technical background who hired programmers from overseas and made some money with a smart phone app.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-4864274131879493933?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/4864274131879493933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/tech-ceos.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4864274131879493933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/4864274131879493933'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/tech-ceos.html' title='Tech CEOs'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-1545579343123568406</id><published>2010-11-04T09:04:00.000-07:00</published><updated>2010-11-05T20:38:44.739-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='background-repeat'/><category scheme='http://www.blogger.com/atom/ns#' term='width'/><category scheme='http://www.blogger.com/atom/ns#' term='Padding and Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='Auto Margins'/><category scheme='http://www.blogger.com/atom/ns#' term='line-height'/><category scheme='http://www.blogger.com/atom/ns#' term='ID'/><category scheme='http://www.blogger.com/atom/ns#' term='background'/><category scheme='http://www.blogger.com/atom/ns#' term='Centering Images'/><title type='text'>How to Center an Image with CSS</title><content type='html'>Thanks for putting up with &lt;a href="http://www.youtube.com/watch?v=44mqiBrB0zI"&gt;this&lt;/a&gt; for a few days.   I took the election music and the flags down.  Glad to see &lt;a href="http://www.jerrybrown.org/Bio03022010"&gt;Jerry Brown&lt;/a&gt; win in California - he's a cool guy.   Before we throw away the decorations,  I want to show you a CSS technique for centering an image like the flags I had hanging from the top of the browser window for the elections.  I tried it two different ways.&lt;br /&gt;&lt;br /&gt;First time I repeated the image across the top which only takes a height and background statement that repeats horizontally. You have to specify height for divs that do not have content.  A background image will collapse without content and you will see nothing on screen. &lt;br /&gt;&lt;br /&gt;#special_events {&lt;br /&gt;background: url(images/flagcascades2.jpg) 0 0 repeat-x;&lt;br /&gt;height: 85px; &lt;br /&gt;}&lt;br /&gt;&amp;lt;div id='special_events'/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="border-bottom: 1px dotted grey;" src="http://pics.cssbakery.com/pics/flagint2.jpg" alt="background with repeat-x" /&gt;&lt;br /&gt;&lt;br /&gt;This looked fine and a lot of people will be pleased with it but it was too busy for my taste.   I decided to place a single image over the main content that moved with the middle column.   In order to make this work correctly, you have to do two things.  &lt;br /&gt;&lt;br /&gt;When the browser window resizes in order to flow the flag with the main content,  we have to auto margin the left and right margins. But for that to work, the browser needs to know the width of your element.  Then based on that width, it will center the div with the &lt;i&gt;margin: 0 auto;&lt;/i&gt; statement.  If you don't give the div an explicit width, it'll take the full width of the browser because it's a block element and block elements expand horizontally all the way across their containing block.  Doing "margin: 0 auto;" won't have any effect in that situation since the div goes all the way across.&lt;br /&gt;&lt;br /&gt;To rewrite &lt;i&gt;special_events&lt;/i&gt;, we will give the div a width equal to its background image and take the horizontal repeat out of the background rule.&lt;br /&gt;&lt;br /&gt;#special_events {&lt;br /&gt;background: url(images/flagcascades2.jpg) 0 0 no-repeat;&lt;br /&gt;height: 85px; &lt;br /&gt;&lt;br /&gt;/* to center it as the browser window resizes */&lt;br /&gt;width: 872px;  &lt;br /&gt;margin: 0 auto; }&lt;br /&gt;}&lt;br /&gt;&amp;lt;div id='special_events'/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="border-bottom: 1px dotted black;"src="http://pics.cssbakery.com/pics/newflag.jpg" alt="background with no-repeat" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-1545579343123568406?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/1545579343123568406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/11/how-to-center-image-with-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1545579343123568406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/1545579343123568406'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/11/how-to-center-image-with-css.html' title='How to Center an Image with CSS'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8132337623764344921</id><published>2010-10-31T16:58:00.000-07:00</published><updated>2012-01-15T21:38:46.545-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='I&apos;m not a witch'/><category scheme='http://www.blogger.com/atom/ns#' term='Float'/><category scheme='http://www.blogger.com/atom/ns#' term='3 Column Layout'/><title type='text'>Fastbreak: Restructuring PHP for Reuse</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#fastbreakjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;img id='fastbreakjpg' style='display:none;' src='http://pics.cssbakery.com/pics/fastbreak3.jpg' alt='A Reflection in the Water&amp;lt;br&amp;gt;[fastbreak is a ballgame term where 1 or 2 players outrun the defense]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;I don't like mixing politics with my site but a strong commitment to secular government being at the core of who I am, I could not resist the &lt;a href="http://www.youtube.com/watch?v=44mqiBrB0zI"&gt;musical spoof&lt;/a&gt; on the constitutionally &lt;a href="http://latimesblogs.latimes.com/washington/2010/10/christine-odonnell-threatens-to-sue-radio-station.html"&gt;confused&lt;/a&gt; Delaware Senate candidate Christine O'Donnell.  She will sing "&lt;i&gt;I'm not a witch, I'm you, you, you&lt;/i&gt;" in &lt;a href="http://www.youtube.com/watch?v=tGGAgljengs"&gt;her own voice and words&lt;/a&gt; until the end of elections.  The &lt;a href="http://www.youtube.com/watch?feature=iv&amp;annotation_id=annotation_966464&amp;v=mpcTtRHeAJI"&gt;cover&lt;/a&gt; is just as good.  Good luck, Delaware! :-)&lt;br /&gt;&lt;br /&gt;Having promised myself and you a post a day in October, I have some catching up to do on this Halloween day.  We'll go back to the PHP code that we were working on for the mail order company mimicking the &lt;a href="http://www.jcrew.com/womens_category/shoes/evening/PRDOVR~28647/28647.jsp"&gt;J.Crew&lt;/a&gt; site.  I'll keep posting under this title as I get chunks of the code finished.&lt;br /&gt;&lt;br /&gt;To make this example more like a real online shopping site I've designed a three column layout, and a menu that will be common to all the pages of the site.  In the layout, only the middle column content will change from page to page.  We want to accomplish this without having to duplicate site content in multiple files.  There are many ways to do this in PHP.  I'll take a simple approach of just factoring out all the common parts into separate files, which will then be included in various files that are specific to the middle column content.&lt;br /&gt;&lt;br /&gt;Here's a picture of what the file structure will look like:&lt;br /&gt;&lt;br /&gt;&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#mailorderjpg').cssBakeryCaption({'opacity':'0.9','center':true,'centerCaption':true,'round':true,'hide':true,'color':'black','bgcolor':'yellow'});});&lt;/script&gt;&lt;img id='mailorderjpg' style='display:none;' src='http://pics.cssbakery.com/pics/mailorder.jpg' alt='Evolution of the HTML into PHP&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pics.cssbakery.com/pics/headerphp.txt"&gt;header.php&lt;/a&gt; holds one piece of common code.  This is where we put the menu that goes into column one of every page.  The other common code goes into &lt;a href="http://pics.cssbakery.com/pics/footerphp.txt"&gt;footer.php&lt;/a&gt;.  Here we have some common Javascript along with the actual footer content which lists some common site links.&lt;br /&gt;&lt;br /&gt;The files showitems.php, and shoes_complete.php will each provide unique content for the middle column.  In &lt;a href="http://pics.cssbakery.com/pics/showitemsphp.txt"&gt;showitems.php&lt;/a&gt; this will be a list of all the products in the database (i.e. all shoes listed, with a clickable link to get more detail on a specific shoe).  &lt;a href="http://pics.cssbakery.com/pics/shoes_completephp.txt"&gt;shoes_complete.php&lt;/a&gt; will show details on a single shoe, given the shoe's item number, passed as a parameter in the URL.  &lt;br /&gt;&lt;br /&gt;So now, with the addition of showitems.php you no longer have to type in a URL with an item number to see the details of particular shoe.  Instead, the code in showitems.php generates hyperlinks with the complete URL already filled in with the itemnumber for the corresponding shoe.  When you click the link, the item number is passed to shoes_complete.php in the query parameter portion of the URL.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;In this post I want to extend the previous PHP/MySQL examples, by generating a page that shows a &lt;a href="http://www.topossibilities.com/mailorder_fr1/showitems.php"&gt;list of all the shoes&lt;/a&gt; in the database.  This will include a small image of the shoe, the price, and the name of the shoe with a hyperlink to get more detail for ordering the shoe.  &lt;br /&gt;&lt;br /&gt;With a small change to the MySQL queries from previous posts, we can get all records from the shoe_primary_data table (before we were getting only a specific record via the where clause like this: where itemnum='$itemnum').  Here, we simply leave the where clause off of the query, and the database will default to returning all records:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;// make a connection to the mysql database server&lt;br /&gt;$db = mysqli_connect("womenshoes.db.6787492.hostedresource.com","womenshoes",&lt;br /&gt;"thisIsyourPassword", "womenshoes");&lt;br /&gt;if ($db) {&lt;br /&gt;  //SHOE_PRIMARY_DATA TABLE&lt;br /&gt;  //building a query string to send to the database, this will be the search string&lt;br /&gt;  //Give me all the records, with all the fields (star) from the shoe_primary_data table &lt;br /&gt;  $query = "SELECT * FROM shoe_primary_data";&lt;/pre&gt;&lt;br /&gt;Now that we've got all records from shoe_primary_data, we will loop through them and generate a HTML list of items, like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;div id="container"&amp;gt;&lt;br /&gt;  &amp;lt;ul id="shoeList"&amp;gt;&lt;br /&gt;    &amp;lt;?php while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)): ?&amp;gt;&lt;br /&gt;      &amp;lt;li&amp;gt;&lt;br /&gt;        &amp;lt;div&amp;gt;&lt;br /&gt;          &amp;lt;img style="width:80px;" src="&amp;lt;?=$row['imagepath']?&amp;gt;"&amp;gt;&lt;br /&gt;          &amp;lt;div&amp;gt;&amp;lt;a href="shoes_complete.php?itemnum=&amp;lt;?=$row['itemnum']?&amp;gt;"&amp;gt;&lt;br /&gt;          &amp;lt;?=$row['itemname']?&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;          &amp;lt;div&amp;gt;&amp;lt;?php printf("$%01.2f",$row['price'])?&amp;gt;&lt;br /&gt;          &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;      &amp;lt;/li&amp;gt;  &lt;br /&gt;    &amp;lt;?php endwhile; ?&amp;gt;&lt;br /&gt;  &amp;lt;/ul&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;br /&gt;What we have here is snippets of PHP interspersed with HTML.  The PHP in this case, loops through all the records retrieved from the query, pulling each record into an associative array.  For each record we generate a list, where each item in the list contains: (a) a small image of the product, (b) the name of the product as a hyperlink that takes you to more detail on the product, and (c) the price of the product.&lt;br /&gt;&lt;br /&gt;The main thing to notice from this code is the structure of the while loop, where the call to mysqli_fetch_array() returns a result into the $row variable.  If there are no more records mysqli_fetch_array returns false, and we drop out of the loop.  Otherwise, we have the associative array for the current record sitting in the $row variable.&lt;br /&gt;&lt;br /&gt;The rest is straightforward HTML.  To style the resulting list we use the following CSS:&lt;br /&gt;&lt;pre class='Blue'&gt;/* force vertical scroll bar to eliminate layout 'jumps' between pages */&lt;br /&gt;html {&lt;br /&gt;  overflow-y: scroll;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;#container {&lt;br /&gt;  width: 620px;&lt;br /&gt;  /*padding-bottom: 400px;*/&lt;br /&gt;}&lt;br /&gt;#container ul li {&lt;br /&gt;  display: block;&lt;br /&gt;  padding-left: 10px;&lt;br /&gt;  width: 8em;&lt;br /&gt;  text-align: center;&lt;br /&gt;  float: left;&lt;br /&gt;  list-style-type: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#container ul li img  {&lt;br /&gt;  display: block;&lt;br /&gt;  float: none;&lt;br /&gt;  list-style-type: none;&lt;br /&gt;  margin: 5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#container ul li div {&lt;br /&gt;  margin: 10px;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/shiningkeys.jpg" alt="" title="" /&gt;&lt;h4&gt;MySQL/PHP Database Series&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/fastbreak-restructuring-php-for-reuse.html"&gt;Fastbreak: Restructuring PHP for Reuse&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html"&gt;Passing a Query Parameter to PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/looping-through-multiple-records-with.html"&gt;Looping through Multiple Records with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/reading-database-from-php.html"&gt;Reading the Database from PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-with-php.html"&gt;Creating MySQL Tables with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;Creating MySQL Tables and Inserting Records with phpMyAdmin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;MySQL Tonight - Creating the Database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/php-i-think.html"&gt;PHP Example with GoDaddy&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8132337623764344921?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8132337623764344921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/fastbreak-restructuring-php-for-reuse.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8132337623764344921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8132337623764344921'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/fastbreak-restructuring-php-for-reuse.html' title='Fastbreak: Restructuring PHP for Reuse'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-3862930493815658334</id><published>2010-10-26T10:20:00.000-07:00</published><updated>2010-10-26T13:31:16.610-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Websites'/><category scheme='http://www.blogger.com/atom/ns#' term='Flash'/><title type='text'>A Flash Example: Functional and Good Looking Web Pages</title><content type='html'>A very nicely done &lt;a href="http://transparency.org/policy_research/surveys_indices/cpi/2010/results"&gt;Flash application&lt;/a&gt; showing the worldwide corruption indices for 2010.  The organization behind this work is called Transparency International - a Global Coalition against corruption.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-3862930493815658334?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/3862930493815658334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/flash-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3862930493815658334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/3862930493815658334'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/flash-example.html' title='A Flash Example: Functional and Good Looking Web Pages'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-6851796434598598096</id><published>2010-10-25T19:52:00.000-07:00</published><updated>2011-05-05T12:25:42.950-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fonts and Text'/><category scheme='http://www.blogger.com/atom/ns#' term='Cufon'/><title type='text'>Multiple Fonts with Cufon</title><content type='html'>Warm and windy day, the water was delicious. &lt;br /&gt;&lt;br /&gt;To replace one font with Cufon generated font:&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript" src="js/cufon-yui.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/Eras_Light_ITC_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;  Cufon.replace('h1');&lt;br /&gt;&amp;lt;/script&amp;gt;  &lt;/pre&gt;&lt;br /&gt;This code replaces all h1's to a Cufon generated Eras Light.&lt;br /&gt;&lt;br /&gt;To replace multiple fonts with Cufon the syntax changes because we have tell the Cufon script that's running in the browser (cufon-yui.js file) which font family to use.  I am going to convert my h1's to Eras Light and h2's to Eras Demi so:  &lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript" src="js/cufon-yui.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/Eras_Light_ITC_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/Eras_Demi_ITC_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;  Cufon.replace('h1',{fontFamily: 'Eras Light ITC'} );&lt;br /&gt;  Cufon.replace('h2',{fontFamily: 'Eras Demi ITC'} );&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If you don't specify which font to use for whom then you will be writing over everything else that comes before you.  Eras Demi will be wiping out the Eras Light for example.&lt;br /&gt;&lt;br /&gt;This may change in the future but for awhile now, I've using Cufon generated titles in this blog.  The title of this post "Multiple Fonts with Cufon" is an example. &lt;br /&gt;&lt;br /&gt;Cufon site also recommends the following to fix an IE glitch.  I had tried and not seen much difference with this.  It goes right before the ending body tag:&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript"&amp;gt; Cufon.now(); &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;WITH MORE THAN 2 FONTS&lt;/h1&gt;&lt;br /&gt;Let's try three fonts for testing.  First I converted a couple of additional font files using the Cufon Generator, then I setup Cufon on my page like this:&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript" src="js/cufon-yui.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/vegur_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/Calibri_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/Book_Antiqua_italic_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;Then I applied three different fonts to elements of my page, like this:&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;  Cufon.replace('.cufon, h2',{fontFamily: 'vegur'} );&lt;br /&gt;  Cufon.replace('.dtreviewed',{fontFamily: 'Book Antiqua'} );&lt;br /&gt;  Cufon.replace('.author-name',{fontFamily: 'Calibri'} );&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;It works fine.  If you are having trouble with using more than two, I would bring up Firebug, go to Console, and reload the page just to make sure you don't have a Javascript error somewhere.&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/a13a.jpg" alt="" title="" /&gt;&lt;h4&gt;CUFON&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2011/05/cufon-multiple-fonts-using-same-font.html"&gt;Cufon with Same Font Family/Different Weight&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html"&gt;Multiple Fonts with Cufon&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/using-cufon.html"&gt;How to Generate Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt;Cufon Flash of Unstyled Content&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Information on Cufon Based Text&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-6851796434598598096?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/6851796434598598096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6851796434598598096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6851796434598598096'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/multiple-fonts-with-cufon.html' title='Multiple Fonts with Cufon'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7410826931826857506</id><published>2010-10-24T10:33:00.000-07:00</published><updated>2010-10-24T20:42:16.429-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fonts and Text'/><category scheme='http://www.blogger.com/atom/ns#' term='font-face'/><category scheme='http://www.blogger.com/atom/ns#' term='font-style'/><category scheme='http://www.blogger.com/atom/ns#' term='Cufon'/><title type='text'>Using Cufon</title><content type='html'>Here's how to get started with Cufon fast:&lt;br /&gt;&lt;br /&gt;Step 1: Go to the Cufon generator at:  &lt;a href="http://cufon.shoqolate.com/generate/"&gt;http://cufon.shoqolate.com/generate/&lt;/a&gt;  Fill out the form and hit the "Lets do This!" button.  You will have to choose a font off your disk.  Typically your fonts will be under Windows&gt;Fonts on a PC however Windows does not allow you to open a font file from the dialog box so you need to copy the font that you want to another directory (Don't just drag the file, press Control key to make a second copy).  &lt;br /&gt;&lt;br /&gt;Step 2:  The generator will produce a javascript file (My filename was Eras_Light_ITC_400.font for the Eras Light fontface) Save this file, and also download the Cufon javascript library, which  you can get by hitting the "Download" button at the top of the page.  &lt;br /&gt;&lt;br /&gt;When you click the button, it'll load the Javascript into your browser window.  From the File menu on your browser, just hit File&gt;Save As.  cufon-yi.js is your second Javascript file.&lt;br /&gt;&lt;br /&gt;Step 3:  Upload both of the javascript files to your web server.  You might want to create a subdirectory called js.&lt;br /&gt;&lt;br /&gt;Step 4:  In your HTML, link in both files, like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript" src="js/cufon-yui.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="js/vegur_400.font.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;Step 5:  Next, you need to tell Cufon which text you want it to replace.  You do this through a selector that you pass to the Cufon replace method.  For example, you can replace all h2 headers like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;  Cufon.replace('h2');&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's a simple example, but the string you pass to Cufon.replace() can be a more complex selector.&lt;br /&gt;&lt;br /&gt;Step 6: If you notice your text jumping around, you might want to look at this post about stopping the&lt;a href="http://www.cssbakery.com/2010/08/stopping-cufon-flash-of-unstyled-text.html"&gt; Cufon Flash of Unstyled Content&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We also have this &lt;a href="http://www.cssbakery.com/2010/05/cufon-in-titles.html"&gt;Cufon related post&lt;/a&gt; in the archives.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7410826931826857506?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7410826931826857506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/using-cufon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7410826931826857506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7410826931826857506'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/using-cufon.html' title='Using Cufon'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8173281043512465451</id><published>2010-10-22T05:57:00.000-07:00</published><updated>2010-10-23T16:05:49.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Photoshop'/><category scheme='http://www.blogger.com/atom/ns#' term='Inserting Records into Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Barrel Distortion'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><category scheme='http://www.blogger.com/atom/ns#' term='Relational Database'/><title type='text'>Passing a Query Parameter to PHP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#PHPQueryjpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='PHPQueryjpg' style='display:none;' src='http://pics.cssbakery.com/pics/PHPQuery.jpg' alt='This image looked blue on one screen and warmer on another. Has very slight barrel distortion which I left alone.&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;No sign of the fun dolphin that I met the other day but was a beautiful early morning with a lot of clouds reflecting off the water.  Air felt perfect, not too warm, not too cool.  &lt;br /&gt;&lt;br /&gt;You and I were still working on the PHP/Database mini project.  Our database, named shoes, had two tables.  First one more generic information about a particular type of shoe and the second table listed each shoe item with its size, color, width, and how many there are in the inventory.  Today I want to add a new class of shoes to our database and then query it via the URL to display two different items from the database.  Let's add a new shoe to shoe_primary_data table via phpMyAdmin.  The master table will now show "Birkenstock Arizona Sandals" in addition to the "Strappy Evening Shoes".  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/phpMyAdmin2.jpg" alt="phpMyAdmin Insert" /&gt;&lt;br /&gt;&lt;br /&gt;The Arizonas have an item number of 12000.  Using that number, I inserted new records into "shoe_secondary_data" table for different sizes and colors for the new sandals.  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/phpMyAdmin1.jpg" alt="phpMyAdmin Insert" /&gt;&lt;br /&gt;&lt;br /&gt;Browsing the shoe secondary table:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/phpMyAdmin3.jpg" alt="phpMyAdmin Insert" /&gt;&lt;br /&gt;&lt;br /&gt;Here's how our PHP file going to change.  All of my explanations are within comments in the program:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;//&lt;br /&gt;// In URLs anything to the right of a question mark is called the query string.&lt;br /&gt;// That's the place where you can plug in certain values that act like parameters&lt;br /&gt;// to the page. In the query string if you have multiple parameters, they must&lt;br /&gt;// be separated by ampersands (&amp;).  So passing someones age and first name in a &lt;br /&gt;// query string would look like http://www.example.com?age=12&amp;name=Joe&lt;br /&gt;//&lt;br /&gt;// When your browser goes to a URL that includes such a query string - whether by &lt;br /&gt;// clicking a link, or manually entering it - the server side software can look&lt;br /&gt;// at the values you passed in the query string to decide what to do.&lt;br /&gt;//&lt;br /&gt;// In the case of a PHP web application, the PHP interpreter will read the query&lt;br /&gt;// string and where it finds name value pairs such as age=12 name=Joe, it will&lt;br /&gt;// copy these into a "Super Global" array variable called $_GET.  Your program&lt;br /&gt;// can then access these values by indexing into the array, using the parameter&lt;br /&gt;// name as the key, like this:  $_GET['age'], or $_GET['name'].&lt;br /&gt;//&lt;br /&gt;// In our case we are passsing in the item number of a shoe, and we'll use &lt;br /&gt;// it to look up the item in our database.&lt;br /&gt;//&lt;br /&gt;// URL to go to), all the parts of the URL to the right &lt;br /&gt;$itemnumber=$_GET["itemnum"];&lt;br /&gt;&lt;br /&gt;// make a connection to the mysql database server&lt;br /&gt;$db = mysqli_connect("womenshoes.db.6787492.hostedresource.com",&lt;br /&gt;"womenshoes", "yourpasswordtothedatabase", "womenshoes");&lt;br /&gt;if ($db) {&lt;br /&gt;  //SHOE_PRIMARY_DATA TABLE&lt;br /&gt;  //building a query string to send to the database, this will be the search string&lt;br /&gt;  //Give me all the fields (star) from the shoe_primary_data table &lt;br /&gt;  //that have an item number of itemnum&lt;br /&gt;  $query = "SELECT * FROM shoe_primary_data WHERE itemnum='$itemnumber' ";&lt;br /&gt;&lt;br /&gt;  //executes the search in the database using our query that we built&lt;br /&gt;  //result object holds the results of the query&lt;br /&gt;  //this query gives us the records for the  first table (shoe_primary_data)&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo " ";     &lt;br /&gt;  }&lt;br /&gt;  else die('Problem querying a database');&lt;br /&gt;&lt;br /&gt; //SHOE_SECONDARY_DATA&lt;br /&gt; //building a query string to send to the database, this will be the search string&lt;br /&gt;  //Give me all the fields (star) from the shoe_secondary_data table &lt;br /&gt;  //that have an item number of itemnum&lt;br /&gt;  $query = "SELECT * FROM shoe_secondary_data WHERE itemnum='$itemnumber' ";&lt;br /&gt;&lt;br /&gt;  //executes the search in the database using our query that we built&lt;br /&gt;  //result object holds the results of the query&lt;br /&gt;  //this query gives us the records for the  secondary table (shoe_secondary_data)&lt;br /&gt;  $result2 = mysqli_query($db, $query);&lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;To run, enter from the URL either:&lt;br /&gt;&lt;br /&gt;http://topossibilities.com/mailorder/mailorder.php?itemnum=12000&lt;br /&gt;&lt;br /&gt;or &lt;br /&gt;&lt;br /&gt;http://topossibilities.com/mailorder/mailorder.php?itemnum=10100&lt;br /&gt;&lt;br /&gt;So far we have a page that can display different types of shoes, but you have to enter the different item numbers in the URL each time.  So for the next post, we'll add another page that lists all the different types of shoes in the database.  When you click on a shoe from this list, it will bring up the details page that we already have.  That's the next post.&lt;br /&gt;&lt;br /&gt;Photoshop Note: In the image caption, I mentioned the barrel distortion phenomenon.  This is when your image looks rounded or bloated.  To correct barrel distortion in Photoshop, from Filter&gt;Lens Correction Filter&gt;Distort, drag the distortion slider slowly to the right.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/shiningkeys.jpg" alt="" title="" /&gt;&lt;h4&gt;MySQL/PHP Database Series&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html"&gt;Passing a Query Parameter to PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/looping-through-multiple-records-with.html"&gt;Looping through Multiple Records with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/reading-database-from-php.html"&gt;Reading the Database from PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-with-php.html"&gt;Creating MySQL Tables with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;Creating MySQL Tables and Inserting Records with phpMyAdmin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;MySQL Tonight - Creating the Database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/php-i-think.html"&gt;PHP Example with GoDaddy&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8173281043512465451?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8173281043512465451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8173281043512465451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8173281043512465451'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html' title='Passing a Query Parameter to PHP'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-388231332819230362</id><published>2010-10-21T09:57:00.001-07:00</published><updated>2010-10-23T10:12:11.149-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Godaddy'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><category scheme='http://www.blogger.com/atom/ns#' term='Relational Database'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Looping through Multiple MySQL Records with PHP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#secretgardenjpg').cssBakeryCaption({'opacity':'0.3','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='secretgardenjpg' style='display:none;' src='http://pics.cssbakery.com/pics/secretgarden.jpg' alt='Secret Garden&amp;lt;br&amp;gt; [a rainy day]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;Back to Godaddy to add a record to our database table, shoe_secondary_data.  There are several ways to add the new record.  I tried the phpMyAdmin interface where you fill in the blanks from their insert function.  Same item number for the strappy Jimmy Choo shoes, size 7W in gold of which we have 3 in our inventory. Leave the first field empty (NULL), it's self incrementing :&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/shoes2.jpg" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;When you hit return, the system formulates a MySQL query and updates the database with your changes (the color should be gold here):&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/shoes3.jpg" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;Browsing our shoe_secondary_data table contents:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/shoes1.jpg" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;So given that database table, we are now going to update the hardcoded HTML in our PHP file by pulling in the data from shoes_secondary_data.  I commented all the steps I took in the program so it should be easy to follow.  I could have deleted the HTML but kept it so that you can compare the old and the new:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;?php&lt;br /&gt; //SHOE_SECONDARY_DATA&lt;br /&gt; //building a query string to send to the database, this will be the search string&lt;br /&gt;  //Give me all the fields (star) from the shoe_secondary_data table that have &lt;br /&gt;  //an item number of 10100&lt;br /&gt;  $query = "SELECT * FROM shoe_secondary_data WHERE itemnum='10100' ";&lt;br /&gt;&lt;br /&gt;  //executes the search in the database using our query that we built&lt;br /&gt;  //result object holds the results of the query&lt;br /&gt;  //this query gives us the records for the  secondary table (shoe_secondary_data)&lt;br /&gt;  $result2 = mysqli_query($db, $query);&lt;br /&gt;  if ($result2) {&lt;br /&gt;     echo "You know how talk to a database";     &lt;br /&gt;  }&lt;br /&gt;  else die('You dont know how to query a database');&lt;br /&gt;&lt;br /&gt;/* We are going to loop through the shoe_secondary_data results and construct&lt;br /&gt;   an array of arrays which you can think of as the set of records returned from &lt;br /&gt;   the database&lt;br /&gt;*/   &lt;br /&gt;$count=mysqli_num_rows($result2);&lt;br /&gt;$nested_array=array();&lt;br /&gt;for ($i=0; $i&amp;lt;$count; $i++) {&lt;br /&gt;   //empty brackets means append to the array&lt;br /&gt;   $nested_array[]=mysqli_fetch_array($result2, MYSQLI_ASSOC);&lt;br /&gt;}&lt;br /&gt;//debugging &lt;br /&gt;print_r($nested_array);&lt;br /&gt;&lt;br /&gt;// Create an array for each Drop Down Select box:&lt;br /&gt;$size_array = array();&lt;br /&gt;$width_array = array();&lt;br /&gt;$color_array = array();&lt;br /&gt;// Now loop through the records and construct the size, width,&lt;br /&gt;// and color arrays.&lt;br /&gt;foreach($nested_array as $rec) {&lt;br /&gt;  // Get the values from this record:&lt;br /&gt;  $size = $rec['size'];&lt;br /&gt;  $width = $rec['width'];&lt;br /&gt;  $color = $rec['color'];&lt;br /&gt;  // We use PHP associative arrays to create unique lists of values. &lt;br /&gt;  // &lt;br /&gt;  // Here's how this works for "size" for example: we may have many records &lt;br /&gt;  // that have size 6, but we only want one "6" in the size_array.  We &lt;br /&gt;  // accomplish that by using $size as the key into the array.  &lt;br /&gt;  // &lt;br /&gt;  // So when we encounter the first record with a 6, we index into the array with&lt;br /&gt;  // a key of 6, thus creating a new entry in the array: $size_array[6], and&lt;br /&gt;  // we set the value of that entry to 6.  Now when we see another record that&lt;br /&gt;  // also has size 6, we again index into the array using a key of 6 &lt;br /&gt;  // ($size_array[6]) and set the value again to 6 (so we overwrite value 6&lt;br /&gt;  // with 6, so it really doesn't change).&lt;br /&gt;  // &lt;br /&gt;  $size_array[$size] = $size;&lt;br /&gt;  $width_array[$width] = $width;&lt;br /&gt;  $color_array[$color] = $color;&lt;br /&gt;}&lt;br /&gt;//debugging &lt;br /&gt;print_r($size_array);&lt;br /&gt;print_r($width_array);&lt;br /&gt;print_r($color_array);&lt;br /&gt;&lt;br /&gt;&amp;lt;form action="cbmailorder.php" method="post"&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;select size&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- Loop through all sizes, generating an option tag for each one. --&amp;gt;&lt;br /&gt;   &amp;lt;select name="size"&amp;gt; &lt;br /&gt;&amp;lt;?php foreach($size_array as $size) {&lt;br /&gt;        echo "&amp;lt;option value='$size'&amp;gt;$size&amp;lt;/option&amp;gt;\n";&lt;br /&gt;      }&lt;br /&gt;?&amp;gt;&lt;br /&gt;&amp;lt;!-- HTML here just got replaced above by PHP/no longer hardcoded&lt;br /&gt;&amp;lt;option value="5 H"&amp;gt;5 H&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="6"&amp;gt;6&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="6 H"&amp;gt;6 H&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="7" selected="1"&amp;gt;7&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="7 H"&amp;gt;7 H&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="8"&amp;gt;8&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="8 H"&amp;gt;8 H&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="9"&amp;gt;9&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="9 H"&amp;gt;9 H&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="10"&amp;gt;10&amp;lt;/option&amp;gt; &lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p&amp;gt;select width   &amp;lt;select name="width"&amp;gt; &lt;br /&gt;&amp;lt;!-- Loop through all widths, generating an option tag for each one. --&amp;gt;&lt;br /&gt;&amp;lt;?php foreach($width_array as $width) {&lt;br /&gt;        echo "&amp;lt;option value='$width'&amp;gt;$width&amp;lt;/option&amp;gt;\n";&lt;br /&gt;      }&lt;br /&gt;?&amp;gt;&lt;br /&gt;&amp;lt;!-- HTML for the width got replaced by PHP statements above&lt;br /&gt;&amp;lt;option value="N"&amp;gt;N&amp;lt;/option&amp;gt; &amp;lt;option value="B" selected="1"&lt;br /&gt;&amp;gt;B&amp;lt;/option&amp;gt; &amp;lt;option value="W"&amp;gt;W&amp;lt;/option&amp;gt; &lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p&amp;gt;select color&amp;lt;select name="color"&amp;gt; &lt;br /&gt;&amp;lt;!-- Loop through all colors, generating an option tag for each one. --&amp;gt;&lt;br /&gt;&amp;lt;?php foreach($color_array as $color) {&lt;br /&gt;        echo "&amp;lt;option value='$color'&amp;gt;$color&amp;lt;/option&amp;gt;\n";&lt;br /&gt;      }&lt;br /&gt;?&amp;gt; &lt;br /&gt;&amp;lt;!--  HTML for the colors got replaced by PHP statements above&lt;br /&gt;&amp;lt;option value="gold"&amp;gt;gold&amp;lt;/option&amp;gt; &amp;lt;option value="platinum" selected="1"&amp;gt;platinum&amp;lt;/option&amp;gt; &lt;br /&gt;&amp;lt;option value="black suede"&amp;gt;black suede&amp;lt;/option&amp;gt; &amp;lt;option value="navy suede"&amp;gt;navy&amp;lt;/option&amp;gt; &lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&amp;lt;/p&amp;gt;  &lt;br /&gt;?&amp;gt;  &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;PHP DEBUG: print_r($nested_array);&lt;/h1&gt;&lt;br /&gt;A look at the $nested_array contents put together in the for loop.  This view comes from View&gt;Page Source rather than the direct output of print_r($nested_array); which is not formatted.&lt;br /&gt;&lt;br /&gt;Array&lt;br /&gt;(&lt;br /&gt;[0] =&gt; Array&lt;br /&gt;(&lt;br /&gt;[id] =&gt; 1&lt;br /&gt;[itemnum] =&gt; 10100&lt;br /&gt;[size] =&gt; 7&lt;br /&gt;[width] =&gt; M&lt;br /&gt;[color] =&gt; platinum&lt;br /&gt;[inventory] =&gt; 7&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;[1] =&gt; Array&lt;br /&gt;(&lt;br /&gt;[id] =&gt; 2&lt;br /&gt;[itemnum] =&gt; 10100&lt;br /&gt;[size] =&gt; 6 1/2&lt;br /&gt;[width] =&gt; M&lt;br /&gt;[color] =&gt; black suede&lt;br /&gt;[inventory] =&gt; 5&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;[2] =&gt; Array&lt;br /&gt;(&lt;br /&gt;[id] =&gt; 3&lt;br /&gt;[itemnum] =&gt; 10100&lt;br /&gt;[size] =&gt; 7&lt;br /&gt;[width] =&gt; W&lt;br /&gt;[color] =&gt; platinum&lt;br /&gt;[inventory] =&gt; 4&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;[3] =&gt; Array&lt;br /&gt;(&lt;br /&gt;[id] =&gt; 4&lt;br /&gt;[itemnum] =&gt; 10100&lt;br /&gt;[size] =&gt; 8&lt;br /&gt;[width] =&gt; M&lt;br /&gt;[color] =&gt; navy suede&lt;br /&gt;[inventory] =&gt; 2&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;[4] =&gt; Array&lt;br /&gt;(&lt;br /&gt;[id] =&gt; 5&lt;br /&gt;[itemnum] =&gt; 10100&lt;br /&gt;[size] =&gt; 7&lt;br /&gt;[width] =&gt; W&lt;br /&gt;[color] =&gt; Gold&lt;br /&gt;[inventory] =&gt; 3&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;Our &lt;a href="http://pics.cssbakery.com/pics/mailorder4.php.htm"&gt;PHP file&lt;/a&gt; which has replaced the  &lt;a href="http://topossibilities.com/mailorder/mailorder.html"&gt;original HTML&lt;/a&gt; is almost done. Try the pull down fields to see the differences between the two different versions.&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/shiningkeys.jpg" alt="" title="" /&gt;&lt;h4&gt;MySQL/PHP Database Series&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html"&gt;Passing a Query Parameter to PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/looping-through-multiple-records-with.html"&gt;Looping through Multiple Records with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/reading-database-from-php.html"&gt;Reading the Database from PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-with-php.html"&gt;Creating MySQL Tables with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;Creating MySQL Tables and Inserting Records with phpMyAdmin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;MySQL Tonight - Creating the Database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/php-i-think.html"&gt;PHP Example with GoDaddy&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-388231332819230362?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/388231332819230362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/looping-through-multiple-mysql-records.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/388231332819230362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/388231332819230362'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/looping-through-multiple-mysql-records.html' title='Looping through Multiple MySQL Records with PHP'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-7695551450778643996</id><published>2010-10-19T21:26:00.000-07:00</published><updated>2011-01-03T00:57:08.180-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Life'/><title type='text'>This Evening</title><content type='html'>&lt;script src="http://pics.cssbakery.com/fp/flowplayer-3.2.4.min.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;a  href="http://pics.cssbakery.com/video/rain.flv"style="display:block;width:550px;height:412px;"id="rainplayer"&gt;&lt;/a&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt; $(document).ready(function() {flowplayer("rainplayer", "http://pics.cssbakery.com/fp/flowplayer-3.2.5.swf");});&lt;/script&gt;&lt;br /&gt;Started pouring down just as I was about to finish my walk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-7695551450778643996?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/7695551450778643996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/rain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7695551450778643996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/7695551450778643996'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/rain.html' title='This Evening'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-6278546541696404607</id><published>2010-10-18T18:12:00.000-07:00</published><updated>2010-10-19T09:56:43.734-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Relative Positioning'/><category scheme='http://www.blogger.com/atom/ns#' term='top'/><category scheme='http://www.blogger.com/atom/ns#' term='The Flow'/><category scheme='http://www.blogger.com/atom/ns#' term='RSS'/><category scheme='http://www.blogger.com/atom/ns#' term='Image Captioning Tool'/><category scheme='http://www.blogger.com/atom/ns#' term='Twitter'/><category scheme='http://www.blogger.com/atom/ns#' term='left'/><title type='text'>CSS Relative Positioning &amp; The Twitter Bird</title><content type='html'>I'm not that crazy about the name of this blog but by now I think I'm stuck with it.   So when I saw the birthday cake RSS buttons today even though my first thought was, "Hmm those tie in with the blog's theme", I quickly recovered and came to my senses saying, "No way. I'm not going to make the blog even cutesier with one of those things".  &lt;br /&gt;&lt;br /&gt;So how did I end up with the twitter bird flying over a cake displayed right underneath my site logo?  &lt;br /&gt;&lt;br /&gt;Don't ask, I don't know what to say.&lt;br /&gt;&lt;br /&gt;If you are designing a site and traffic is important to you as it is to most people, then it's a good idea to prominently display your RSS feed instead of burying it like I had down in the bottom of my blog.  Twitter and RSS go hand in hand these days so I included Twitter even though I don't have an account with them yet. Let's talk about the CSS styles that I wrote to display the two images for these services.&lt;br /&gt;&lt;br /&gt;I wanted the bird appear as if it's hovering over the cake.  Obviously that can be easily achieved in an image editor but in my case both images had to be clickable so combining the two was not an option.  That's when CSS positioning came in handy.&lt;br /&gt;&lt;br /&gt;For the RSS cake, I gave the dimensions of the image.  Just as a reminder, you don't really have to specify width and height for images unless you want to change the original dimensions of the image.  I just happened to write mine out, it wasn't really necessary. &lt;br /&gt;&lt;br /&gt;For the bird, I had to tweak with positioning.   As you'll recall, in relative positioning the space occupied by the element remains in the flow but the element itself is shifted by however many pixels you specify typically in your top and left.  So that's exactly what I did, I moved the bird around until I was pleased with its new position.  That meant I pushed it down by 35 pixels and pushed it out by giving its left a negative value of 79 pixels.  &lt;br /&gt;&lt;br /&gt;The bird is moved relative to the position it would have occupied in the normal flow.  What I really want you to see is the invisible "hole" left behind because of relatively positioning the bird.  As far as the normal flow rendering is concerned, the bird's still there in the larger rectangle.  It's because of that hole I had to go back in and adjust padding/margin on other elements.&lt;br /&gt;&lt;br /&gt;img.rss { width: 90px; height: 94px; }&lt;br /&gt;img.twitter { position: relative; top:35px; left: -79px;}&lt;br /&gt;&lt;!--&lt;pre class='Blue'&gt;&amp;lt;a alt='Twitter' href='http://www.twitter.com' title='Twitter'&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;img class='twitter' src='images/twitter.jpg' title='Twitter'/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;a href='http://www.cssbakery.com/feeds/posts/default'&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;img alt='RSS Feed' class='rss' src='images/rss-cake1.jpg' title='RSS Feed'/&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;--&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/posrel.jpg" alt="Relative Positioning leaves a hole in the flow" title="Relative Positioning leaves a hole in the flow" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;I updated my &lt;a href="http://tools.cssbakery.com/welcome/caption"&gt;image captioning tool&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It has a new option that you can check off to display your caption on top of the image instead of bottom.  To see how that looks, see the &lt;a href="http://www.cssbakery.com/2010/10/reading-database-from-php.html"&gt;image&lt;/a&gt; in this post.  As you'll see, showing caption on top of the image instead of the typical bottom makes more sense in some cases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-6278546541696404607?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/6278546541696404607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/housekeeping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6278546541696404607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/6278546541696404607'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/housekeeping.html' title='CSS Relative Positioning &amp; The Twitter Bird'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-8812015383029630266</id><published>2010-10-17T13:59:00.000-07:00</published><updated>2010-10-23T10:17:07.976-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='print_r'/><category scheme='http://www.blogger.com/atom/ns#' term='SELECT'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Godaddy'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP Variable Dump'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqli_fetch_array'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqli_query'/><category scheme='http://www.blogger.com/atom/ns#' term='MYSQLI_ASSOC'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP Short Tags'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqli_connect'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqli_num_rows'/><title type='text'>Reading the Database from PHP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#myfootandcleat3jpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'top':true,'hide':true,'color':'white','bgcolor':'white'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='myfootandcleat3jpg' style='display:none;' src='http://pics.cssbakery.com/pics/myfootandcleat3.jpg' alt='A Cleat&amp;lt;br&amp;gt;[october 17 morning]&amp;lt;br&amp;gt;© 2010 Copyright www.cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;A Sunday which is constantly threatening rain.  Cold.  Walked for an hour early in the morning.  &lt;br /&gt;&lt;br /&gt;You remember our "mailorder.html" file which had the shoe information hard coded.  In the real world, we never work that way, always storing and retrieving information from a database.  In order to get that done, we will have to dip our toes into PHP and MySQL.  We have our database already set up at Go Daddy so that should make this exercise go faster.  I am going to convert parts of the HTML file to PHP. Information that's going to become dynamic is item name, item number, item description, price, and item picture.  &lt;br /&gt;&lt;br /&gt;Let's take a look at the parts of the HTML file that we are going to convert:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&amp;lt;img src="jimmychoos.jpg" alt="Jimmy Choo Sandals" /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;div class="itemorder"&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;Strappy Evening Sandals&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;$275.00&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Elegance and pain defined. Classic special-occasion heel crafted in &lt;br /&gt;metallic or suede leather. Cross-over straps at toe and double ankle strap&lt;br /&gt;with gold metal self-fastening oval buckle. Suede lining and leather sole. 3 1/2" &lt;br /&gt;self-covered high heels that are sure hell to walk on.  Recommended use is for &lt;br /&gt;sitting down and not really for walking.  Made in the USA. Catalog/cssbakery.com only.&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Name enclosed within h2's, price and description of the sandals enclosed within p tags are all hardcoded.  The img tag has the name of the image file hardcoded.&lt;br /&gt;&lt;br /&gt;&lt;ul class="starlist"&gt;Adding new fields to the database table, shoe_primary_data&lt;li&gt;itemname&lt;/li&gt;&lt;li&gt;imagepath&lt;/li&gt;&lt;li&gt;description&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Our database table "primary_data" does not have a field for item name so I'm going to add that as "itemname". The phpMyAdmin interface makes this easy.  Click on the  name of the table, in my case, "shoe_primary_data" and choose "Structure" tab from above which shows all the fields of your table.  Then  to add a new field,  just specify where it'll go in the table next to the "Add" option at the end of the table.  Hit the Go button to add the new field.  Repeat the same process with field names, imagepath and description.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/MySQL_TableStructure.jpg" alt="Adding field to MySQL Database Table" /&gt;&lt;br /&gt;&lt;br /&gt;Once you have the new field established, then we will have to set its value.  For "itemname" field, we want to enter "Strappy Evening Shoes".  We are again going to do this from the Godaddy interface but this time we are going to have to give it as a MySQL statement:&lt;br /&gt;&lt;br /&gt;UPDATE shoe_primary_data SET itemname="Strappy Evening Shoes"&lt;br /&gt;&lt;br /&gt;You enter the above SQL query from the SQL tab.  For a complete MySQL reference, please &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/update.html"&gt;see&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Since we only have one kind of shoe in our database so far, this statement will not cause problems but if we were to have several different types of shoes then it's important to write our SQL statement as follows:&lt;br /&gt;&lt;br /&gt;UPDATE shoe_primary_data SET itemname="Strappy Evening Shoes" WHERE itemnum="10100"&lt;br /&gt;&lt;br /&gt;which will only update the item names of those shoes where the item number happens to be 10100.  Otherwise, you would set every shoe in your database to "Strappy Evening Shoes".  &lt;br /&gt;&lt;br /&gt;&lt;img src="http://pics.cssbakery.com/pics/readingMySQL.jpg" alt="Initializing MySQL field" /&gt;&lt;br /&gt;&lt;br /&gt;Here's the code that connects to the MySQL database from PHP.  The mysqli_connect() API call returns an object that keeps track of the database connection.  If mysqli_connect() runs into a problem and can't connect, then the $db variable will get set to false.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;// make a connection to the mysql database server&lt;br /&gt;$db = mysqli_connect("womenshoes.db.6787492.hostedresource.com","womenshoes", &lt;br /&gt;"mypasswordwhichstartswithaV", "womenshoes");&lt;br /&gt;if ($db) {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;With the connection established, we read from the database using a SQL SELECT statement.  We limit the query to only records that have an item number of 10100:&lt;br /&gt;&lt;pre class='Blue'&gt;//building a query string to send to the database, this will be the search string&lt;br /&gt;  //Give me all the fields (star) from the shoe_primary_data table that have an item &lt;br /&gt;  //number of 10100&lt;br /&gt;  $query = "SELECT * FROM shoe_primary_data WHERE itemnum='10100' ";&lt;br /&gt;&lt;br /&gt;  //executes the search in the database using our query that we built&lt;br /&gt;  //result object holds the results of the query&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "Problem talking to a database";     &lt;br /&gt;  }&lt;br /&gt;  else die('Problem querying a database');&lt;br /&gt;}&lt;br /&gt;else die("Problem connecting to a database");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here we check to see if the number of rows returned is exactly equal to 1.  If there are zero rows, then we didn't find the item.  If there are more than 1 rows, then the database is corrupted somehow, since this table should have a single row for each unique item number.&lt;br /&gt;&lt;pre class='Blue'&gt;//returns the number of records that the query retrieved &lt;br /&gt;$count=mysqli_num_rows($result);&lt;br /&gt;&lt;br /&gt;// we are only expecting to find one record for the item number we queried for&lt;br /&gt;if ($count == 1) {&lt;br /&gt;  //row is the record and we are getting it as an array&lt;br /&gt;  //the parameter tells the API function to return the record as an associative array&lt;br /&gt;  //ass array means the indices into the array are the field names of the table&lt;br /&gt;  //indices are keys into the array&lt;br /&gt;  //so instead of accessing the fields using row sub 0, row sub 1, row['description']&lt;br /&gt;  $row=mysqli_fetch_array($result, MYSQLI_ASSOC);&lt;br /&gt;&lt;br /&gt;  //printr will dump any variable whether it's an array, object or simple string&lt;br /&gt;  print_r($row);&lt;br /&gt;} else die("error error");&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;br /&gt;With the database side of things settled, we can write our PHP code that's going to replace parts of the HTML.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;!-- php snippet is going to get totally replaced by the string from the database &lt;br /&gt;     so we need quotes outside the angle brackets&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&amp;lt;img src = "&amp;lt;?=$row['imagepath']?&amp;gt;" alt="Jimmy Choo Sandals" /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;div class="itemorder"&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;&amp;lt;?=$row['itemname']?&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;$&amp;lt;?php  printf("%01.2f", $row['price']); ?&amp;gt;&amp;lt;span class="floatr"&amp;gt;Item #: &lt;br /&gt;&amp;lt;?php printf("%d",$row['itemnum']); ?&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p class="description"&amp;gt;&amp;lt;?php  printf("%s", $row['description']); ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I will use short tags to echo out the path name of the image (imagepath in our shoe_primary_data table).  This PHP snippet will be totally replaced by the string from the database so it needs quotes around it to become the src file for the HTML img tag. &lt;br /&gt;&lt;br /&gt;The imagepath field provides one of the keys we can use to access the PHP row associative array. Notice we are doing PHP right in the middle of HTML.  &lt;br /&gt;&lt;br /&gt;Then we are indexing the row array a second time with itemname field to get the name of the shoes.  This should return the "Strappy Evening Shoes".&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;SHORT TAGS IN PHP&lt;/h1&gt;&lt;br /&gt;Let me just say a few things about short tags before we move on.  When echoing out PHP variables, you can use the "short tag" form, so instead of writing &amp;lt;?php echo $x; ?&amp;gt;, you can just write &amp;lt;?=$x?&amp;gt;.  The short tag form with the equal sign tells PHP to do an echo of the expression that follows.  If you need to do a printf instead of echo, for example to format a floating point number, then you still have to use the long form, e.g. &amp;lt;?php printf("%02f",$x); ?&amp;gt;, but in cases where you just outputing the contents of the variable without formatting, then the short tag form works well and saves you some typing.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Blue'&gt;&amp;lt;p&amp;gt;$&amp;lt;?php  printf("%01.2f", $row['price']); ?&amp;gt;&amp;lt;span class="floatr"&amp;gt;Item #: &lt;br /&gt;&amp;lt;?php printf("%d",$row['itemnum']); ?&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!- above line can be re-written as below: --&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;$&amp;lt;?php  printf("%01.2f", $row['price']); ?&amp;gt;&amp;lt;span class="floatr"&amp;gt;Item #: &lt;br /&gt;&amp;lt;?=$row['itemnum'])?&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;  &lt;/pre&gt;&lt;br /&gt;&lt;h1&gt;CAN YOU EXPLAIN %01.2f? &lt;/h1&gt;&lt;br /&gt;In the PHP statement, printf("%01.2f", $row['price']); .2 means to put two decimal places.  f is for floats.  Let's say the value is 0.75. In that case, you don't want .75 so the zero one says to pad it with leading zeros for one decimal position before the period &lt;i&gt;if it needs it&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="related_thumbnail"&gt;&lt;img src="http://pics.cssbakery.com/pics/shiningkeys.jpg" alt="" title="" /&gt;&lt;h4&gt;MySQL/PHP Database Series&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/passing-query-parameter-to-php.html"&gt;Passing a Query Parameter to PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/looping-through-multiple-records-with.html"&gt;Looping through Multiple Records with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/reading-database-from-php.html"&gt;Reading the Database from PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-with-php.html"&gt;Creating MySQL Tables with PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;Creating MySQL Tables and Inserting Records with phpMyAdmin&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/creating-mysql-tables-inserting-mysql.html"&gt;MySQL Tonight - Creating the Database&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cssbakery.com/2010/10/php-i-think.html"&gt;PHP Example with GoDaddy&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4843224028361594470-8812015383029630266?l=www.cssbakery.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.cssbakery.com/feeds/8812015383029630266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.cssbakery.com/2010/10/reading-database-from-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8812015383029630266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4843224028361594470/posts/default/8812015383029630266'/><link rel='alternate' type='text/html' href='http://www.cssbakery.com/2010/10/reading-database-from-php.html' title='Reading the Database from PHP'/><author><name>CSSBakery</name><uri>http://www.blogger.com/profile/08756544695899161347</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://3.bp.blogspot.com/_qQrgdfPSZXY/TOUrojlptOI/AAAAAAAAAGQ/_upyBlenIrM/s1600-R/ilovemyboat.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4843224028361594470.post-4376594966491288107</id><published>2010-10-15T23:23:00.000-07:00</published><updated>2010-10-25T08:16:13.924-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Godaddy'/><category scheme='http://www.blogger.com/atom/ns#' term='phpMyAdmin'/><title type='text'>Creating MySQL Tables with PHP</title><content type='html'>&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#lightplay_filteredjpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='lightplay_filteredjpg' style='display:none;' src='http://pics.cssbakery.com/pics/lightplay_filtered.jpg' alt='Lighting the Way&amp;lt;br&amp;gt;October 15 on a clear night&amp;lt;br&amp;gt;© 2010 Copyright by cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;There's quite bit of  &lt;a href="http://pics.cssbakery.com/pics/lightplay.jpg"&gt;noise&lt;/a&gt; in this image.  If you clean it up with software, the waves lose definition.  Taken in the dark, handheld with high ISO and a small sensor, noise was unavoidable. Update: I'm displaying the filtered version, to see the original click &lt;a href="http://pics.cssbakery.com/pics/lightplay.jpg"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In my previous post I created MySQL tables and did inserts from phpMyAdmin.  Now I'll show you how to do the same thing from a PHP program.  As you'll see, this is just another way of getting the same SQL commands executed.  Of course, once you can create tables and insert from PHP, then you can start building a real web application, by doing things like storing data that users submit to your site.&lt;br /&gt;&lt;br /&gt;The first thing we need to do is tell PHP to connect to the database:&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;?php&lt;br /&gt;// make a connection to the mysql database server&lt;br /&gt;$db = mysqli_connect("womenshoes.db.6787492.hostedresource.com",&lt;br /&gt;"womenshoes", "*****", "womenshoes");&lt;br /&gt;&lt;br /&gt;if ($db) {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that on GoDaddy hosting, you can't just say 'localhost' for the first parameter, which identifies the location of the MySQL database (e.g. the IP address of the machine it's hosted on). Instead you need to grab the hostname listed on the phpMySQL screen for the database.  After we attempt the connection, we test whether $db is true or not. If it's true, then we successfully made the connection.&lt;br /&gt;&lt;br /&gt;Next, I've got some code right now to totally delete my tables (i.e. "drop" them).  This is something you have to be careful using since it totally erases your database table.  For now I'm just using it so I can run the code many times without getting errors that something already exists.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;//Drop the tables first&lt;br /&gt;  $query = "DROP TABLE shoe_primary_file,shoe_secondary_file";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, we create one of our tables and check to see if we were successful or not.  The SQL should look familiar from the previous post where we were using phpMyAdmin instead of PHP to do this.  The main difference here is that we are doing this through the mysqli_query() function, passing in the database connection we created above, along with our query string.  Here's the code to create our first table:&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;//Create the tables:&lt;br /&gt;  $query = "CREATE TABLE IF NOT EXISTS shoe_primary_file (&lt;br /&gt;            itemnum int(11) default NULL,&lt;br /&gt;            description text,&lt;br /&gt;            price int(11) default NULL&lt;br /&gt;             ) ;";&lt;br /&gt;&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "You know how to create a database table&amp;lt;br&amp;gt;\n";&lt;br /&gt;  }&lt;br /&gt;  else die('You dont know how to create a table');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then we do the same thing for our secondary table:&lt;br /&gt;&lt;pre class='Purple'&gt;$query = "CREATE TABLE IF NOT EXISTS shoe_secondary_file (&lt;br /&gt;             id int(11) NOT NULL auto_increment,&lt;br /&gt;             itemnum int(11) default NULL,&lt;br /&gt;             size varchar(80) default NULL,&lt;br /&gt;             width varchar(10) default NULL,&lt;br /&gt;             color varchar(60) default NULL,&lt;br /&gt;             inventory int(11) default NULL,&lt;br /&gt;             PRIMARY KEY  (id),&lt;br /&gt;             KEY itemnum (itemnum)&lt;br /&gt;           ) ;";&lt;br /&gt;&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "You &amp;lt;em&amp;gt;really&amp;lt;/em&amp;gt; know how to create a database table&amp;lt;br&amp;gt;\n";&lt;br /&gt;  }&lt;br /&gt;  else die('You dont know how to create a table');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, we insert our first record, and see if that was successful.&lt;br /&gt;&lt;br /&gt;&lt;pre class='Purple'&gt;$query = "INSERT INTO shoe_primary_file VALUES('10100', 'Elegance and pain defined. &lt;br /&gt;Classic special-occasion heel crafted in  metallic or suede leather. Cross-over straps &lt;br /&gt;at toe and double ankle strap with  gold metal self-fastening oval buckle. Suede lining &lt;br /&gt;and leather sole. 3 1/2 inch self-covered high heels that are sure hell to walk in.  &lt;br /&gt;Made in the USA. Catalog/cssbakery.com only', '275');";&lt;br /&gt;&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "You know how to insert a row in a table&amp;lt;br&amp;gt;\n";&lt;br /&gt;  }&lt;br /&gt;  else die('You dont know how to insert a row in a table');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we want to insert a number of rows into the secondary table.  The way I do that here is to first construct a PHP array of all the records that I want to put into the secondary table.  Then I loop through those records, calling mysqli_query on each one.&lt;br /&gt;&lt;pre class='Purple'&gt;$insertList = array(&lt;br /&gt;   "INSERT INTO shoe_secondary_file VALUES(0, 10100, '7', 'M', 'platinum', 7);",&lt;br /&gt;   "INSERT INTO shoe_secondary_file VALUES(0, 10100, '6 1/2', 'M', 'black suede', 5);",&lt;br /&gt;   "INSERT INTO shoe_secondary_file VALUES(0, 10100, '7', 'W', 'platinum', 4);",&lt;br /&gt;   "INSERT INTO shoe_secondary_file VALUES(0, 10100, '8', 'M', 'navy suede', 2);"&lt;br /&gt;  );&lt;br /&gt;  $r = "really ";&lt;br /&gt;  foreach ($insertList as $insert) {&lt;br /&gt;     $result = mysqli_query($db, $insert);&lt;br /&gt;     if ($result) {&lt;br /&gt;         echo "You &amp;lt;em&amp;gt;$r&amp;lt;/em&amp;gt; know how to insert into a table!&amp;lt;br&amp;gt;\n";&lt;br /&gt;     } else die('Sorry, but you dont know how to insert into a table');&lt;br /&gt;     $r .= "really ";&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's all there is to it for creating and inserting data into MySQL from PHP.  Once you've got the database connection open, you start sending SQL query strings to it via mysqli_query().   As a final step it's always good practice to close the connection to the MySQL database using: mysqli_close($db).&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;?php&lt;br /&gt;  // close the db connection:&lt;br /&gt;  $db = mysqli_close($db)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class="divider"&gt;&lt;/div&gt;&lt;script type='text/javascript'&gt;$(window).load(function(){ $('#nightsailingjpg').cssBakeryCaption({'opacity':'0.2','center':true,'centerCaption':true,'round':true,'hide':true,'color':'white','bgcolor':'black'});});&lt;/script&gt;&lt;br /&gt;&lt;img id='nightsailingjpg' style='display:none;' src='http://pics.cssbakery.com/pics/nightsailing3.jpg' alt='Night Sailing&amp;lt;br&amp;gt;October 15 on a clear night&amp;lt;br&amp;gt;© 2010 Copyright by cssbakery.com All Rights Reserved'&gt;&lt;br /&gt;&lt;br /&gt;Here's the entire program listing in one piece:&lt;br /&gt;&lt;pre class='Purple'&gt;&amp;lt;?php&lt;br /&gt;// make a connection to the mysql database server&lt;br /&gt;$db = mysqli_connect("womenshoes.db.6787492.hostedresource.com",&lt;br /&gt;"womenshoes", "*****", "womenshoes");&lt;br /&gt;if ($db) {&lt;br /&gt;&lt;br /&gt;  //Drop the tables first&lt;br /&gt;  $query = "DROP TABLE shoe_primary_file,shoe_secondary_file";&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;      echo "You know how to drop tables!&amp;lt;br&amp;gt;\n";&lt;br /&gt;  } else die ("You dont know how to drop a table.");&lt;br /&gt;&lt;br /&gt;  //Create the tables:&lt;br /&gt;  $query = "CREATE TABLE IF NOT EXISTS shoe_primary_file (&lt;br /&gt;            itemnum int(11) default NULL,&lt;br /&gt;            description text,&lt;br /&gt;            price int(11) default NULL&lt;br /&gt;             ) ;";&lt;br /&gt;&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "You know how to create a database table&amp;lt;br&amp;gt;\n";&lt;br /&gt;  }&lt;br /&gt;  else die('You dont know how to create a table');&lt;br /&gt;&lt;br /&gt;  $query = "CREATE TABLE IF NOT EXISTS shoe_secondary_file (&lt;br /&gt;             id int(11) NOT NULL auto_increment,&lt;br /&gt;             itemnum int(11) default NULL,&lt;br /&gt;             size varchar(80) default NULL,&lt;br /&gt;             width varchar(10) default NULL,&lt;br /&gt;             color varchar(60) default NULL,&lt;br /&gt;             inventory int(11) default NULL,&lt;br /&gt;             PRIMARY KEY  (id),&lt;br /&gt;             KEY itemnum (itemnum)&lt;br /&gt;           ) ;";&lt;br /&gt;&lt;br /&gt;  $result = mysqli_query($db, $query);&lt;br /&gt;  if ($result) {&lt;br /&gt;     echo "You &amp;lt;em&amp;gt;really&amp;lt;/em&amp;gt; know how
