<?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>devexp &#187; class</title>
	<atom:link href="http://www.devexp.eu/tag/class/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devexp.eu</link>
	<description>DEVelopment EXPerience, shared with the world!</description>
	<lastBuildDate>Fri, 28 Oct 2011 12:07:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Basic tips and tricks: 4.Css</title>
		<link>http://www.devexp.eu/2009/09/01/basic-tips-and-tricks-4-css/</link>
		<comments>http://www.devexp.eu/2009/09/01/basic-tips-and-tricks-4-css/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 11:42:12 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=899</guid>
		<description><![CDATA[Hello everybody, I&#8217;m back with another version of basic tips and tricks. After having a talk with a client, about the basic on css, I thought it might be good to have an easy introduction. So let’s give it a &#8230; <a href="http://www.devexp.eu/2009/09/01/basic-tips-and-tricks-4-css/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Hello everybody, I&#8217;m back with another version of basic tips and tricks.</p>
<p>After having a talk with a client, about the basic on css, I thought it might be good to have an easy introduction.</p>
<p>So let’s give it a try. We&#8217;ll talk about:</p>
<ul>
<li> Why would you use css?</li>
<li>How to insert css in your html file</li>
<li>How css is written</li>
<li>Css on objects, classes and unique objects</li>
<li>Basic css properties and there values</li>
<li>The pseudo class</li>
<li>Where to find good information on css</li>
</ul>
<blockquote><p>Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation (that is, the look and formatting) of a document written in a markup language.</p>
<p>CSS is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation, including elements such as the colors, fonts, and layout.</p></blockquote>
<p><span id="more-899"></span></p>
<p><strong>Why would you use css?</strong></p>
<p>Whenever you create an html page without css, you will probably insert layout into it. But every object will have to get it&#8217;s layout specifications and that could be a hard time, especially if you have a lot of objects that need the same layout.<br />
You don&#8217;t know any examples of objects with the same layout?</p>
<ul>
<li> A menu with 4 or 5 buttons.</li>
<li>Buttons</li>
<li>A list</li>
<li>Different headings and titles</li>
<li>Paragraphs</li>
<li>&#8230;</li>
</ul>
<p>As you can see, I don&#8217;t need to think very hard to get different objects on which the same layout can be applied.</p>
<p>I guess you see my point why you could use the same css code over and over again, instead of rewriting it for each object in your page.<br />
And I&#8217;m not even talking about different pages or a whole website&#8230;</p>
<p><strong>How to insert css in your html file</strong></p>
<p>CSS is a file containing code you and that puts a layout on specific objects in your html file.</p>
<p>That code can be written in a html file within these tags</p>
<pre class="brush: xml; title: ; notranslate">
&lt;STYLE type=text/css&gt;                 &lt;/STYLE&gt;
</pre>
<p>Or in a css file that is included within the &lt;head&gt;&lt;/head&gt; tags.</p>
<p>Whatever css code you write in there will be applied to the code within that page.</p>
<p>If you are creating a website or more than one page, it might be more sufficient to use an include so you can reuse the same code over and over again.</p>
<p>In my opinion the only times you can or should use the &lt;style&gt; tags without an include is if you are sure you will never create another page with the same layout or for testing.</p>
<p>Just for readability alone, it might be better to separate it from your original html file and include it.</p>
<p><strong>How css is written</strong></p>
<p>The coding is quite simple, the only difficult thing to learn is: what properties are there? And on which object are they possible?</p>
<p>Css is always written in this way:</p>
<pre class="brush: css; title: ; notranslate">
selector [, selector2, ...]:pseudo-class { property: value; }
/* comment*/
</pre>
<p>This means:</p>
<p>Selector<br />
Is the object you are trying to set the layout for.  It&#8217;s possible to put more than one selector by separating them with a comma.<br />
Ex: paragraphs, header, etc&#8230;</p>
<p>Pseudo class<br />
The pseudo class is a bit tricky and I will talk about that at the end of my tutorial.<br />
Ex: hover, link, visited, etc&#8230;</p>
<p>Property<br />
This is the property you want to set for a specific selector.<br />
Ex: background-color, font-size, etc&#8230;</p>
<p>Value<br />
This is the value you set for the property.<br />
Ex: 1px, #f1f1f1, none, etc&#8230;</p>
<p>Comment<br />
Comment is written between /* */ tags and can be 1 or more lines in length.</p>
<p><strong>Css on objects, classes and unique objects</strong></p>
<p>The selector is actually more then only an id and can be defined in various ways. I guess the best way to show this is by using some examples.<br />
This will set all paragraphs in your page with the background color red.</p>
<pre class="brush: css; title: ; notranslate">
p { background-color: red;}
&lt;p&gt;blabla&lt;/p&gt;
</pre>
<p>This will set all paragraphs with the class nature with a background green.</p>
<pre class="brush: css; title: ; notranslate">
p.nature { background-color: green; }
&lt;p class=&quot;nature&quot;&gt;blabla&lt;/p&gt;
</pre>
<p>This will put a background color green on every paragraph and a brow background color on every font with class tree within the nature paragraph.</p>
<pre class="brush: css; title: ; notranslate">
p.nature { background-color: green; }
p.nature font.tree { background: brown; }
&lt;p class=&quot;nature&quot;&gt; blabla &lt;font class=&quot;tree&quot;&gt; more bla &lt;/font&gt;
&lt;/p&gt;
</pre>
<p>If you are willing to put a layout on 1 specific object you can do that by using the #. In this case, the paragraph sky will get a blue background.</p>
<pre class="brush: css; title: ; notranslate">
#sky { background-color: blue}
&lt;p id=&quot;sky&quot;&gt;blabla&lt;/p&gt;
</pre>
<p>This part is very important because you can save tons of time and code by using classes and ids.</p>
<p><strong>Basic css properties and there values</strong></p>
<p>There are quite a few different properties and not all properties can be used on any object.</p>
<p>It&#8217;s not very complex, but with some try and error you&#8217;ll find your way quite fast in the exciting world of properties. <img src='http://www.devexp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I&#8217;ll give some examples first from simple to a bit more difficult and there possible values.</p>
<pre class="brush: css; title: ; notranslate">
background-color: #cccccc;
/* #cccccc is a grey color and can also be replaced by the string 'grey' */

margin: 5px;
/* this will put a margin of 5 pixels round the element */

font-size: normal;
/* The font size can also be replaced with number of px,em or % */

background: #FFFFFF url(image.jpg) repeat-x scroll left top;
/* As you can see it is also possible to add more than 1 value to some properties. */

#FFFFFF:          /* Is the default color the background has */
url(image.jpg)    /* is the image that will be displayed on the background*/
repeat-x          /*  is the way it will be repeated in. x is horizontal, y is vertical*/
scroll            /* sets if the image will be fixed or scroll with the rest of the page*/
left top          /* is where the background starts*/

/* Those are the more complex properties but can easily split up into different css properties if it's too complex.*/
background-color:  #FFFFFF;
background-image:  url(image.jpg);
background-repeat:  repeat-x;
background-attachment: scroll;
background-position: top left;
</pre>
<p>More properties are possible and you can find them other websites that I got lined up in the last part: &#8216;where to find good information on css&#8217;</p>
<p>&lt;strong&gt;The pseudo class&lt;/strong&gt;</p>
<p>These are used to add special effects to the object they are put on.</p>
<p>In this example you will add different text colors when the link is visited, hovered or active</p>
<pre class="brush: css; title: ; notranslate">
a:link {color:#FF0000}     /* unvisited link */
a:visited {color:#00FF00}  /* visited link */
a:hover {color:#FF00FF}    /* mouse over link */
a:active {color:#0000FF}   /* selected link */
</pre>
<p>Other pseudo-classes are possible like: first-child, focus, lang, etc&#8230;</p>
<p><strong>Where to find good information on css</strong></p>
<p><a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets" target="_blank">General information </a><br />
<a href="http://jigsaw.w3.org/css-validator/" target="_blank">Test your css</a><br />
<a href="http://www.w3.org/Style/CSS/" target="_blank">Official w3c website </a></p>
<p>Off course this doesn&#8217;t cover the whole story as this is only a basic guide.</p>
<p>I just hope you have some advantage from reading this.</p>
<p>C u next time. K.</p>
<div class="shr-publisher-899"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/09/01/basic-tips-and-tricks-4-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

