<?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>Learning is an Art &#187; css</title>
	<atom:link href="http://www.singhvishwajeet.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.singhvishwajeet.com</link>
	<description>My experiences</description>
	<lastBuildDate>Thu, 10 Jun 2010 22:19:54 +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>Getting Started with CSS</title>
		<link>http://www.singhvishwajeet.com/2008/07/28/getting-started-with-css/</link>
		<comments>http://www.singhvishwajeet.com/2008/07/28/getting-started-with-css/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 17:48:54 +0000</pubDate>
		<dc:creator>Vishwajeet Singh</dc:creator>
				<category><![CDATA[web design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://www.singhvishwajeet.com/?p=7</guid>
		<description><![CDATA[ [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is CSS</strong><br />
<strong>CSS</strong> is an acronym for Cascading Style Sheets. CSS is a style language that defines layout of HTML documents. CSS covers fonts, colors, margins, lines, height, width, background images, advanced positions and a lot more things.</p>
<p><strong>Why CSS was required? </strong></p>
<p>HTML tags were originally designed to define the content of a document. The layout of the document was supposed to be taken care of by the browser, without using any formatting tags. As the Netscape and Internet Explorer started adding new HTML tags and attributes (like font and color attribute) to the original HTML specifications, it become pretty difficult to create Web Sites where the content of HTML documents was clearly separated from the document&#8217;s presentation layout. To solve this problem, the World Wide Web Consortium (W3C) &#8211; the non profit, standard setting consortium, responsible for standardizing HTML &#8211; created STYLES in addition to HTML 4.0.</p>
<p><strong>What I Should Know Before Starting? </strong></p>
<p>You should have basic understanding HTML 4.0 or XHTML 1.0</p>
<p><strong>What CSS can do For Me?</strong></p>
<p>You can control layout of many HTML documents from single style sheet</p>
<p>You can change layout at will, without messing with HTML code</p>
<p><strong>Getting Started</strong></p>
<p>CSS is made of three parts: a selector a property and value</p>
<p><strong><em>Selector</em></strong></p>
<p>The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">h1<br />
<span class="br0">&#123;</span><br />
<span class="kw1">font-family</span><span class="re2">:Times </span>New Roman<br />
<span class="br0">&#125;</span></div>
</div>
<p>Assigns Times New Roman font to all h1 tags.</p>
<p>If you wish to assign multiple properties, you can do it by separating properties by separating by a semicolon as shown below:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">p<br />
<span class="br0">&#123;</span><br />
<span class="kw1">text-align</span><span class="sy0">:</span><span class="kw1">right</span><span class="sy0">;</span><br />
<span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">green</span><span class="sy0">;</span><br />
<span class="kw1">font-family</span><span class="sy0">:</span> Times New Roman<span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Above example shows how to define a right aligned paragraph, with a green text color.</p>
<p><strong>Grouping Selectors</strong></p>
<p>You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be have font family Times New Roman:</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">h1<span class="sy0">,</span>h2<span class="sy0">,</span>h3<span class="sy0">,</span>h4<br />
<span class="br0">&#123;</span><br />
<span class="kw1">font-family</span><span class="sy0">:</span> Times New Roman<span class="sy0">;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Selector with Classes</strong></p>
<p>With classes you can assign different styles to same type of HTML elements</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;">p.<span class="kw2">red</span> <span class="br0">&#123;</span><span class="kw1">color</span> <span class="sy0">:</span> <span class="kw2">red</span><span class="br0">&#125;</span><br />
p.<span class="kw2">green</span> <span class="br0">&#123;</span><span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">center</span><span class="br0">&#125;</span></div>
</div>
<p>You have to use the class atribute in your HTML document as shown below</p>
<div class="codesnip-container" >&lt;p class=&#8221;red&#8221;&gt;<br />
This paragraph will have red color.<br />
&lt;/p&gt;<br />
&lt;p class=&#8221;green&#8221;&gt;<br />
This paragraph will have green color.<br />
&lt;/p&gt;</div>
<p>Do not start a class name with numeral. It will not work in Firefox.</p>
<p><strong>Writing Comments in CSS</strong></p>
<p>Comments are as important as code itself, so now we will see how to write comment in CSS. Comment in a CSS file starts with &#8220;/*&#8221; and ends with &#8220;*/&#8221;. As shown in example below</p>
<div class="codesnip-container" >
<div class="css codesnip" style="font-family:monospace;"><span class="coMULTI">/*Begin Header Type */</span><br />
h1<span class="br0">&#123;</span><span class="kw1">font-family</span><span class="re2">:Times </span>New Roman<span class="sy0">;</span> <span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">red</span><span class="br0">&#125;</span><br />
h2<span class="br0">&#123;</span><span class="kw1">font-family</span><span class="sy0">:</span>Verdana<span class="sy0">;</span> <span class="kw1">color</span><span class="sy0">:</span> <span class="kw1">blue</span><span class="br0">&#125;</span><br />
h3<span class="br0">&#123;</span><span class="kw1">font-family</span><span class="sy0">:</span>Arial<span class="sy0">;</span> <span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">green</span><span class="br0">&#125;</span><br />
<span class="coMULTI">/*End Header Type */</span></div>
</div>
<p>Inserting Style Sheet in Your HTML Document</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/link.html"><span class="kw2">link</span></a> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;BlueMariner.css&quot;</span> <span class="sy0">/</span>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span></div>
</div>
<p>Where BlueMariner is the name of your CSS File.</p>
<p><strong>CSS validator</strong></p>
<p>To make it easier to observe the CSS standard, W3C has made a so-called <a title="W3C CSS Validator" href="http://jigsaw.w3.org/css-validator/" target="_blank">validator</a> which reads your stylesheet and returns a status listing errors and warnings, if your CSS does not validate. CSS Validator can be also downloaded from <a title="W3C CSS Validator" href="http://jigsaw.w3.org/css-validator/DOWNLOAD.html" target="_blank">W3C WebSite.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.singhvishwajeet.com/2008/07/28/getting-started-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
