tag:blogger.com,1999:blog-16217833.post-81807935641257121772007-03-06T16:47:00.000+01:002007-03-17T15:07:37.295+01:00Creating a Blogger Template (4)<div style="margin: 30px 0 20px 20px"><span style="color: #6699FF; font-size: .9em;">... </span> <span style="color: #f67c2a; font-size: 4em;">V</span><span style="color: #6699FF; font-size: 2em;">a</span><span style="color: #f67c2a; font-size: 4em;">r</span><span style="color: #6699FF; font-size: 7em;">i</span><span style="color: #f67c2a; font-size: 3em;">a</span><span style="color: #6699FF; font-size: 4em;">b</span><span style="color: #f67c2a; font-size: 3em;">l</span><span style="color: #6699FF; font-size: 2em;">e</span><span style="color: #f67c2a; font-size: 3em;">s</span> <span style="color: #6699FF; font-size: .9em;">...</span></div><br /><div style="border: 2px solid #6699FF; padding: 20px;">This is the <span style="font-style:italic; font-weight:bold;">fourth</span> part of the <span style="color: #f67c2a; font-weight:bold;">Creating A Blogger Template</span> series:<br /><br /><a href="http://thrbrtemplates.blogspot.com/2007/03/creating-blogger-template.html">Creating a Blogger Template (1) - from scratch</a><br /><a href="http://thrbrtemplates.blogspot.com/2007/03/creating-blogger-template-2.html">Creating a Blogger Template (2) - the layout</a><br /><a href="http://thrbrtemplates.blogspot.com/2007/03/creating-blogger-template-3.html">Creating a Blogger Template (3) - a fluid design</a><br /><a href="http://thrbrtemplates.blogspot.com/2007/03/creating-blogger-template-4.html">Creating a Blogger Template (4) - variables</a></div><br />Hmmm ... this is (on my account) a rather superfluous thread. All I have to do is point to <span style="color: #6699FF;">Google Help &gt; Blogger Help &gt; Working with Blogger &gt; Layouts &gt;</span> <span style="color: #f67c2a;"><a href="http://help.blogger.com/bin/answer.py?answer=46871&query=variables&topic=&type=f">Fonts and Colors Tags for Layouts</a></span>, but this one makes the CaBT tutorials a circle!<br /><br />A big advantage of the Blogger Layout Feature is the use of (though limited to only <span style="font-weight:bold;">fonts</span> and <span style="font-weight:bold;">colors</span>) Variables.<br />(The other one: the Page Element Drag-and-Drop feature - limited within each Blogger Section.)<br /><br />As explained in the <a href="http://thrbrtemplates.blogspot.com/2007/03/creating-blogger-template.html">first</a> CaBT:<br /><br /><div style="background-color: #F0F0F0; padding: 20px; color: #f67c2a"><span style="color: #000">Notice</span><br /><br />&lt;style type="text/css"&gt;<br /><span style="font-weight:bold; color: #000">&lt;!-- some css styling here --&gt;</span><br />&lt;/style&gt;<br /><br /><span style="color: #000">is replaced by</span><br /><br />&lt;b:skin&gt;&lt;![CDATA[/*<br />*/<br /><span style="font-weight:bold; color: #000">&lt;!-- some css styling here --&gt;</span><br />]]&gt;&lt;/b:skin&gt;</div><br />The variables are added, embedded between the comment tags <span style="color: #6699FF; font-weight: bold;">/* */</span>, like this:<br /><br /><div style="background-color: #F0F0F0; padding: 20px; color: #f67c2a">&lt;b:skin&gt;&lt;![CDATA[/*<blockquote>Variable definitions<br />====================<br /><br />&lt;Variable <span style="font-weight:bold;">name</span>="" <span style="font-weight:bold;">description</span>="" <span style="font-weight:bold;">type</span>="" <span style="font-weight:bold;">default</span>="" <span style="font-weight:bold;">value</span>=""&gt;</blockquote>*/<br /><span style="font-weight:bold; color: #000">&lt;!-- some css styling here --&gt;</span><br />]]&gt;&lt;/b:skin&gt;</div><br />As you can see each Variable has a few obliged attributes:<blockquote><span style="font-weight:bold; color: #6699FF;">name</span>: a (technical) <span style="font-weight:bold;">unique</span> ID;<br /><br /><span style="font-weight:bold; color: #6699FF;">description</span>: the (logical) <span style="font-weight:bold;">descriptive</span> name - <span style="font-style:italic;">as it will appear in the Fonts and Colors tab</span>;<br /><br /><span style="font-weight:bold; color: #6699FF;">type</span>: '<span style="font-weight:bold;">color</span>' or '<span style="font-weight:bold;">font</span>' - <span style="font-style:italic;">no more, alas!</span>;<br /><br /><span style="font-weight:bold; color: #6699FF;">default</span>: the <span style="font-weight:bold;">default</span> value <span style="font-weight:bold;">*</span>;<br /><br /><span style="font-weight:bold; color: #6699FF;">value</span>: the new value - <span style="font-style:italic;">can be initially left blank</span>;</blockquote>*) Attribute <span style="font-weight:bold; color: #6699FF;">default</span> explained: can be a <span style="font-weight:bold;">color</span> (<span style="font-style:italic;">a hexadecimal color code</span>) or a <span style="font-weight:bold;">font</span> (<span style="font-style:italic;">font-style font-weight font-size font-family</span>) value!!!<br /><br />Two examples (one for each type):<br /><br /><div style="background-color: #F0F0F0; padding: 20px; color: #f67c2a">&lt;b:skin&gt;&lt;![CDATA[/*<blockquote>Variable definitions<br />====================<br /><br />&lt;Variable name="<span style="font-weight:bold;">textcolor</span>" description="<span style="font-weight:bold;">Text Color</span>"<br />type="<span style="font-weight:bold;">color</span>" default="<span style="font-weight:bold;">#ccc</span>" value="<span style="font-weight:bold;">#cccccc"</span>&gt;<br /><br />&lt;Variable name="<span style="font-weight:bold;">bodyfont</span>" description="<span style="font-weight:bold;">Body Font</span>"<br />type="<span style="font-weight:bold;">font</span>" default="<span style="font-weight:bold;">normal normal 100% 'Trebuchet MS',Trebuchet,Verdana,Sans-serif</span>" value="<span style="font-weight:bold;">normal normal 100% 'Trebuchet MS',Trebuchet,Verdana,Sans-serif</span>"&gt;</blockquote>*/<br /><span style="font-weight:bold; color: #000">&lt;!-- some css styling here --&gt;</span><br />]]&gt;&lt;/b:skin&gt;</div><br /><span style="font-weight:bold;">So-uhh, what's the catch?</span><br /><br />For each <span style="font-weight:bold;">font</span> or <span style="font-weight:bold;">color</span> in your <span style="font-weight:bold;">CSS code</span> you can use a pre-defined <span style="font-weight:bold;">Variable</span>!<br /><br />Two examples (one for each type):<br /><br /><div style="background-color: #F0F0F0; padding: 20px; color: #f67c2a"><span style="color: #000">Instead of</span><br /><br />body {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: <span style="font-weight:bold;">#CCC</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font: <span style="font-weight:bold;">italic bold x-small 'Trebuchet MS', Trebuchet, Verdana, Sans-serif</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br /><span style="color: #000">one can write</span><br /><br />body {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: <span style="font-weight:bold;">$textcolor</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font: <span style="font-weight:bold;">$bodyfont</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</div><br />So you can define separate colors for <span style="font-style:italic;">fonts</span>, <span style="font-style:italic;">links</span>, <span style="font-style:italic;">hovers</span>, <span style="font-style:italic;">backgrounds</span>, <span style="font-style:italic;">borders</span>, et cetera ... and separate fonts for <span style="font-style:italic;">posts</span>, <span style="font-style:italic;">comments</span>, <span style="font-style:italic;">links</span>, <span style="font-style:italic;">sidebars</span>, <span style="font-style:italic;">headers</span>, et cetera, et cetera.<br /><br />And you don't have to dive into the xml template every time you feel the urge to change a font or a color. You can control all these in the <span style="font-weight:bold;">Fonts and Colors</span> tab on the Dashboard!<br /><br />Very neat. It really is a pity this handy gimmick is limited to only two types!<br /><br /><div style="border: 2px solid #F0F0F0; padding: 10px;">What's left, I guess, is learning and understanding CSS.<br />There are plenty of fine css-link-lists out there!<br /><br />Some reading:<br /><br /><a href="http://www.htmldog.com/guides/cssbeginner/">CSS Beginner Tutorial | HTML Dog</a><br /><a href="http://www.htmldog.com/guides/cssintermediate/">CSS Intermediate Tutorial | HTML Dog</a><br /><a href="http://www.htmldog.com/guides/cssadvanced/">CSS Advanced Tutorial | HTML Dog</a><br /><a href="http://www.w3schools.com/css/default.asp">CSS Tutorial | W3Schools</a><br /><a href="http://www.communitymx.com/content/article.cfm?cid=1C603">Newly Supported CSS Selectors in IE7</a><br /><a href="http://css.maxdesign.com.au/floatutorial/">Floatutorial | Max Design</a><br /><a href="http://alistapart.com/">A List Apart</a> (hearty recommended!!!)<br /><br />and so on and so forth</div>thurhttp://www.blogger.com/profile/11325683639754912267noreply@blogger.com