<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>camwebdesign.com &#187; CSS</title>
	<atom:link href="http://camwebdesign.com/category/techniques/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://camwebdesign.com</link>
	<description>High quality, cost effective wed design and hosting solutions</description>
	<lastBuildDate>Mon, 12 Jul 2010 10:54:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Consistent Cross-Browser Code Snippets</title>
		<link>http://camwebdesign.com/techniques/consistent-cross-browser-code-snippets/</link>
		<comments>http://camwebdesign.com/techniques/consistent-cross-browser-code-snippets/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 04:30:02 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Techniques]]></category>

		<guid isPermaLink="false">http://camwebdesign.com/?p=491</guid>
		<description><![CDATA[How did we create and style consistent cross-browser Code Snippets with &#60;pre&#62; and &#60;code&#62; tags and some simple CSS. The problem, not all browsers treat the padding of the &#60;pre&#62; tag the same. I know what your first thought was&#8230;&#8221;It&#8217;s Internet Explorer!&#8221;, wrong actually the culprit is Firefox . In short Firefox doesn&#8217;t play well [...]]]></description>
			<content:encoded><![CDATA[<p>How did we create and style consistent cross-browser Code Snippets with &lt;pre&gt; and &lt;code&gt; tags and some simple CSS.</p>
<p>The problem, not all browsers treat the padding of the &lt;pre&gt; tag the same.  I know what your first thought was&#8230;&#8221;It&#8217;s Internet Explorer!&#8221;, wrong actually the culprit is <span id="more-491"></span>Firefox <img src='http://camwebdesign.com/~/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .  In short Firefox doesn&#8217;t play well with spaces and tabs in the &lt;pre&gt; tag.  Yes a <a href="/techniques/css-reset-anyone/">CSS reset</a> does go a long way in fixing this issue, but we wanted to further the control of our Code Snippets and do some fancy stuff to them as well.</p>
<p>Our solution&#8230;</p>
<p>We nest the &lt;pre&gt; and &lt;code&gt; tags allowing control of the margin, padding and backgrounds for each of the elements.  Our HTML, CSS, PHP, javascript or whatever code goes inside the tags.</p>
<div><span class="CODEselect">[<a href="#">Select Code</a>]</span></p>
<pre><code class="html" id="code1">&lt;pre&gt;&lt;code&gt;
&lt;!-- Place Code Here --&gt;
&lt;/code&gt;&lt;/pre&gt;</code></pre>
</div>
<p>The CSS for our &lt;pre&gt; and &lt;code&gt; tags.  We control the padding in the &lt;pre&gt; tag and the spaces and tabs in the code are properly represented in the &lt;code&gt; tag.</p>
<div><span class="CODEselect">[<a href="#">Select Code</a>]</span></p>
<pre><code class="css" id="code2">pre {
	padding: 0;
	margin: 4px 0 12px 0;
	border: 1px solid #ccc;
	line-height: 20px;
	background: url(/images/code-bg.gif) repeat-y top left #000;
	width: 586px;
	overflow: auto;
	overflow-Y: hidden;
}
pre code {
	margin: 0 8px 0 25px;
	padding: 18px 0;
	display: block;
	color: #3C3;
}</code></pre>
</div>
<p>So there you have it, simple yet effective in producing consistent results across all browsers.</p>
<p>Post your thoughts below&#8230;</p>
<hr /><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://camwebdesign.com/techniques/css-reset-anyone/" rel="bookmark" title="January 5, 2010">CSS Reset anyone?</a></li>
<li><a href="http://camwebdesign.com/techniques/select-code-in-snippets-with-jquery/" rel="bookmark" title="January 7, 2010">Select code in snippets with jQuery</a></li>
<li><a href="http://camwebdesign.com/techniques/dynamic-font-based-images/" rel="bookmark" title="January 2, 2010">Dynamic Font-Based Images</a></li>
</ul>
<p><!-- Similar Posts took 14.506 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://camwebdesign.com/techniques/consistent-cross-browser-code-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Reset anyone?</title>
		<link>http://camwebdesign.com/techniques/css-reset-anyone/</link>
		<comments>http://camwebdesign.com/techniques/css-reset-anyone/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 17:43:14 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Techniques]]></category>

		<guid isPermaLink="false">http://camwebdesign.com/?p=521</guid>
		<description><![CDATA[When we create a new site&#8217;s CSS, we start with a CSS Reset to level the playing field between browsers. The problem, not all browsers treat the margin, padding, line height, font size, styling, text decoration, etc. the same, a CSS Reset helps us to &#8220;reset&#8221; these within each browser. The CSS Reset technique is [...]]]></description>
			<content:encoded><![CDATA[<p>When we create a new site&#8217;s CSS, we start with a CSS Reset to level the playing field between browsers.  The problem, not all browsers treat the margin, padding, line height, font size, styling, text decoration, etc. the same, <span id="more-521"></span>a CSS Reset helps us to &#8220;reset&#8221; these within each browser.  The <a href="http://www.google.com/search?q=CSS+Reset+technique">CSS Reset technique</a> is nothing new so we&#8217;ll let you read up on it&#8217;s history.</p>
<h3>Here is the reset that we use as our basic CSS building blocks:</h3>
<div><span class="CODEselect">[<a href="#">Select Code</a>]</span></p>
<pre><code id="code1">/* ------------------------Begin Reset------------------------ */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
  line-height: 1.4;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}
/* ------------------------End Reset------------------------ */</code></pre>
</div>
<p>Post your thoughts below&#8230;</p>
<hr /><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://camwebdesign.com/techniques/consistent-cross-browser-code-snippets/" rel="bookmark" title="January 6, 2010">Consistent Cross-Browser Code Snippets</a></li>
<li><a href="http://camwebdesign.com/techniques/select-code-in-snippets-with-jquery/" rel="bookmark" title="January 7, 2010">Select code in snippets with jQuery</a></li>
<li><a href="http://camwebdesign.com/techniques/dynamic-font-based-images/" rel="bookmark" title="January 2, 2010">Dynamic Font-Based Images</a></li>
</ul>
<p><!-- Similar Posts took 14.294 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://camwebdesign.com/techniques/css-reset-anyone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
