<?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>Euro PC Solutions Blog</title>
	<atom:link href="http://blog.europcsolutions.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.europcsolutions.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 23 Aug 2011 13:50:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>PHP &#8211; Preparing Your Computer</title>
		<link>http://blog.europcsolutions.com/php-preparing-your-computer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-preparing-your-computer</link>
		<comments>http://blog.europcsolutions.com/php-preparing-your-computer/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 13:50:24 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[PHP & MySQL]]></category>
		<category><![CDATA[PHP & MySQL Lessons]]></category>
		<category><![CDATA[Learn PHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Start PHP]]></category>
		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://blog.europcsolutions.com/?p=401</guid>
		<description><![CDATA[We now know that PHP is run on the server whose role is to generate pages. However, only a server can read PHP, and your computer is not a server. So how will you create a dynamic website if PHP doesn&#8217;t even work on your computer ? There&#8217;s no need to worry : we&#8217;ll temporarily [...]]]></description>
			<content:encoded><![CDATA[<p>We now know that PHP is run on the server whose role is to generate pages. However, only a server can read PHP, and your computer is not a server. So how will you create a dynamic website if PHP doesn&#8217;t even work on your computer ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised PHP   Preparing Your Computer" class='wp-smiley' title="PHP   Preparing Your Computer" /> </p>
<p>There&#8217;s no need to worry : we&#8217;ll temporarily transform your computer into a server so that you can work on your dynamic site. You&#8217;ll finally be able to start programming after this chapter !</p>
<h2>Which programs do we need ?</h2>
<p>Depending on if we&#8217;re making static or dynamic sites we need different programs. In fact, when we&#8217;re creating dynamic sites we need a few more programs ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin PHP   Preparing Your Computer" class='wp-smiley' title="PHP   Preparing Your Computer" /> </p>
<h3>For a static site</h3>
<p>Web designers that create static sites are lucky, in general they already have all the programs they need :</p>
<ul>
<li>
<p class="floated-image-right"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/05/firefox.jpg" alt="firefox PHP   Preparing Your Computer" title="Mozilla Firefox" width="250" height="114" class="alignnone size-full wp-image-408" /></p>
<p class="floated-text-right"><b>A text editor</b> : in theory a program such as Notepad that&#8217;s pre-installed on Windows is enough, although it is recommended that you use a more advanced tool such as Notepad ++ or Dreamweaver. We&#8217;ll talk about the choice of editor at the end of this chapter.</p>
</li>
<li>
<p><b>A web browser</b> : allows you to test your web pages. You can use for example Mozilla Firefox, Internet Explorer, Google Chrome, Opera, Safari, or any other browser you use for surfing the web. It is recommended to regularly test your sites on different browsers.</p>
</li>
</ul>
<p>However, if you&#8217;re working on a dynamic site, these programs aren&#8217;t enough. It is necessary to install extra programs.</p>
<h3>For a dynamic site</h3>
<p>So that your computer can read PHP, it needs to act like a server. Don&#8217;t worry, you don&#8217;t need to buy a special machine for this : you simply need to install the same programs that are installed on the servers that deliver content on the internet.</p>
<p>What are these programs that we need ?</p>
<ul>
<li>
<p class="floated-image-right"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/05/apache.jpg" alt="apache PHP   Preparing Your Computer" title="Apache Server" width="171" height="100" class="alignnone size-full wp-image-412" /></p>
<p class="floated-text-right"><b>Apache</b> : is what we call a web server. This is the most important program because it delivers the pages to the clients. However, Apache can only handle static web pages (it can only read HTML code). It therefore needs other programs to work with it.</p>
</li>
<li>
<p><b>PHP</b> : is an Apache plugin that allows it to handle dynamic web pages in PHP. By combining Apache and PHP your computer will already be able to read PHP web pages.</p>
</li>
<li>
<p><b>MySQL</b> : is the database management system I talked about in the introduction. It saves the data in an organised manner (such as the list of members on your site). We won&#8217;t need it immediately, but we&#8217;ll install straight away.</p>
</li>
</ul>
<p>All these programs that will help us create dynamic sites are free. There are others (that sometimes cost money), but the Apache + PHP + MySQL combination is the most popular on web servers. It&#8217;s so popular that &#8220;packs&#8221; have been created which contain all these programs. It is possible to install them one by one but that takes time and won&#8217;t have any benefits (unless you&#8217;re a server administartor, which you probably won&#8217;t be <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink PHP   Preparing Your Computer" class='wp-smiley' title="PHP   Preparing Your Computer" />  ).</p>
<p>We&#8217;ll see how to install the &#8220;pack&#8221; that suits you depending on your operating system during the rest of this chapter.</p>
<h2>In Windows : XAMPP</h2>
<p>There are several packages that exist for Windows. I&#8217;m going to show you XAMPP which I have used for the last couple of years.</p>
<p>Start by downloading XAMPP from the <a href="http://www.apachefriends.org/en/xampp-windows.html#641" title="Download XAMPP" target="_blank">official site</a>. You don&#8217;t need to download the add-ons. The installer should be enough.</p>
<p>Once you&#8217;ve downloaded it just install it by leaving all the options by default (the different things don&#8217;t need to be services). It should install itself in a folder like C:/xampp and create a shortcut in the start menu.</p>
<p>When you launch XAMPP, an icon will appear in the task bar :</p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/05/xampp-taskbar.jpg" alt="xampp taskbar PHP   Preparing Your Computer" title="XAMPP tray icon" width="287" height="40" class="alignnone size-full wp-image-418" /></p>
<p>Clicking once on the icon will make the control panel appear. Just start Apache and MySQL to be able to run PHP :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/05/control-panel1.png" rel="shadowbox[sbpost-401];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/05/control-panel1.png" alt="control panel1 PHP   Preparing Your Computer" title="XAMPP Control Panel" width="453" height="356" class="alignnone size-full wp-image-422" /></a></p>
<p>You can now go to XAMPP&#8217;s home page. To do this simply go into XAMPP&#8217;s control panel and click on the Admin button next to Apache :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/05/apache-admin.png" rel="shadowbox[sbpost-401];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/05/apache-admin.png" alt="apache admin PHP   Preparing Your Computer" title="Apache Admin Button on XAMPP Control Panel" width="453" height="354" class="alignnone size-full wp-image-426" /></a></p>
<p>A similar screen to the one below should appear in your default browser. If the page displays itself, it means apache is running correctly.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/08/xampp-windows.png" rel="shadowbox[sbpost-401];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/08/xampp-windows-560x257.png" alt="xampp windows 560x257 PHP   Preparing Your Computer" title="XAMPP for Windows home screen" width="560" height="257" class="alignnone size-large wp-image-427" /></a></p>
<p class="green-text">The web page you can see on the screen has been sent your own local server that was installed at the same time as XAMPP. You are the only person that can see this server. Notice that the URL at the top of your screen starts with http://localhost which means that the work is on your computer.</p>
<p>To create a new web site you need to make a new folder inside C:/xampp/htdocs/. This is the folder for all web sites running on your localhost. For example, in the image below, I&#8217;ve made a new website called test :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/08/htdocs.png" rel="shadowbox[sbpost-401];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/08/htdocs-560x488.png" alt="htdocs 560x488 PHP   Preparing Your Computer" title="htdocs folder in xampp" width="560" height="488" class="alignnone size-large wp-image-428" /></a></p>
<p>Now, to view your new site, you simply need to open your browser and go to http://localhost/test (replace test with the name of your site) :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/08/test.png" rel="shadowbox[sbpost-401];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/08/test-560x237.png" alt="test 560x237 PHP   Preparing Your Computer" title="New test site in xampp" width="560" height="237" class="alignnone size-large wp-image-429" /></a></p>
<p>If you&#8217;re using Mac there is a good tutorial <a href="http://sawmac.com/mamp/" title="Install MAMP on Mac OS" target="_blank">here</a></p>
<p>If you&#8217;re using Linux there is a good tutorial <a href="http://ubuntuforums.org/showthread.php?t=223410" title="Setup XAMPP on Linux" target="_blank">here</a></p>
<h2>Use a good text editor</h2>
<p>As you already know, to modify the source code of a web page there are several solutions :</p>
<ul>
<li>Use a simple text editor that you already have, such as <strong>Notepad</strong>. To open it go to Start/Programs/Accessories/Notepad. This program is enough to write HTML &#038; CSS and even PHP but&#8230;</li>
<li>The best is to use a <strong>specialised program</strong> that colours your code to make it easier to read. You&#8217;ve probably already installed one if you&#8217;ve read <a href="http://blog.europcsolutions.com/html-getting-started/" target="_blank" title="HTML - Getting Started">HTML &#8211; Getting Started</a> from our <a href="http://blog.europcsolutions.com/category/html-css/" target="_blank" title="HTML / CSS Lessons">HTML &#038; CSS Lessons</a></li>
</ul>
<p>Whatever editor you choose to use, it won&#8217;t change how you learn PHP: everything will be the same for everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/php-preparing-your-computer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; Introduction To PHP</title>
		<link>http://blog.europcsolutions.com/php-introduction-to-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-introduction-to-php</link>
		<comments>http://blog.europcsolutions.com/php-introduction-to-php/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 15:36:52 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[PHP & MySQL]]></category>
		<category><![CDATA[PHP & MySQL Lessons]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=338</guid>
		<description><![CDATA[This is the first chapter of the PHP/MySQL lessons. We'll see what PHP and MySQL do and see what other solutions can be used in their place.]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php-banner.png" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php-banner.png" alt="php banner PHP   Introduction To PHP" title="PHP - Introduction To PHP" width="580" height="200" class="alignnone size-full wp-image-353" /></a></p>
<p>What makes the success of the web today is its ease of access and its simplicity. A web surfer doesn&#8217;t need to know <q>how everything works in the background</q>.</p>
<p>On the other hand, novice web masters such as you must, before anything else, know the basics of the workings of a web site. What is a server and a client ? How do you make a dynamic site ? What are PHP and MySQL ?</p>
<p>This first chapter is here to answer all these questions and to show you that you are capable of making a dynamic web site.</p>
<p>Before we start I would like to thank our friends at <a href="http://www.sitesuzero.com" title="Visit Le Site Du Zero" target="_blank">Le Site Du Zero</a> for letting me adapt their lessons. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<h2>Static And Dynamic Web Sites</h2>
<p>We&#8217;ll say that there are 2 types of web sites : <strong>static</strong> and <strong>dynamic</strong> sites.</p>
<ul>
<li>
<p class="floated-image-right"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/elephant.gif" alt="elephant PHP   Introduction To PHP" title="PHP Mascot - elePHPant" width="130" height="80" /></p>
<p class="floated-text-right"><strong>Static sites</strong> : they are sites made using (X)HTML &#038; CSS. They work very well but their content can&#8217;t be updated automatically : the owner of the site (the webmaster) must modify the source code to add anything. It&#8217;s not very useful when your site needs updating several times a day ! Static sites are therefore useful for making <q>show case</q> web sites, for example to present a business or company, without going any further. This type of site is becoming rarer today, because as soon as you add an element for interaction (such as a contact form), we stop talking about static sites, but talk instead of dynamic sites.</p>
</li>
<li>
<p><strong>Dynamic sites</strong> : more complicated, they use other languages as well as (X)HTML and CSS, such as PHP and MySQL. The content of these sites is said to be <q>dynamic</q> because it can be changed without the presence of the webmaster ! Most of the sites you use nowadays, including Euro PC Solutions, are dynamic sites. The only prerequisites you need to learn to make a dynamic web site is to already know how to make sites using (X)HTML and CSS (you can read my <a href="http://blog.europcsolutions.com/category/html-css/" title="Read HTML / CSS Lessons" target="_blank">lessons on XHTML and CSS</a> to learn this).</p>
</li>
</ul>
<p>The purpose of these lessons is to make you capable of making a dynamic web site by yourself, step by step.<br />
This allows you to make more exciting things than a static site. Here are some things you&#8217;ll be able to make after these lessons :</p>
<ul>
<li><strong>A member area</strong> : Visitors will be able to register to your site and access reserved areas</li>
<li><strong>A forum</strong> : Nowadays websites often propose forums to let people help each other out or just to discuss</li>
<li><strong>A visitor counter</strong> : You can easily count the number of visitors that have been on your site or know the number that are currently browsing !</li>
<li><strong>News</strong> : You can automise the writing of news and give the visitors the possibility of adding news or comments etc.</li>
<li><strong>A newsletter</strong> : You can regularly send an email to all your visitors with the latest news and persuade them to visit your site again</li>
</ul>
<p>Of course, these are only examples. It&#8217;s possible to go a lot further, everything depends on your needs. You should know for example that most online games are dynamic. You can find for example games for raising animals, conquering space etc. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<p>But&#8230;let&#8217;s not get carried away. Before getting there you have lots of things to learn ! Let&#8217;s start by the basics : do you know what happens when you open a web page ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<h2>How Does A Web Site Work ?</h2>
<p>When you want to visit a web site you write its address in your web browser, whether it&#8217;s Mozilla Firefox, Internet Explorer, Opera, Safari or another. But have you ever asked yourself how the web page gets to your computer ?</p>
<p>You need to know that the internet is a network of computers. These can be classed into 2 categories :</p>
<ul>
<li>
<p><strong>Clients</strong> : They are the computers of web surfers such as yourselves. Your computer is therefore a client. Each client represents a visitor on a web site. In the following diagrams, the computer of a client will be represented by this image :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/pc.png" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/pc.png" alt="pc PHP   Introduction To PHP" title="PC - Client Machine" width="100" height="100" class="alignnone size-full wp-image-343" /></a></p>
</li>
<li>
<p><strong>Servers</strong> : These are very powerful computers that store web sites and send them out to client computers. Most web browsers will never see a server in their life. However, servers are necessary for the internet to work. Servers will be represented like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server.png" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server.png" alt="server PHP   Introduction To PHP" title="A Server" width="99" height="136" class="alignnone size-full wp-image-344" /></a></p>
<p class="green-text">Most of the time, a server doesn&#8217;t even have a screen : it stays on and works without human intervention, 24h/24, 7d/7</p>
</li>
</ul>
<p>Quick summary : your computer is called a <em>client</em> and the computer that stores web sites is called a <em>server</em>. How do they communicate ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<p>That&#8217;s where the difference lies between a static site and a dynamic site. Let&#8217;s see what changes.</p>
<h3>The Case Of A Static Site</h3>
<p>When a site is static, the diagram is very simple. There are 2 steps :</p>
<ol>
<li>The client asks the server for a web page</li>
<li>The server answers back by sending the web page</li>
</ol>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/static1.jpg" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/static1.jpg" alt="static1 PHP   Introduction To PHP" title="Communications Diagram For A Static Website" width="500" height="159" class="alignnone size-full wp-image-345" /></a></p>
<p>The communication is therefore quite simple :</p>
<ul>
<li><q>Hello, I&#8217;m the client, I would like to see a web page</q></li>
<li><q>There you go, here&#8217;s the page you asked for</q></li>
</ul>
<p>On a static site nothing else happens. The server stores the web pages and sends them to the client when asked for without modifying them.</p>
<h3>The Case Of A Dynamic Site</h3>
<p>When a site is dynamic, there is an intermediate step : the page is <em>generated</em>.</p>
<ul>
<li>The client asks the server for a web page</li>
<li>The server prepares the page specially for the client</li>
<li>The server sends the page that has been generated</li>
</ul>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/dynamic.jpg" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/dynamic.jpg" alt="dynamic PHP   Introduction To PHP" title="Communications Diagram For A Dynamic Website" width="500" height="159" class="alignnone size-full wp-image-346" /></a></p>
<p>The web page is generated each time that the client asks for it. That&#8217;s precisely what makes web sites dynamic : the content of the page can be changed from one moment to another.</p>
<p>That&#8217;s how some sites can show for example your username on every page. Because the server generates a new page every time a visitor asks for one, it can personalise the page depending on the visitor (and show the username among other things).</p>
<h2>The Web Languages</h2>
<p>When we make web sites, we use not one, but several languages. As a webmaster you must know them.</p>
<p class="green-text">Some programs, called WYSIWYG (What You See Is What You Get), allow beginners to make static web sites without knowing any of the languages&#8230;But to make a dynamic site like we want, you must know them.</p>
<h3>For A Static Site : XHTML and CSS</h3>
<p>A number of languages have been invented for creating web sites. Two of them are absolutely necessary for webmasters.</p>
<ul>
<li>
<p><strong>XHTML</strong> : Is the language at the root of every web site. It&#8217;s a lot like HTML but imposes some stricter rules. I recommend that you use XHTML instead of HTML because it makes you take care with your code.<br />
XHTML is easy to learn and works with tags. Here&#8217;s an example of XHTML code :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Hello, I'm a &lt;em&gt;paragraph&lt;/em&gt; of text !&lt;/p&gt;
</pre>
</li>
<li>
<p><strong>CSS</strong> : Is the language that creates the design of web sites. Whereas XHTML inserts the content of a site and creates the structure, CSS sorts out the design and look. It&#8217;s with CSS that we can choose the colour of the text, the size of the menu etc. Here&#8217;s an example of CSS :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.banner {
     text-align: center;
     font-weight: bold;
     font-size: 120%;
}
</pre>
</li>
</ul>
<p>These languages are used on every web site. When a server sends a web page to the client, it sends the XHTML and CSS code.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html1.jpg" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html1.jpg" alt="html1 PHP   Introduction To PHP" title="Communications Diagram For HTML" width="500" height="146" class="alignnone size-full wp-image-347" /></a></p>
<p>The problem is that when you <em>only</em> know XHTML and CSS, you can only make static sites&#8230;and not dynamic sites ! To make these you need to know other languages as well as XHTML and CSS.</p>
<p>The question you therefore need to ask yourself is : do you know XHTML and CSS ?</p>
<p>If the answer is yes, that&#8217;s perfect, you can continue because we&#8217;ll need it during these lessons. If the answer is no, don&#8217;t panic. XHTML and CSS aren&#8217;t very difficult, everyone can learn them. You can learn them by reading my <a href="http://blog.europcsolutions.com/category/html-css/" title="Read the XHTML and CSS lessons" target="_blank">XHTML and CSS lessons</a>.<br />
You can learn these languages in a couple of weeks, or less if you have enough spare time. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<h3>For A Dynamic Site : Add PHP and MySQL</h3>
<p>Whatever the site you want to create, XHTML and CSS are indispensable. However, they aren&#8217;t enough to make a dynamic site. They need to be completed with other languages.</p>
<p>And that is the whole purpose of these lessons : you&#8217;ll learn to use PHP and MySQL to make dynamic sites.</p>
<ul>
<li>
<p><strong>PHP</strong> : It&#8217;s a language that only servers can understand and that allows us to make sites dynamic. It&#8217;s PHP that <q>generates</q> pages like we saw on the above diagrams.<br />
It&#8217;s the first language that we&#8217;ll discover in these lessons. It can work by itself, but is only really interesting if it is combined with MySQL. Here is some PHP code :</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php echo &quot;You are visitor number &quot; . $nb_visitors; ?&gt;
</pre>
</li>
<li>
<p><strong>MySQL</strong> : It&#8217;s what we call an RDBMS (Relational Database Management System). To keep things simple, its purpose is to store data in an organised way so that you can easily find and use it. It&#8217;s with MySQL that you&#8217;ll be able to store the number of visitors on your site, the messages written on a forum etc. The language that allows us to communcicate with a database is called SQL. Here&#8217;s some code written in SQL :</p>
<p><strong>Code : SQL</strong></p>
<pre class="brush: sql; title: ; notranslate">
SELECT id, author, message, datemsg FROM visitorbook, ORDER BY datemsg DESC LIMIT 0,10
</pre>
</li>
</ul>
<p class="green-text">PHP and MySQL are what we call freeware. Among other things this guarantees lasting quality : everybody can contribute to the development, and there&#8217;s no risk of webmasters losing interest in it all of a sudden meaning that it would be dropped, and that is very important !<br />
PHP and MySQL are also available for free. Because of that you won&#8217;t have to give away a penny to make your site ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<p>PHP can work by itself and is enough to make a dynamic web site, but it becomes really interesting when it&#8217;s combined with an RDBMS such as MySQL. However to simplify things, we&#8217;ll forget MySQL for the moment and concentrate on PHP. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<h3>PHP Generates XHTML</h3>
<p>Clients are incapable of understanding PHP code, they only know XHTML and CSS. Only the server can read PHP.</p>
<p>The role of PHP is to generate XHTML code (we can also generate CSS but it&#8217;s rarer) which is then sent to the client like a static site :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php.jpg" rel="shadowbox[sbpost-338];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php.jpg" alt="php PHP   Introduction To PHP" title="Communications Diagram For PHP" width="500" height="146" class="alignnone size-full wp-image-349" /></a></p>
<p>PHP is a programming language that is used on many servers to make decisions. It&#8217;s PHP that decides what XHTML will be generated and sent to the client each time.</p>
<p>To understand the point of that, let&#8217;s take an example. In PHP we can write : <em><q>If the visitor is a member on my site and he&#8217;s called Jonathan, show &#8216;Hello Jonathan&#8217; on the web page. If he&#8217;s not a member, show &#8216;Hello&#8217; and give him the choice of inscription.</q></em><br />
It&#8217;s a very basic example of a dynamic site : depending on if you&#8217;re a member or not, you won&#8217;t see the same things and you won&#8217;t have access to the same things.</p>
<h2>And The Competition ?</h2>
<p>XHTML and CSS don&#8217;t have any competition because they&#8217;re standards. Everybody is supposed to know them and use them on every web site.</p>
<p>On the other hand, with dynamic sites, PHP and MySQL are far from being the only languages available. I can&#8217;t give you a complete list of alternatives, it would be too long (and boring !). However, for your general culture, you should know some of the other big names.</p>
<p>To start with, even though we often combine PHP and MySQL to make powerful dynamic sites, we shouldn&#8217;t mix up the two languages. The first has different elternatives to the second language.</p>
<h3>The Competition Of PHP</h3>
<p>Among the competition of PHP we can find :</p>
<p class="floated-image-right"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/ruby.jpg" alt="ruby PHP   Introduction To PHP" title="Ruby On Rails Logo" width="69" height="88" /></p>
<ul class="floated-text-right">
<li><strong>ASP .NET</strong> : designed by Microsoft, it uses the .net framework which is well known by C# developers (a framework is a collection of libraries which help developers). this language can be useful if you&#8217;re used to developing in C# and don&#8217;t want to learn too much new information.</li>
<li><strong>Ruby On Rails</strong> : this framework works with the Ruby language and lets you create dynamic sites quickly.</li>
<li><strong>Django</strong> : is similar to Ruby On Rails but uses Python instead of Ruby.</li>
<li><strong>Java and JSP (Java Server Pages)</strong> : more often called <q>JEE</q>, it is particularly used in the professional environment. It demands a certain strictness. The creation of a JEE project often takes longer to design but the system is appreciated by professionals and institutions.</li>
</ul>
<p>I can&#8217;t give the names of all the competition here, but that should give you a good idea. For information, it is also possible to use C or C++, but it is complex and not necessarily adapted (in other words I don&#8217;t really recommend it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" />  )</p>
<p class="blue-text">Which language should I choose ? Which is the best ?</p>
<p>With the subject of these tutorials, you&#8217;d expect me to instantly say <q><em>PHP !</em></q>. But no. In fact, everything depends on your programming knowledge. If you&#8217;ve already used Java, you will quickly be able to use JSP. If you know Python, Django will be good for you.</p>
<p>As for PHP, it&#8217;s distinguished from the other languages because of its large community that can quickly help you on the internet if you have problems. It&#8217;s an easy to use language that is ideal for beginners and professionals : Wikipedia and Facebook are examples of popular, famous sites that use PHP.</p>
<p>Well, there is no best choice. I recommend the language with which you are certain to get help if you have problems. In this sense, PHP is a very good choice.</p>
<h3>The Competition Of MySQL</h3>
<p>As for databases, the choice is yet again very vast.<br />
However, whereas PHP and its alternatives are normally free, that&#8217;s not the case with most RDBMS.</p>
<p>Among the competition of MySQL, I recommend you know (at least by name) :</p>
<p class="floated-image-right"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/oracle.gif" alt="oracle PHP   Introduction To PHP" title="Oracle Logo" width="195" height="62" class="alignnone size-full wp-image-351" /></p>
<ul class="floated-text-right">
<li><strong>Oracle</strong> : is the most famous RDBMS, the most complete and the most powerful. Unfortunately you have to pay for it (and it&#8217;s very expensive), which means it is mainly used in large companies. However there are free versions of Oracle for those who want to learn it.</li>
<li><strong>Microsoft SQL Server</strong> : made by Microsoft, it is often combined with ASP .NET, although it can be used with any language. You do have to pay for it but there are limited free versions.</li>
<li><strong>PostgreSQL</strong> : is a free RDBMS like MySQL which offers some more advanced functions. However it still has some way to go compared to Oracle.</li>
<li><strong>SQLite</strong> : the simplest and smallest RDBMS. It is free like MySQL but has very few functions. Its main advantage is that it&#8217;s very small.</li>
</ul>
<p>Once again this list isn&#8217;t complete but gives you an idea of what exists.<br />
For information, MySQL is by far the most used free RDBMS. Among the professional, paid solutions, Oracle is the most advanced and used but its use is reserved for large companies because of its price.</p>
<p>So really, if your budget is limited, you don&#8217;t have a lot of choice for RDBMS. MySQL is the most used because it is free, and is used by a lot of people that can help you out.</p>
<h3>Several Combinations Are Possible</h3>
<p>As you have seen, there is a large choice of tools for making a dynamic site. Most of them are free.</p>
<p>Normally you should be able to combine these tools as you wish. For example, you can use PHP with a different RDBMS to MySQL, such as Oracle or PostgreSQL. MySQL can be used with any language : Java, Python, Ruby etc.</p>
<p>However, the <strong><q>PHP + MySQL</q></strong> combination is the most common. It&#8217;s not by coincidence that I&#8217;ve decided to write lessons on these two tools <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
<p>You should now have a good idea of what PHP and MySQL allow you to do. If you remember that PHP generates personalised XHTML for each visitor, and MySQL is for storing data, you already know the main idea.</p>
<p>In the first part of this lesson we&#8217;ll discover PHP. We&#8217;ll therefore put MySQL to one side for the moment and won&#8217;t store any data at first. When you&#8217;ve reached a certain level in PHP, we&#8217;ll start to study MySQL and you&#8217;ll be able to start making some interesting things for your fututre sites <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile PHP   Introduction To PHP" class='wp-smiley' title="PHP   Introduction To PHP" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/php-introduction-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML &#8211; List Of XHTML Tags</title>
		<link>http://blog.europcsolutions.com/html-list-of-xhtml-tags/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-list-of-xhtml-tags</link>
		<comments>http://blog.europcsolutions.com/html-list-of-xhtml-tags/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 14:46:10 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[HTML tags]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[xhtml]]></category>
		<category><![CDATA[XHTML tags]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=331</guid>
		<description><![CDATA[This is the last chapter of the HTML lessons. In here you'll find a list of XHTML tags to help you in your web development...]]></description>
			<content:encoded><![CDATA[<p>This chapter will give you a partially complete list of XHTML tags.</p>
<p>Here you will find a large amount of XHTML tags, some that we&#8217;ve already seen in the lessons, and some new ones. Generally, the tags we haven&#8217;t seen are used quite rarely. Maybe you&#8217;ll find something you need in the list <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML   List Of XHTML Tags" class='wp-smiley' title="HTML   List Of XHTML Tags" /> </p>
<p>You can also use this page as a reminder when you&#8217;re developing your web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML   List Of XHTML Tags" class='wp-smiley' title="HTML   List Of XHTML Tags" /> </p>
<p class="red-text"><u>This page does not have every XHTML tag and it&#8217;s done on purpose</u>. I prefer to put less tags and only put the ones that are useful for web development.</p>
<h2>First Level Tags</h2>
<p>First level tags are the ones that structure a XHTML page. They are indispensable to have the <q>minimum</q> code for a web page.</p>
<table class="properties1">
<tr>
<th>Tags</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;html&gt;</td>
<td class="col3">
<p>Main tag of a web page.<br />
It is normally given 2 attributes :</p>
<ul>
<li>xmlns : gets the list of existing xhtml tags</li>
<li>xml:lang : the language of your web page> Use <q>en</q> for an English document, <q>fr</q> for French etc.</li>
</ul>
<p>Most of the time your &lt;html&gt; tag will look something like this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;/head&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;head&gt;</td>
<td class="col3">The header of the page</td>
</tr>
<tr>
<td class="col1">&lt;body&gt;</td>
<td class="col3">The body of the page</td>
</tr>
</table>
<h3>The Minimum Code Of An XHTML Page</h3>
<p>Here you will find the minimum amount of code need to create an XHTML page :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
     &lt;head&gt;
          &lt;title&gt;Title Of The Site&lt;/title&gt;
          &lt;meta-equiv=&quot;Content-Type&quot; content=&quot;text/xhtml; charset=iso-8859-1&quot; /&gt;
     &lt;/head&gt;

     &lt;body&gt;

     &lt;/body&gt;
&lt;/html&gt;
</pre>
<h2>Header Tags</h2>
<p>All these tags go in the header of the page, meaning between &lt;head&gt; and &lt;/head&gt;.</p>
<table class="properties1">
<tr>
<th>Tags</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;link /&gt;</td>
<td class="col3">
<p>This tag allows you to indicate several pieces of information for the page.<br />
It is most commonly used to include a style sheet, like this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; type=&quot;text/css&quot; title=&quot;My Design&quot; href=&quot;style.css&quot; /&gt;
</pre>
<p>It can also be used for 2 or 3 other things :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- Home page of the site --&gt;
&lt;link rel=&quot;start&quot; title=&quot;Home&quot; href=&quot;index.html&quot; /&gt;

&lt;!-- Help page of the site --&gt;
&lt;link rel=&quot;help&quot; title=&quot;Help page&quot; href=&quot;help.html&quot; /&gt;

&lt;!-- RSS feed of the site --&gt;
&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;My site's news&quot; href=&quot;news.xml&quot; /&gt;

&lt;!-- Icon of the site (favicon) --&gt;
&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/x-icon&quot; href=&quot;favicon.ico&quot; /&gt;
</pre>
<p>The favicon is an icon that is generally shown to the left of your site&#8217;s address. It&#8217;s a way to personalise your site a bit more. As for the RSS feed, it&#8217;s a way for people to follow your site&#8217;s news by using a special program (Firefox can do it). RSS feeds are normally generated using PHP (if you can only do HTML/CSS you won&#8217;t really be able to use it).</p>
</td>
</tr>
<tr>
<td class="col1">&lt;meta /&gt;</td>
<td class="col3">
<p>This tag defines the properties of a web page.<br />
It&#8217;s used for a load of things. Here are some examples :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;-- Author of the page --&gt;
&lt;meta name=&quot;author&quot; content=&quot;Euro PC Solutions&quot; /&gt;

&lt;-- Description of the page --&gt;
&lt;meta name=&quot;description&quot; content=&quot;The personal files of NASA&quot; /&gt;

&lt;-- Key words of the page --&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;experiments, physics, chemistry, laboratory&quot; /&gt;

&lt;-- Contact address --&gt;
&lt;meta name=&quot;reply-to&quot; content=&quot;myaddress@email.com&quot; /&gt;

&lt;-- Stop the browser from putting the page in the cache --&gt;
&lt;meta http-equiv=&quot;pragma&quot; content=&quot;no-cache&quot; /&gt;

&lt;-- Character map --&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;

&lt;-- Automatically refresh the page after 10 seconds --&gt;
&lt;meta http-equiv=&quot;refresh&quot; content=&quot;10; URL=http://www.mysite.com&quot; /&gt;
</pre>
<p>Generally, the meta is used for setting the character map, and the page description and keywords.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;script&gt;</td>
<td class="col3">
<p>Allows you to include a script.<br />
It is often used for adding javascript :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
     /* Put your script here */
&lt;/script&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;style&gt;</td>
<td class="col3">
<p>Lets you write CSS code in the page.<br />
It is given the attribute <em>type=<q>text/css</q></em></p>
<p>Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
     /* Put your CSS code here */
&lt;/style&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;title&gt;</td>
<td class="col3">
<p>The title of the web page.<br />
Probably one of the most important tags in a web page. Choose your title well because it has a lot of influence on search engines.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;title&gt;The chemistry experiments of Mr Smith&lt;/title&gt;
</pre>
</td>
</tr>
</table>
<h2>Tags For Text Structure</h2>
<table class="properties">
<tr>
<th>Tag</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;acronym&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Is used to define acronyms like C.I.A.<br />
Normally it is used with the <em>title</em> attribute to give the definition of the acronym when a user rolls over it :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;acronym title=&quot;Central Intelligence Agency&quot;&gt;C.I.A.&lt;/acronym&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;blockquote&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Long quotation.<br />
You must put a paragraph inside the blockquote. Example :</p>
<p><strong>Code :HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;blockquote&gt;
     &lt;p&gt;
          Text of the quotation.
     &lt;/p&gt;
&lt;/blockquote&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;cite&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Average quotation.</td>
</tr>
<tr>
<td class="col1">&lt;q&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Short quotation.</td>
</tr>
<tr>
<td class="col1">&lt;sup&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Put the text in superscript.</td>
</tr>
<tr>
<td class="col1">&lt;sub&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Put the text in subscript.</td>
</tr>
<tr>
<td class="col1">&lt;strong&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Adds a lot of value to the text.<br />
Generally makes the text bold.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;em&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Adds a bit of value to the text.<br />
Generally makes the text italic.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;h6&gt;</td>
<td class="col2">Block</td>
<td class="col3">Very unimportant title</td>
</tr>
<tr>
<td class="col1">&lt;h5&gt;</td>
<td class="col2">Block</td>
<td class="col3">Unimportant title</td>
</tr>
<tr>
<td class="col1">&lt;h4&gt;</td>
<td class="col2">Block</td>
<td class="col3">Not very important title</td>
</tr>
<tr>
<td class="col1">&lt;h3&gt;</td>
<td class="col2">Block</td>
<td class="col3">Average title</td>
</tr>
<tr>
<td class="col1">&lt;h2&gt;</td>
<td class="col2">Block</td>
<td class="col3">Important title</td>
</tr>
<tr>
<td class="col1">&lt;h1&gt;</td>
<td class="col2">Block</td>
<td class="col3">Very important title</td>
</tr>
<tr>
<td class="col1">&lt;img /&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Inserts an image.<br />
Use the <em>src</em> (to indicate the address of the image) and <em>alt</em> (to give text description) attributes. These 2 attributes are obligatory.<br />
Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;images/smiley.png&quot; alt=&quot;smiley face&quot; /&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;a&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Hypertext link.<br />
Give the URL of the destination with the <em>href</em> attribute :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;a href=&quot;otherpage.html&quot;&gt;Go to the other page&lt;/a&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;br /&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Goes to a new line.</td>
</tr>
<tr>
<td class="col1">&lt;p&gt;</td>
<td class="col2">Block</td>
<td class="col3">Creates a paragraph.</td>
</tr>
<tr>
<td class="col1">&lt;hr /&gt;</td>
<td class="col2">Block</td>
<td class="col3">Creates a horizontal separation line.</td>
</tr>
<tr>
<td class="col1">&lt;address&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Lets you insert an address or the author of a document.<br />
Generally makes the text italic.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;del&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Lets you indicate text that has been deleted.<br />
Generally the text is crossed out.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;ins&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Allows you to indicate text that has been added.<br />
Generally the text is underlined.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;dfn&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Indicates a definition.</td>
</tr>
<tr>
<td class="col1">&lt;kbd&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Indicates a code that the visitor must write.</td>
</tr>
<tr>
<td class="col1">&lt;pre&gt;</td>
<td class="col2">Block</td>
<td class="col3">The text inside the <em>pre</em> tag will be shown just like in the source code (including spaces and line breaks). A font of the same size is used everywhere.</td>
</tr>
</table>
<h2>List Tags</h2>
<p>This part includes all the tags that allow you to create lists (bullet point lists, numbered lists, definition lists&#8230;).</p>
<table class="properties">
<tr>
<th>Tag</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;ul&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Unordered bullet point list. You must use &lt;li&gt;&lt;/li&gt; for each element of the list. Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
     &lt;li&gt;An element&lt;/li&gt;
     &lt;li&gt;Another element&lt;/li&gt;
&lt;/ul&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;ol&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Ordered list (with numbers). You must use &lt;li&gt;&lt;/li&gt; for each element of the list. Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ol&gt;
     &lt;li&gt;Element 1&lt;/li&gt;
     &lt;li&gt;Element 2&lt;/li&gt;
&lt;/ol&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;li&gt;</td>
<td class="col2">list-item</td>
<td class="col3">
<p>Lets you create a new element in a list.<br />
The type of this tag is peculiar as it is neither inline nor block. It is a <em>list-item</em></p>
</td>
</tr>
<tr>
<td class="col1">&lt;dl&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Definition list. You must alternate each term (&lt;dt&gt;) with a definition (&lt;dd&gt;). Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;dl&gt;
     &lt;dt&gt;Door&lt;/dt&gt;
     &lt;dd&gt;An opening in a wall to let people enter and exit&lt;/dd&gt;
     &lt;dt&gt;Theatre&lt;/dt&gt;
     &lt;dd&gt;Place for putting on shows&lt;/dd&gt;
&lt;/dl&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;dt&gt;</td>
<td class="col2">Block</td>
<td class="col3">Term to define</td>
</tr>
<tr>
<td class="col1">&lt;dd&gt;</td>
<td class="col2">Block</td>
<td class="col3">Definition of the term</td>
</tr>
</table>
<h2>Table Tags</h2>
<table class="properties">
<tr>
<th>Tag</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;table&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Surrounds the contents of the table. Here&#8217;s a simple example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;caption&gt;Passengers of flight 377&lt;/caption&gt;

     &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Age&lt;/th&gt;
          &lt;th&gt;Country&lt;/th&gt;
     &lt;/tr&gt;

     &lt;tr&gt;
          &lt;td&gt;Carmen&lt;/td&gt;
          &lt;td&gt;33 Yrs Old&lt;/td&gt;
          &lt;td&gt;Spain&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Michelle&lt;/td&gt;
          &lt;td&gt;26 Yrs Old&lt;/td&gt;
          &lt;td&gt;United States&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Ben&lt;/td&gt;
          &lt;td&gt;19 Yrs Old&lt;/td&gt;
          &lt;td&gt;England&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;caption&gt;</td>
<td class="col2">-</td>
<td class="col3">Sets a title for the table</td>
</tr>
<tr>
<td class="col1">&lt;tr&gt;</td>
<td class="col2">-</td>
<td class="col3">Line of a table</td>
</tr>
<tr>
<td class="col1">&lt;th&gt;</td>
<td class="col2">-</td>
<td class="col3">Header cell of a table (contents are generally bold)</td>
</tr>
<tr>
<td class="col1">&lt;td&gt;</td>
<td class="col2">-</td>
<td class="col3">Cell of a table</td>
</tr>
<tr>
<td class="col1">&lt;thead&gt;</td>
<td class="col2">-</td>
<td class="col3">
<p>Optional tag that allows you to insert a header in the table.<br />
If you decide to use &lt;thead&gt;, &lt;tfoot&gt; and &lt;tbody&gt;, they must be used in the following order in your source code :</p>
<ol>
<li>thead</li>
<li>tfoot</li>
<li>tbody</li>
</ol>
</td>
</tr>
<tr>
<td class="col1">&lt;tbody&gt;</td>
<td class="col2">-</td>
<td class="col3">Optional tag to insert the body of a table</td>
</tr>
<tr>
<td class="col1">&lt;tfoot&gt;</td>
<td class="col2">-</td>
<td class="col3">Optional tag to insert the footer of a table.</td>
</tr>
</table>
<h2>Form Tags</h2>
<table class="properties">
<tr>
<th>Tag</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;form&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Surrounds the contents of a form.<br />
It is normally used with 2 attributes :</p>
<ul>
<li>method : indicates the sending method of the form (get or post). If you don&#8217;t know what to put use post.</li>
<li>action : the page towards which the visitor should be redirected after sending the form.</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">&lt;fieldset&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Groups several elements of a form.<br />
Generally used in large forms.</p>
<p>To give a title to the group use the <em>legend</em> tag.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;legend&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Title of a group in a form.<br />
To be used inside &lt;fieldset&gt;</p>
</td>
</tr>
<tr>
<td class="col1">&lt;label&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Title of an element in a form.<br />
Normally, you should use the <em>for</em> attribute with this tag to give the ID of the element that corresponds to the label.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;input /&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Input area.<br />
There are several types of input boxes. Use the type of input you want with the <em>type</em> attribute :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- Text input with one line --&gt;
&lt;input type=&quot;text&quot; /&gt;

&lt;!-- Password (text is hidden) --&gt;
&lt;input type=&quot;password&quot; /&gt;

&lt;!-- Send a file --&gt;
&lt;input type=&quot;file&quot; /&gt;

&lt;!-- Box to tick --&gt;
&lt;input type=&quot;checkbox&quot; /&gt;

&lt;!-- Option button --&gt;
&lt;input type=&quot;radio&quot; /&gt;

&lt;!-- Send button --&gt;
&lt;input type=&quot;submit&quot; /&gt;

&lt;!-- Reset button --&gt;
&lt;input type=&quot;reset&quot; /&gt;

&lt;!-- hidden box --&gt;
&lt;input type=&quot;hidden&quot; /&gt;
</pre>
<p>Think to give names to your fields with the <em>name</em> attribute.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;textarea&gt;</td>
<td class="col2">Inline</td>
<td class="col3">
<p>Text input for several lines.<br />
You can set its size with the <em>row</em> and <em>cols</em> (number of lines and columns) attributes or with the CSS by using width and height.</p>
</td>
</tr>
<tr>
<td class="col1">&lt;select&gt;</td>
<td class="col2">Inline&gt;</td>
<td class="col3">
<p>Scrolling list.<br />
Use the option tag to create each element of the list :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;select name=&quot;country&quot;&gt;
     &lt;option value=&quot;england&quot;&gt;England&lt;/option&gt;
     &lt;option value=&quot;usa&quot;&gt;U.S.A.&lt;/option&gt;
     &lt;option value=&quot;italy&quot;&gt;Italy&lt;/option&gt;
&lt;/select&gt;
</pre>
</td>
</tr>
<tr>
<td class="col1">&lt;option&gt;</td>
<td class="col2">Block</td>
<td class="col3">Element of a scrolling list.</td>
</tr>
<tr>
<td class="col1">&lt;optgroup&gt;</td>
<td class="col2">Block</td>
<td class="col3">
<p>Group of elements in a scrolling list.<br />
To be used in large lists.<br />
Use the <em>label</em> attribute to give a name to the group.</p>
</td>
</tr>
</table>
<h2>Generic Tags</h2>
<p>Generic tags are tags that don&#8217;t do anything before you adapt them to your own use.</p>
<p>In effect, all the other tags do something : &lt;p&gt; is a paragraph, &lt;h1&gt; is an important title etc.<br />
However, sometimes you need generic tags (also called universal tags) because no other tag does what you want. They are mainly used for making web page designs.</p>
<p>There are 2 generic tags : one is inline, the other is a block.</p>
<table class="properties">
<tr>
<th>Tag</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td class="col1">&lt;span&gt;</td>
<td class="col2">Inline</td>
<td class="col3">Generic tag of inline type</td>
</tr>
<tr>
<td class="col1">&lt;div&gt;</td>
<td class="col2">Block</td>
<td class="col3">Generic tag of block type</td>
</tr>
</table>
<p>These tags will only do something if you give them the <em>id, class or style</em> attribute :</p>
<ul>
<li>class : indicates the name of the CSS class to use.</li>
<li>id : gives a name to the tag. Its name has to be unique on the whole page as it identifies the tag. You can use id for many things, like a link to an anchor link for example, for a CSS style for ids, for manipulations in Javascript etc.</li>
<li>style : this attribute allows you to insert CSS straight into the tag. Therefore you don&#8217;t need an external style sheet. However it is better not to use this attribute because using an external style sheet makes it a lot easier to change your design.</li>
</ul>
<p>These 3 attributes aren&#8217;t reserved for generic tags : you can use them on most tags without any problems <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML   List Of XHTML Tags" class='wp-smiley' title="HTML   List Of XHTML Tags" /> </p>
<p>As I said earlier in the chapter, there are several tags that I&#8217;ve left out on purpose.</p>
<p>As you&#8217;ll have notices, everything has its place in XHTML. The main thing is to use the right tag at the right moment.<br />
Theoretically, you could make most of a site just with generic tags (&lt;div&gt; and &lt;span&gt;) by using CSS with them, but your site wouldn&#8217;t make any sense ! Respecting the logic of a web page is indispensable for webmasters. Using the correct tags will get you much better results on search engines such as Google.</p>
<p>Remember that ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML   List Of XHTML Tags" class='wp-smiley' title="HTML   List Of XHTML Tags" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-list-of-xhtml-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS &#8211; List Of CSS Properties</title>
		<link>http://blog.europcsolutions.com/css-list-of-css-properties/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-list-of-css-properties</link>
		<comments>http://blog.europcsolutions.com/css-list-of-css-properties/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 14:26:45 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS Properties]]></category>
		<category><![CDATA[learn css]]></category>
		<category><![CDATA[XHTML / CSS]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=323</guid>
		<description><![CDATA[As promised, here is a rather complete list of useful CSS properties to decorate your website...]]></description>
			<content:encoded><![CDATA[<p>In this chapter I will give you a partially complete list of CSS properties.</p>
<p>My aim is to have a maximum amount of CSS properties on this page. We have already seen a lot of them in the lessons, but there are also properties that we haven&#8217;t had the time to see in the tutorials. Most of them are quite rare but easy to use.</p>
<p>The list is only partial because I don&#8217;t want to make a complete list of CSS properties that exist. There are too many, and a lot of them are never used.<br />
Therefore, I prefer to concentrate on the main ones, and as you&#8217;ll see, there are still a lot of them <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   List Of CSS Properties" class='wp-smiley' title="CSS   List Of CSS Properties" /> </p>
<h2>Properties For Text Formatting</h2>
<p>In this part I&#8217;ll put most of the properties used for <strong>text formatting</strong>.</p>
<p>What is text formatting ? It&#8217;s everything that has to do with the shape and size of the text : bold, italic, underlined, font, alignment etc&#8230;</p>
<h3>Font, Size &#038; Decoration</h3>
<table class="properties">
<tr>
<th class="col1">Type</th>
<th class="col2">Property</th>
<th class="col3">Possible Values</th>
</tr>
<tr>
<td class="col1">Name of the font</td>
<td class="col2">font-family</td>
<td class="col3">
<p>Indicate the names of the fonts in the order you want them :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
font-family: font1, font2, font3;
</pre>
<p>If the visitor has font1 on his computer, font1 will be used. If not, the computer will try font2 then font3 etc.<br />
Use speech marks if the name of a font has spaces in it. Always put the last font as <q>serif</q> or <q>sans-serif</q>.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
font-family: &quot;Arial Black&quot;, Arial, Verdana, serif;
</pre>
</td>
</tr>
<tr>
<td class="col1">Size of the text</td>
<td class="col2">font-size</td>
<td class="col3">
<p>Indicates the size of the text.<br />
Several measurements are possible :</p>
<ul>
<li>px (pixels)</li>
<li>% (percentage, 100% = normal)</li>
<li>em (related size, 1.0 = normal)</li>
<li>ex (related size from the height of the letter <q>x</q>. 1.0 = normal)</li>
<li>name of the size :
<ul>
<li>xx-small</li>
<li>x-small</li>
<li>small</li>
<li>medium</li>
<li>large</li>
<li>x-large</li>
<li>xx-large</li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Bold</td>
<td class="col2">font-weight</td>
<td class="col3">
<ul>
<li>bold</li>
<li>bolder</li>
<li>lighter</li>
<li>normal (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Italic</td>
<td class="col2">font-style</td>
<td class="col3">
<ul>
<li>italic</li>
<li>oblique</li>
<li>normal (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Decoration</td>
<td class="col2">text-decoration</td>
<td class="col3">
<ul>
<li>underline</li>
<li>overline</li>
<li>line-through</li>
<li>blink</li>
<li>none (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Small capitals</td>
<td class="col2">font-variant</td>
<td class="col3">
<ul>
<li>small-caps</li>
<li>normal (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Capitals</td>
<td class="col2">text-transform</td>
<td class="col3">
<ul>
<li>uppercase</li>
<li>lowercase</li>
<li>capitalize</li>
<li>none (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Mega Property</td>
<td class="col2">font</td>
<td class="col3">
<p>Indicate in the order you wish the values for <em>font-weight, font-style, font-size, font-variant, font-family</em>.<br />
<span class="red-text"><strong>Be careful, exception :</strong> the name of the font (font-family), must be last in the list.</span><br />
You don&#8217;t have to put values for every attribute.</p>
<p>Example :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
font: bold, 16px, Arial;
</pre>
</td>
</tr>
</table>
<h3>Alignment</h3>
<table class="properties">
<tr>
<th class="col1">Type</th>
<th class="col2">Property</th>
<th class="col3">Possible Values</th>
</tr>
<tr>
<td class="col1">Horizontal alignment</td>
<td class="col2">text-align</td>
<td class="col3">
<ul>
<li>left (by default)</li>
<li>center</li>
<li>right</li>
<li>justify</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Vertical alignment</td>
<td class="col2">vertical-align</td>
<td class="col3">
<p>Can be used in the cells of a table or in inline elements that are contained inside inline elements :</p>
<ul>
<li>top</li>
<li>middle</li>
<li>bottom</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Distance between lines</td>
<td class="col2">line-height</td>
<td class="col3">Indicate a value in pixels (px) or a percentage (%)</td>
</tr>
<tr>
<td class="col1">Indentation</td>
<td class="col2">text-indent</td>
<td class="col3">
<p>Indicate a value in pixels for the indentation.<br />
Your paragraphs will start with the indentation you&#8217;ve entered.</p>
</td>
</tr>
<tr>
<td class="col1">Line break</td>
<td class="col2">white-space</td>
<td class="col3">
<ul>
<li>normal (by default)</li>
<li>nowrap : no automatic line break unless a &lt;br /&gt; tag is present.</li>
<li>pre : line break are like the source code is presented (like the XHTML tag &lt;pre&gt;)</li>
</ul>
</td>
</tr>
</table>
<h2>Background Colour Properties</h2>
<table class="properties">
<tr>
<th class="col1">Type</th>
<th class="col2">Property</th>
<th class="col3">Possible Values</th>
</tr>
<tr>
<td class="col1">Text colour</td>
<td class="col2">color</td>
<td class="col3">
<p>Indicates the colour with one of the following methods :</p>
<ul>
<li>by writing the name in English (black, blue, green, white, red&#8230;)</li>
<li>with a hexadecimal value (#CC48A1)</li>
<li>with a color in RGB : rgb(128, 255, 0)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Background colour</td>
<td class="col2">background-color</td>
<td class="col3">Works the same as <em>color</em>.</td>
</tr>
</table>
<h3>Background Image</h3>
<table class="properties">
<tr>
<th class="col1">Type</th>
<th class="col2">Property</th>
<th class="col3">Possible Values</th>
</tr>
<tr>
<td class="col1">Background image</td>
<td class="col2">background-image</td>
<td class="col3">
<p>Indicate the URL of the image (absolute or related URL) :</p>
<pre class="brush: css; title: ; notranslate">
background-image: url(&quot;images/bg.png&quot;);  /* related address */
background-image: url(&quot;http://www.mysite.com/images/bg.png&quot;);  /* absolute address */
</pre>
</td>
</tr>
<tr>
<td class="col1">Fixed background</td>
<td class="col2">background-attachment</td>
<td class="col3">
<ul>
<li>fixed</li>
<li>scroll</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Repeat the background</td>
<td class="col2">background-repeat</td>
<td class="col3">
<ul>
<li>repeat : the background repeats all over (by default)</li>
<li>repeat-x : the background only repeats horizontally</li>
<li>repeat-y : the background only repeats vertically</li>
<li>no-repeat : the background doesn&#8217;t repeat, it&#8217;s only shown once</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Position of the background</td>
<td class="col2">background-position</td>
<td class="col3">
<p>There are 2 different methods :</p>
<ul>
<li>
<p>enter a distance in pixels (px) or a percentage (%), in relation to the top-right corner :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
background-position: 50px 200px;  /*50px to the right and 200px down */
</pre>
</li>
<li>
<p>use a predefined value, one for the vertical and one for the horizontal position :</p>
<ul>
<li>top</li>
<li>center</li>
<li>bottom</li>
</ul>
<ul>
<li>left</li>
<li>center</li>
<li>right</li>
</ul>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
background-position: bottom right;
</pre>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Mega background property</td>
<td class="col2">background</td>
<td class="col3">
<p>Indicate one or several values from <em>background-image, background-repeat, background-attachment, background-position</em>.<br />
The order of the values doesn&#8217;t matter and you don&#8217;t have to include values for every property (1 is enough).</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
/* the background bg.png will be shown in the top right and won't be repeated */
background: url(&quot;images/bg.png&quot;) no-repeat fixed top right;
</pre>
</td>
</tr>
</table>
<h2>Box Properties</h2>
<h3>Dimensions</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Width</td>
<td class="col2">width</td>
<td class="col3">Value in px, % or <q>auto</q> (by default, depends on the text or content inside)</td>
</tr>
<tr>
<td class="col1">Height</td>
<td class="col2">height</td>
<td class="col3">Works like width</td>
</tr>
<tr>
<td class="col1">Set minimum width</td>
<td class="col2">min-width</td>
<td class="col3">Indicate a value in pixels for example.</td>
</tr>
<tr>
<td class="col1">Set maximum width</td>
<td class="col2">max-width</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Set minimum height</td>
<td class="col2">min-height</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Set maximum height</td>
<td class="col2">max-height</td>
<td class="col3">Same</td>
</tr>
</table>
<h3>Outside Margins</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Top margin</td>
<td class="col2">margin-top</td>
<td class="col3">Indicate a value like 20px, 1.5em&#8230;</td>
</tr>
<tr>
<td class="col1">Left margin</td>
<td class="col2">margin-left</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Right margin</td>
<td class="col2">margin-right</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Bottom margin</td>
<td class="col2">margin-bottom</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Margin mega property</td>
<td class="col2">margin</td>
<td class="col3">
<p>Indicate between 1 and 4 values. Depending on the number of values the meaning changes :</p>
<ul>
<li>1 value : margin for the top, bottom, left and right</li>
<li>2 values : the first is for the top and bottom margins, the second is for the left and right margins</li>
<li>3 values : the first is the top margin, the second is the left and right margins, the third is the bottom margin</li>
<li>4 values : in the order of the top, right, bottom and left margins</li>
</ul>
</td>
</tr>
</table>
<h3>Inside Margins</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Top padding</td>
<td class="col2">padding-top</td>
<td class="col3">Indicate a value like 20px, 1.5em&#8230;</td>
</tr>
<tr>
<td class="col1">Left padding</td>
<td class="col2">padding-left</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Right padding</td>
<td class="col2">padding-right</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Bottom padding</td>
<td class="col2">padding-bottom</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Padding mega property</td>
<td class="col2">padding</td>
<td class="col3">
<p>Indicate between 1 and 4 values. Depending on the number of values the meaning changes :</p>
<ul>
<li>1 value : padding for the top, bottom, left and right</li>
<li>2 values : the first is for the top and bottom margins, the second is for the left and right margins</li>
<li>3 values : the first is the top margin, the second is the left and right margins, the third is the bottom margin</li>
<li>4 values : in the order of the top, right, bottom and left margins</li>
</ul>
</td>
</tr>
</table>
<h3>Borders</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Width of the border</td>
<td class="col2">border-width</td>
<td class="col3">Indicate a value in pixels (px)</td>
</tr>
<tr>
<td class="col1">Colour of the border</td>
<td class="col2">border-color</td>
<td class="col3">Indicate a colour in English, hexadecimal or RGB</td>
</tr>
<tr>
<td class="col1">Type of border</td>
<td class="col2">border-style</td>
<td class="col3">
<ul>
<li>none (by default)</li>
<li>hidden : invisible border</li>
<li>solid : solid line</li>
<li>double : two parallel lines (needs a minimum border of 3px)</li>
<li>dashed</li>
<li>dotted</li>
<li>inset : 3D effect going away</li>
<li>outset : 3D effect coming out</li>
<li>ridge : another 3D effect</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Left border</td>
<td class="col2">border-left</td>
<td class="col3">
<p>Indicate the colour, thickness and type of border for the left border.<br />
The order doesn&#8217;t matter. Example :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
border-left: 2px inset blue;
</pre>
</td>
</tr>
<tr>
<td class="col1">Top border</td>
<td class="col2">border-top</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Right border</td>
<td class="col2">border-right</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Bottom border</td>
<td class="col2">border-bottom</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Border mega property</td>
<td class="col2">border</td>
<td class="col3">Indicate the colour, thickness and type of border for every side.</td>
</tr>
</table>
<h2>Properties For Positioning &#038; Displaying</h2>
<h3>Displaying</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Type of element</td>
<td class="col2">display</td>
<td class="col3">
<ul>
<li>none : the element won&#8217;t be shown</li>
<li>block : the element becomes a <q>block</q> (like &lt;p&gt;)</li>
<li>inline : the element will become <q>inline</q> (like &lt;br /&gt;)</li>
<li>list-item : the element will become part of a list (like &lt;li&gt;)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Change the visibility</td>
<td class="col2">visibility</td>
<td class="col3">
<ul>
<li>hidden</li>
<li>visible (by default)</li>
<li>none : makes the element go away completely whereas hidden hides the element but the element still takes up room on the screen.</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Only show part of an element</td>
<td class="col2">clip</td>
<td class="col3">
<p>Indicate 4 values like this :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
clip: rect(value1, value2, value3, value4);
</pre>
<p>Allows us to only show a part of an element. rect() allows us to insert the coordinates of the rectangle that will be shown.<br />
Values 1 to 4 correspond respectively to the top, right, bottom and left corners of the rectangle.</p>
</td>
</tr>
<tr>
<td class="col1">Limit visibility</td>
<td class="col2">overflow</td>
<td class="col3">
<ul>
<li>visible : everything will be shown (by default)</li>
<li>hidden : the element will be cut off if it goes past the dimensions set by width and height. You won&#8217;t be able to see the text that has been cut off.</li>
<li>scroll : like with hidden, the element will be cut off. However, this time a scroll bar will be added to allow us to see the rest of the text.</li>
<li>auto : this time the browser decides if a scroll bar needs adding or not. Very often this is just like using <q>scroll</q>.</li>
</ul>
</td>
</tr>
</table>
<h3>Positioning</h3>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Floating</td>
<td class="col2">float</td>
<td class="col3">
<ul>
<li>left : float to the left</li>
<li>right : float to the right</li>
<li>none (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Stop floating</td>
<td class="col2">clear</td>
<td class="col3">
<ul>
<li>left : stops left float</li>
<li>right : stops right float</li>
<li>both : stop left and right floats</li>
<li>none : doesn&#8217;t stop any float</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Type of positioning</td>
<td class="col2">position</td>
<td class="col3">
<ul>
<li>absolute : absolute positioning in relation to the top left corner</li>
<li>fixed : fixed position (works like absolute). The element always stays in the same position on the screen, even when you scroll.</li>
<li>relative : position in relation to the normal position of the element</li>
<li>static : normal position (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Position in relation to the top</td>
<td class="col2">top</td>
<td class="col3">Value in px, em, %&#8230; To be used for absolute, fixed or related positioning.</td>
</tr>
<tr>
<td class="col1">Position in relation to the bottom</td>
<td class="col2">bottom</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Position in relation to the left</td>
<td class="col2">left</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Position in relation to the right</td>
<td class="col2">right</td>
<td class="col3">Same</td>
</tr>
<tr>
<td class="col1">Order of display</td>
<td class="col2">z-index</td>
<td class="col3">
<p>In the case of absolute positioning for example, if 2 elements overlap, z-index allows us to say which element should be shown on top.<br />
Put a num. The higher the number is, the more the element will be brought forward.</p>
<p>For example, if 2 elements are using absolute positioning and they overlap with a z-index of 10 for one, and z-index of 20 for the other, the one with 20 will be at the front.</p>
</td>
</tr>
</table>
<h2>List Properties</h2>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">List style</td>
<td class="col2">list-style-type</td>
<td class="col3">
<ul>
<li>
<p>For unordered lists (&lt;ul&gt;) :</p>
<ul>
<li>disc</li>
<li>circle</li>
<li>square</li>
<li>none</li>
</ul>
</li>
<li>
<p>For ordered lists (&lt;ol&gt;) :</p>
<ul>
<li>decimal</li>
<li>decimal-leading-zero</li>
<li>upper-roman</li>
<li>lower-roman</li>
<li>upper-alpha</li>
<li>lower-alpha</li>
<li>lower-greek</li>
</ul>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Indent list</td>
<td class="col2">list-style-position</td>
<td class="col3">
<ul>
<li>inside : without indent</li>
<li>outside : with indent (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Personalised bullet point</td>
<td class="col2">list-style-image</td>
<td class="col3">
<p>Indicate the URL of the image which will act as a bullet point. Example :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
list-style-image: url(&quot;images/point.jpg&quot;);
</pre>
</td>
</tr>
<tr>
<td class="col1">List mega property</td>
<td class="col2">list-style</td>
<td class="col3">
<p>You can reunite the values of list-style-type, list-style-position and list-style-image. You don&#8217;t have to put values for everything and the order doesn&#8217;t matter.<br />
Example :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
list-style: square inside;
</pre>
</td>
</tr>
</table>
<h2>Table Properties</h2>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Type of border</td>
<td class="col2">border-collapse</td>
<td class="col3">
<ul>
<li>collapse : the borders of the table and cells are merged</li>
<li>separate : the borders are separated (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Display empty cells</td>
<td class="col2">empty-cells</td>
<td class="col3">
<ul>
<li>show : empty cells are visible</li>
<li>collapse : empty cells are hidden (by default)</li>
</ul>
</td>
</tr>
<tr>
<td class="col1">Position of the title</td>
<td class="col2">caption-side</td>
<td class="col3">
<p>Indicate the position of the table&#8217;s title, defined with the &lt;caption&gt; tag :</p>
<ul>
<li>top : top of the table</li>
<li>bottom : bottom of the table</li>
<li>left : to the left of the table</li>
<li>right : to the right of the table</li>
</ul>
</td>
</tr>
</table>
<h2>Other Properties</h2>
<table class="properties">
<tr>
<th>Type</th>
<th>Property</th>
<th>Possible Values</th>
</tr>
<tr>
<td class="col1">Mouse cursor shape</td>
<td class="col2">cursor</td>
<td class="col3">
<ul>
<li>auto</li>
<li>default</li>
<li>pointer</li>
<li>text</li>
<li>wait</li>
<li>progress</li>
<li>help</li>
<li>move</li>
</ul>
<ul>
<li>n-resize</li>
<li>ne-resize</li>
<li>e-resize</li>
<li>se-resize</li>
<li>sw-resize</li>
<li>w-resize</li>
<li>nw-resize</li>
</ul>
<ul>
<li>
<p>url : personalised cursor, in .cur or .ani format. Example :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
cursor: url(&quot;images/cursor.cur&quot;);
</pre>
<p>You must use a special program to create .ani or .cur cursors.</p>
</li>
</ul>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/css-list-of-css-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; W3C &amp; The Web Standards</title>
		<link>http://blog.europcsolutions.com/html-css-w3c-the-web-standards/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-w3c-the-web-standards</link>
		<comments>http://blog.europcsolutions.com/html-css-w3c-the-web-standards/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 13:45:09 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[CSS validator]]></category>
		<category><![CDATA[HTML validator]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[XHTML validator]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=311</guid>
		<description><![CDATA[Your site is maybe finished but it's not necessarily valid. In this chapter we'll see how to validate your XHTML and CSS...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/w3c-banner.png" rel="shadowbox[sbpost-311];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/w3c-banner.png" alt="w3c banner HTML / CSS   W3C & The Web Standards" title="HTML / CSS - W3C And The Web Standards" width="580" height="200" class="alignnone size-full wp-image-321" /></a></p>
<p>This chapter might sound like it&#8217;s pointless but it is really important.<br />
I&#8217;ll warn you straight away : you won&#8217;t learn how to make any super dynamic flashing effects, but you will learn about the history of the web.</p>
<p>Why do we use XHTML nowadays instead of HTML ? Why have we decided to separate the content (XHTML) from the style (CSS) ?<br />
Why do we say that some sites are valid whereas others aren&#8217;t ?</p>
<p>And what about your site&#8230; is it valid ?</p>
<h2>The History Of The Web</h2>
<p>We&#8217;ll start by the basics : the web&#8217;s history. Webmasters should know a bit about the web, when it was created and its history.<br />
It&#8217;s not only <q>general culture</q>, but it will also allow you to understand what follows in this chapter.</p>
<ul>
<li>
<p>Everything started at the beginning of the 70&#8242;s, during a meeting at the Canadian government. A certain William Tunnicliffe suggested separating the content of the information (the text) from the way in which it was shown. Already back then, although the Internet was reserved for a few privileged people, they had the idea of separating the content (which has now become XHTML) from the style (which is now known as CSS).</p>
</li>
<li>
<p>Things started to speed up in 1978, people started to meet up to create a standard language that could evolve.</p>
</li>
<li>
<p>In 1986, the <strong>SGML</strong> was created. This is the abbreviation of <em>Standard Generalized Markup Language</em>. This language was powerful but too complicated. To keep things short, the documentation had 1290 pages ! It never managed to attract the public because of its complexity and never had any major glory <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
</li>
<li>
<p>In 1991, Tim Berners-Lee invented the World Wide Web (abbreviated to WWW). To create the first web pages, Tim Berners-Lee created the <strong>HTML language</strong> which was slightly based on SGML (so it did have a use after all <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" />  ).<br />
HTML (abbreviation of <em>HyperText Markup Language</em> is distributed for free (thanks Tim !)</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/tim-berners-lee.jpg" rel="shadowbox[sbpost-311];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/tim-berners-lee.jpg" alt="tim berners lee HTML / CSS   W3C & The Web Standards" title="Tim Berners-Lee" width="250" height="164" class="alignnone size-full wp-image-313" /></a></p>
</li>
<li>
<p>2 years later, one of the first free browsers was created : it was called Mozaic and it worked on Mac as well as PC.<br />
Between 1993 and 1994, the number of websites grew from 500 to 10 000. The web already seemed to have a great future.</p>
</li>
<li>
<p>Things started to gather pace in Europe. The web started to boom, and there wasn&#8217;t really an organisation in place to monitor its evolution. Somebody needed to make sure that things weren&#8217;t being done haphazardly, <u>people needed to work together to ensure a good evolution of the web</u> (and of HTML !).</p>
</li>
<li>
<p>In 1994, Tim Berners-Lee, the one who created the Web, created the <strong>W3C</strong> (abbreviation of <em>World Wide Web Consortium</em>. He became its director.<br />
The W3C is an organisation with the mission of <q>monitoring</q> the evolution of the web : they needed to stop certain large companies from trying to slow down the evolution of the Web for commercial reasons. The W3C also had the task of designing new versions of HTML, <u>so that the Web could evolve</u>.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/W3C.png" rel="shadowbox[sbpost-311];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/W3C.png" alt="W3C HTML / CSS   W3C & The Web Standards" title="World Wide Web Consortium - W3C" width="315" height="48" class="alignnone size-full wp-image-314" /></a></p>
</li>
<li>
<p>In 2003 about 450 people worked for the W3C.</p>
</li>
</ul>
<p>As you can see, right through its history the Web has been carefully developed, to stop it from becoming a toy for large businesses.<br />
Still today (more now than ever), the W3C has the task of ensuring the correct development of the Web. We will see what it did with the HTML language, and why nowadays the standards are XHTML and CSS.</p>
<h2>From HTML To XHTML</h2>
<p>As I said above, right from the start of the Web, Tim Berners-Lee created the first version of HTML.<br />
In effect, like all programming languages, HTML has known several versions :</p>
<ul>
<li>
<p><strong>HTML 1.0</strong> : the very first version of HTML created by Tim Berners-Lee in 1991.</p>
</li>
<li>
<p><strong>HTML 2.0</strong> : the second version of HTML appeared in 1994 and ended in 1996 with the appearance of HTML 3.0. This version set the base of the following versions of HTML. The rules and specifications of this version were set by the W3C (whereas HTML 1.0 was created by 1 person).</p>
</li>
<li>
<p><strong>HTML 3.0</strong> : having appeared in 1996, this new version of HTML added several possibilities to the language such as tables, applets, scripts, the positioning of text around images etc&#8230;</p>
</li>
<li>
<p><strong>HTML 4.0</strong> : appeared for the first time in 1998, and offers the use of frames (which separate web pages into several areas), complicated tables, improvements in forms etc&#8230; But most of all, this version added the use of cascading style sheets, the famous CSS !</p>
</li>
<li>
<p><strong>XHTML 1.0</strong> : at the beginning of 2000, the W3C decided to clean up the large mess that was HTML. In effect, during its evolution, HTML tags had been <q>invented</q> by Netscape and Internet Explorer (by Microsoft). Some tags worked on one browser but not on another.<br />
The W3C decided <u>to stop the development of HTML</u> and to create a new language. <strong>XHTML</strong> (<em>EXtensible HyperText Markup Language</em>) thereafter became the standard : this language had to work in the same way on all browsers, and no right to invent new tags so long as the W3C hasn&#8217;t authorised it !<br />
Really, there aren&#8217;t that many differences compared to HTML, but the language is <q>Strict</q> : you&#8217;re not allowed to make as many errors as in HTML. That doesn&#8217;t mean however that it is more difficult to use, you just have to get used to it.</p>
<p class="green-text">In the web site creation lessons I&#8217;ve written, I&#8217;ve only talked about XHTML because that&#8217;s the language that&#8217;s used today. You&#8217;ve therefore learnt the correct methods straight away, which will make your sites a lot easier to create. Those who learnt HTML still have some bad habits.</p>
</li>
</ul>
<p>So that&#8217;s the future of the web, and it allows us to make sites that are visible on PDAs, telephones and all sorts of other portable devices.</p>
<p>Can you imagine if there were 35 different audio formats available ? Your CD player could read some of them but not others&#8230; Well, it was the same with XHTML : everybody came together and agreed on the way a web page should work. So in the end everybody wins : you (the webmaster) and them (the visitors).<br />
Therefore creating a standard ensures that everybody speaks and understands the same language.</p>
<h3>And CSS ?</h3>
<p>The history of CSS started in 1996. Everything comes back to the idea of William Tunnicliffe (who I talked about earlier) : he wanted to separate the content from the way a page is displayed. This adds several advantages : it&#8217;s easier to change the appearance of a site, the pages load faster, we can propose several designs easily etc&#8230;</p>
<ul>
<li><strong>CSS 1</strong> : from 1996 the first version of CSS was usable. This language set the base of the language that allows us to present a web page, such as colours, margins, fonts etc&#8230;</li>
<li><strong>CSS 2</strong> : created in 1999, this new version of CSS added several interesting and useful options. We could thereafter use absolute positioning, the pseudo-formats :before and :after etc&#8230;</li>
</ul>
<p>CSS2 has existed since 1999, and yet some browsers (Internet Explorer without wanting to give any names away) still have problems using it correctly. Digesting everything in CSS is not the easiest thing, and there are always bugs. The problem is that it&#8217;s us, the webmasters, who are paying the price because we constantly have to check for differences between browsers. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
<p>However, as you know, creating an XHTML page and CSS is quite simple. The only tricky thing (even for experienced webmasters) is creating a website that works correctly on all the recent browsers (Firefox, Safari, Google Chrome, Opera) AND on Internet Explorer which is an individual case.</p>
<h3>Is Your Site Valid ?</h3>
<p>For the last part of this chapter, we&#8217;ll stop talking and do a bit of work.<br />
What I&#8217;ve told you up to now was to teach you the history of the web, but also to make you more aware of what will follow&#8230;</p>
<p class="blue-text">What is validation ?<br />
There are sites that are valid and others that aren&#8217;t ?</p>
<p>Remember : the W3C put in place the standards. You must respect them so that all the sites speak the same <q>language</q>.</p>
<p>On its site, the W3C (<a href="http://www.w3.org" title="Visit the W3C" target="_blank">http://www.w3.org</a>) offers a tool called a <q>Validator</q>.<br />
The validator is a kind of program that analyses your source code and tells you if it is correct or if there are errors that need correcting.</p>
<p>There are 2 different validators :</p>
<ul>
<li>An (x)HTML validator</li>
<li>A CSS validator</li>
</ul>
<p>We will learn how to use both of them by starting with the XHTML validator.<br />
Before we start, I should warn you, the validator will probably show you a few errors. Don&#8217;t worry, it&#8217;s normal the first time <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> <br />
However, the CSS validator shouldn&#8217;t show too many errors; it&#8217;s harder to make errors in CSS than in XHTML.</p>
<h3>The XHTML Validator</h3>
<p>Let&#8217;s start by the hardest bit first <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
<p>First of all, bookmark this page, it&#8217;s the XHTML validator : <a href="http://validator.w3.org" title="XHTML Validator" target="_blank">http://validator.w3.org</a>.<br />
Those who downloaded the <q>Web Developer</q> plugin for Firefox can automatically validate the code with a special menu. There is also a great plugin for Firefox called <a href="https://addons.mozilla.org/en-US/firefox/addon/249/" title="Download HTML Validator" target="_blank">HTML Validator</a>.</p>
<p>The page you can now see is very simple. There are 2 ways of validating :</p>
<ul>
<li>Either you validate a page that is already on the web. In this case just enter the address of the page (for example : <q>http://www.mysite.com/page.html</q>).</li>
<li>Or you haven&#8217;t yet put your site on the web (the pages are therefore still on your hard drive). You can therefore send the page directly to the validator to be analysed.</li>
</ul>
<p>In both cases, the result will be the same, there&#8217;s no difference.</p>
<p>If everything is alright (don&#8217;t hope too much <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> ), you will get the following message :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-valid.png" rel="shadowbox[sbpost-311];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-valid.png" alt="html valid HTML / CSS   W3C & The Web Standards" title="This Page Is Valid XHTML 1.0 Strict !" width="487" height="45" class="alignnone size-full wp-image-315" /></a></p>
<p class="floated-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/XHTML1-icon.png" alt="XHTML1 icon HTML / CSS   W3C & The Web Standards" title="Valid XHTML code icon" width="88" height="31" /></p>
<p class="floated-text">The site will then allow you to put this icon on your site to show that it respects the XHTML standards and that you respect the rules.<br />
It is not necessary though. If you don&#8217;t like it you don&#8217;t have to use it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
<p>Of course, if your site has several pages, you&#8217;ll have to test them all.</p>
<p class="blue-text">HEELLLPPP MMEEEE <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> <br />
My page isn&#8217;t valid, I&#8217;m never going to manage, there are loads of errors <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
<p>First thing : just because your site displays itself correctly doesn&#8217;t mean that it is valid.<br />
A web page can look wonderful and yet still be full of errors.</p>
<p class="blue-text">What&#8217;s the point in correcting it then ?</p>
<p>As I&#8217;ve said right through this chapter : if your site is in XHTML 1.0, it needs to be coded correctly so that everyone can understand it. Browsers <q>try</q> not to show errors so that the visitor isn&#8217;t disturbed, but nothing is stopping the browsers from showing things badly !</p>
<p>What&#8217;s more, a page that is correctly coded has a better chance of appearing at the top of Google&#8217;s results, which will get you more visitors !</p>
<p>I&#8217;m not going to show you all the possible errors, the list would be too long. I will however show you some of the common mistakes. You&#8217;ll probably notice some of the errors that you&#8217;ve made as well so you&#8217;ll know how to fix them.</p>
<ul>
<li>
<p>First of all, this might seem to be apparent because I said it at the beginning, but I must remind you : the names of your attributes and tags must be written in <strong>lowercase</strong>. The value of an attribute can however include uppercase letters :<br />
&lt;tag attribute=<q>Value of the attribute</q>&gt;</p>
</li>
<li>
<p>Solo tags, like the change line <q>br</q> and the image tag <q>img</q> must <strong>end with a slash</strong> (/) : &lt;br /&gt;<br />
The space between the <q>br</q> and the slash isn&#8217;t necessary but the W3C do recommend putting the space in.</p>
</li>
<li>
<p>All your text must be placed between paragraph tags. You are forbidden from placing text directly between the &lt;body&gt;&lt;/body&gt; tags without putting &lt;p&gt;&lt;/p&gt; tags around the text. This is also the case with the return line tag (&lt;br /&gt;) and images (&lt;img /&gt;) : <strong>these tags must be in the &lt;p&gt;&lt;/p&gt; tags !</strong><br />
This is an extremely common error with beginners. Here&#8217;s an example of what you shouldn&#8217;t do :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Here is some text that's correctly placed in a paragraph.&lt;br /&gt;
&lt;q&gt;br&lt;/q&gt; tags must be placed inside paragraphs, don't forget it.&lt;/p&gt;

This text is placed outside of a paragraph. It's forbidden.&lt;br /&gt;
&lt;q&gt;br&lt;/q&gt; tags are also forbidden outside paragraphs as well as images.
&lt;img src=&quot;thing.png&quot; alt=&quot;This is a thing&quot; /&gt;

&lt;p&gt;This text is once again inside a paragraph, everything is good.&lt;br /&gt;
Don't forget that images must also be inside paragraphs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;thing.png&quot; alt=&quot;This is a thing&quot; /&gt;
(This image is correctly placed in a paragraph)&lt;/p&gt;
</pre>
</li>
<li>
<p><strong>All your images must have an <q>alt</q> attribute</strong> which describes the image :<br />
&lt;img src=<q>photo.jpg</q> alt=<q>A photo of me</q> /&gt;<br />
If your image is purely for decoration purposes (you can&#8217;t find a description), you <u>are allowed</u> to put nothing in the alt attribute like this :<br />
&lt;img src=<q>deco.png</q> alt=<q></q> /&gt;</p>
</li>
<li>
<p>Tags must be <strong>closed in order</strong>. Here&#8217;s what you shouldn&#8217;t do :<br />
<span class="red-text">&lt;p&gt;&lt;em&gt;Important text&lt;/p&gt;&lt;/em&gt;</span><br />
Now, here&#8217;s what you should do :<br />
<span class="green-text">&lt;p&gt;&lt;em&gt;Important Text&lt;/em&gt;&lt;/p&gt;</span><br />
Remember this, a lot of beginners make this mistake.</p>
</li>
<li>
<p>If your links have &#038; signs in them (which is the case for sites using PHP), you must replace the sign with &amp;amp; to avoid confusing the browser. Here&#8217;s a bad example :<br />
<span class="red-text">&lt;a href=<q>http://www.site.com/?day=15&#038;month=10&#038;year=2010</q>&gt;</span><br />
To make this good we just need to replace &#038; with &amp;amp; :<br />
<span class="green-text">&lt;a href=<q>http://www.site.com/?day=15&amp;amp;month=10&amp;amp;year=2010</q>&gt;</span></p>
</li>
<li>
<p>Make sure that you have only used XHTML tags and <strong>no old HTML tags</strong>. If you only use the tags shown during these tutorials, you won&#8217;t have any problems. Using invented tags such as &lt;marquee&gt; or old tags like &lt;frame&gt; will make your page invalid.<br />
The validator will say <q>Element <em>whatever</em> undefined</q> or <q>There is no attribute <em>whatever</em></q></p>
</li>
</ul>
<h3>The CSS Validator</h3>
<p>You&#8217;ll be relieved to know that this will be a lot quicker <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> </p>
<p>First of all, here&#8217;s the link for the CSS validator to add to your bookmarks : <a href="http://jigsaw.w3.org/css-validator" title="CSS validator" target="_blank">http://jigsaw.w3.org/css-validator</a></p>
<p>You need to tell the validator the address of your CSS file. As with XHTML pages, you can also send files from your hard drive.<br />
Just like with XHTML, you might have several files to validate.</p>
<p class="green-text">You don&#8217;t have to directly indicate the CSS file. You can also indicate an XHTML page (.html) and the validator will look for the CSS files that are used (with the help of the &lt;link /&gt; tag !).</p>
<p>You have to make sure that you&#8217;ve validated your XHTML before validating your CSS.<br />
The CSS validator will probably refuse to work if your XHTML still has errors.</p>
<p>Right, generally the CSS validator is the easiest thing in the world.<br />
To have any errors, you need to completely screw things up somewhere or use properties that aren&#8217;t official. Here are some of the rare errors that can be made :</p>
<ul>
<li>
<p>You&#8217;ve <strong>forgotten to end the line of a CSS property with a semi-colon (;)</strong>. If you forget this, the CSS file will be rendered useless.</p>
</li>
<li>
<p>You&#8217;ve <strong>forgotten to give a standard font name to the font-family</strong>. Wrong :<br />
<span class="red-text">font-family: Arial, <q>Trebuchet MS</q>, Impact;</span><br />
Right :<br />
<span class="green-text">font-family: Arial, <q>Trebuchet MS</q>, Impact, sans-serif;</span></p>
</li>
<li>
<p>You&#8217;ve <strong>used an unofficial CSS property</strong>. This is the case with Microsoft who invented, without letting the W3C know, several CSS properties that only work in Internet Explorer.<br />
Among these invented CSS properties, there are <em>scrollbar-face-color</em> and filters like <em>filter: glow()</em>. As these properties aren&#8217;t official, you shouldn&#8217;t use them on your web page.</p>
<p class="floated-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/css-valid.png" alt="css valid HTML / CSS   W3C & The Web Standards" title="Valid CSS Code Icon" width="88" height="31" /></p>
<p class="floated-text">Have you created valid CSS files ? Well done !<br />
You can add the Valid CSS Icon to your site to show that it respects the standards. Once again nobody is forcing you to use this one or stopping you from creating your own design for the logo.</p>
</li>
</ul>
<p>I hope that you enjoyed this chapter and that it helped you. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   W3C & The Web Standards" class='wp-smiley' title="HTML / CSS   W3C & The Web Standards" /> <br />
On a more serious note, this chapter is not to be taken lightly : I&#8217;ve tried to summarise all the different things about the web. It&#8217;s important that your sites are XHTML and CSS valid.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-w3c-the-web-standards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; Putting Your Site On The Web</title>
		<link>http://blog.europcsolutions.com/html-css-putting-your-site-on-the-web/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-putting-your-site-on-the-web</link>
		<comments>http://blog.europcsolutions.com/html-css-putting-your-site-on-the-web/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 22:40:06 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[file transfer]]></category>
		<category><![CDATA[FileZilla]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[registrar]]></category>
		<category><![CDATA[XHTML / CSS]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=286</guid>
		<description><![CDATA[Your site is now finished but because it's still on your hard drive nobody can see it ! In this chapter we'll learn how to put sites on the Internet...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/putting-site-on-the-web.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/putting-site-on-the-web.png" alt="putting site on the web HTML / CSS   Putting Your Site On The Web" title="HTML / CSS - Putting Your Site On The Web" width="580" height="200" class="alignnone size-full wp-image-309" /></a></p>
<p>Your site is finished, looking good, ready&#8230; But as it is on your hard drive, nobody can see it !</p>
<p>You would therefore like to put it on the web but you don&#8217;t know how to do it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> <br />
In this chapter we&#8217;ll discover how to put sites on the internet. In this order :</p>
<ol>
<li>We&#8217;ll find out how to reserve a <strong>domain name</strong></li>
<li>Then we&#8217;ll see what a <strong>web host</strong> is and how it works</li>
<li>Finally, when we&#8217;ve chosen a web host, we&#8217;ll see how to use an <strong>FTP client</strong> to transfer our files to the net <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </li>
</ol>
<h2>Domain Names</h2>
<p>Do you know what a domain name is ?<br />
It is an address on the Web : <strong>europcsolutions.com</strong> for example is a domain name.</p>
<p>A domain name is made up of 2 parts :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/domain-name.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/domain-name.png" alt="domain name HTML / CSS   Putting Your Site On The Web" title="Domain Name Structure" width="327" height="33" class="alignnone size-full wp-image-287" /></a></p>
<ul>
<li><span class="red-text">In red, the name of the domain</span>. It is the name that you can normally choose as you wish, unless somebody reserved it before you. It can contain letters and numbers, but no special characters (like é, ç, space etc.).</li>
<li><span class="blue-text">In blue, the extension</span>. There is more or less one extension per country (.co.uk for the United Kingdom, .fr for France, .ca for Canada). However, there are also extensions that are used at an international level like .com, .net, .org. At first they were reserved for commercial sites, organisations etc&#8230; but everybody can now reserve a domain with these extensions. As such, .com is probably the most used extension in the world.</li>
</ul>
<p class="green-text">Generally, the name of a website is preceded by <q>www</q>, like for example <q>www.europcsolutions.com</q>. This is not a part of the domain name : in fact, <q>www</q> is what we call a sub-domain, which you can in theory create as many as you want when you own the domain name. For example the sub-domain of this site is blog : <strong>blog</strong>.europcsolutions.com.<br />
The <q>www</q> has been adopted by webmasters, as a sort of convention, but is not necessary.</p>
<h3>Reserving A Domain Name</h3>
<p class="blue-text">I want a domain name as well ! How can I get one ?</p>
<p>I have good and bad news <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> <br />
As usual, we&#8217;ll start by the bad news :</p>
<ul>
<li><strong>Bad</strong> : It&#8217;s not free</li>
<li><strong>Good</strong> : It&#8217;s not very expensive <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </li>
</ul>
<p>In effect, a domain name costs between £10 and £40 a year.<br />
The price can change depending on the extension of the name. Therefore, the extension .info is generally proposed at a very low price and can be a very interesting alternative. However, if you want a more <q>common</q> address, you should look for .com or .co.uk (depending on where you live) extensions.</p>
<p>To reserve a domain name, there are 2 solutions :</p>
<ul>
<li>Use a specialised <strong>registrar</strong>. It&#8217;s an organism which acts as an intermediate between ICANN (the organisation which controls the international names such as .com) and you. <a href="http://www.uk2.net" title="Visit UK2.NET" target="_blank">UK2.NET</a>, <a href="http://www.123-reg.co.uk/" title="Visit 123 Reg" target="_blank">123-Reg</a> and <a href="http://www.godaddy.com/" title="Visit GoDaddy" target="_blank">Go Daddy</a> are popular registrars.</li>
<li>Even better, you can order the domain name at the same time as the hosting (which I highly recommend). That way you get everything sorted out, and in any case you&#8217;ll need both a name and hosting.</li>
</ul>
<p>In this chapter, we&#8217;ll see how to order a domain name at the same time as the hosting, it&#8217;s the easiest and cheapest solution for you.</p>
<h2>The Host</h2>
<p>Now let&#8217;s have a look at the host.</p>
<p class="blue-text">What is a host and why do I need it ?</p>
<p>On the Internet, all the sites are stored on special computers called <strong>servers</strong>. These are very powerful computers that are turned on all the time. They store the web pages and send them to users at any time of the day.</p>
<p>Here&#8217;s what a server looks like :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server.jpg" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server.jpg" alt="server HTML / CSS   Putting Your Site On The Web" title="A Server" width="365" height="259" class="alignnone size-full wp-image-289" /></a></p>
<p>A server doesn&#8217;t have a screen because, most of the time, it works by itself without humans having to do anything to it. As you can see, servers are very flat : it&#8217;s a special format of server (called <q>1U</q>). They can be piled up in <strong>bays</strong> (a sort of air-conditioned wardrobe for servers <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" />  ).</p>
<p>Here&#8217;s what a server bay looks like :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server-bay.jpg" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/server-bay.jpg" alt="server bay HTML / CSS   Putting Your Site On The Web" title="A Server Bay" width="223" height="298" class="alignnone size-full wp-image-290" /></a></p>
<p>As you can see, there&#8217;s one screen for the whole bay. That&#8217;s enough because the screen is only plugged into a server if there&#8217;s a problem. Luckily, most of the time, there are no problems <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<h3>The Hosts&#8217; Purpose</h3>
<p>The host is a business that manages all the server bays. It makes sure the servers work 7 days a week 24h/24. In effect, if one of them breaks down, all the sites on that server will stop working (which makes a lot of clients very unhappy <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" />  ).</p>
<p>The bays are kept in special locations called <strong>data centers</strong>. Data centers are warehouses for servers, and they&#8217;re very difficult to gain access to.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/datacenter2.gif" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/datacenter2-560x420.gif" alt="datacenter2 560x420 HTML / CSS   Putting Your Site On The Web" title="A Datacenter - Stores all the server bays" width="560" height="420" class="alignnone size-large wp-image-507" /></a></p>
<p class="green-text">Theoretically it is also possible to host a site on your own computer. However, it&#8217;s complicated, you need to have good knowledge of using Linux, your computer needs to be powerful enough, it needs to be left on all the time and&#8230; most of all&#8230; you need a very fast internet connection (mainly when uploading, the speed of file transfer is very important). Most of the time, users don&#8217;t have a fast enough internet connection to host sites whereas data centers do : they use fibre optics (which gives a speed of several Gbps ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" />  ).</p>
<p>Managing a server yourself is complicated, and most of the time users and businesses use professional hosting services.</p>
<h3>Finding A Host</h3>
<p>Contrarily to registrars, there are a lot of hosts. There are lots of different types at a variety of prices. There is some vocabulary that you&#8217;ll need to know to understand their offers :</p>
<ul>
<li><strong>Shared Hosting</strong> : if you choose a shared hosting plan, your site will be placed on a server that&#8217;s hosting several sites at the same time (maybe 100 or more). <u>It&#8217;s the cheapest offer and the one I recommend</u> if you&#8217;re starting a web site.</li>
<li><strong>Virtual Private Servers (VPS)</strong> : this time the server only hosts a few sites (about 10 or less). These servers are used for sites that have become too big for shared servers because they have too much traffic (visitors), when the owners can&#8217;t afford a dedicated server (see below) or they don&#8217;t need the power of a dedicated server.</li>
<li><strong>Dedicated Servers</strong> (also known as dedicated hosting) : this is the ultra hosting plan. These servers only host one site. Be careful though, this plan is expensive (between £75 and £130 a month) and you need decent knowledge in Linux to manage the server from a distance.</li>
</ul>
<p class="blue-text">But where can I find a host ?</p>
<p>Ah, that&#8217;s very easy <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> <br />
Searching &#8220;hosting plan&#8221; in Google will give you thousands of results. You&#8217;ll just have to choose one.</p>
<p class="floated-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/logo.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/logo.png" alt="logo HTML / CSS   Putting Your Site On The Web" title="Just Host Logo" width="179" height="43" class="alignnone size-full wp-image-293" /></a></p>
<p class="floated-text">If there is some advice I can give, I suggest that you have a look at the offers proposed by <a href="http://www.justhost.com/web-hosting" title="Visit Just Host" target="_blank">Just Host</a>. They are the hosts that received the most positive reviews on <a href="http://www.thetop10bestwebhosting.com/" title="Visit The Top 10 Best Web Hosting Firms" target="_blank">The Top 10 Best Web Hosting Firms</a>. I&#8217;ve also tried them out and I was very happy with their services <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<p>However, if you find that the offers from Just Host are a bit too expensive at first, you can try <a href="https://order.1and1.co.uk/xml/order/Home;jsessionid=A536EAFB25710350E0367579B89FD92A.TCpfix152b?__reuse=1288273448437" title="Visit 1&#038;1" target="_blank">1&#038;1</a>, who often offer hosting at very low prices.<br />
The rest of this chapter will show you how to buy a hosting package with Just Host, but things work the same way with any other host.</p>
<p>So then, back to <a href="http://www.justhost.com/" title="Visit Just Host" target="_blank">Just Host</a>. This site offers several hosting plans, here&#8217;s their <a href="http://www.justhost.com/web-hosting" title="Visit Just Host" target="_blank">hosting page</a> :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/hosting-plans1.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/hosting-plans1-560x434.png" alt="hosting plans1 560x434 HTML / CSS   Putting Your Site On The Web" title="Just Host - Hosting Plans" width="560" height="434" class="alignnone size-large wp-image-511" /></a></p>
<p>In the middle you can see their hosting plans. They offer 2 different plans :</p>
<ul>
<li>Everything unlimited &#038; 1 domain name</li>
<li>Everything unlimited &#038; 3 domain names</li>
</ul>
<p>These offers are very similar. It&#8217;s just the number of domain names that changes.</p>
<p class="blue-text">But what is <q>Bandwidth Allowance</q> ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<p>Bandwidth allowance, or traffic, is the quantity of information that&#8217;s sent to your visitors every month. For example, if you have a 1mb image on your site and it is loaded 500 times by visitors on the site, you&#8217;ll have a traffic of 500mb.<br />
Really, browsers put images in the cache, which avoids loading the same image every time a same visitor goes on a site. This reduces the traffic.</p>
<h3>Ordering Hosting For Your Site</h3>
<p>Let&#8217;s suppose that we want the <q>Just Plan</q> offer. The following screen will ask you what name you want for your site :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/choose-domain-name1.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/choose-domain-name1-560x337.png" alt="choose domain name1 560x337 HTML / CSS   Putting Your Site On The Web" title="Just Host - Choose a domain name" width="560" height="337" class="alignnone size-large wp-image-513" /></a></p>
<p>Most of the time you will create a new domain name. In this case I want to create www.newsiteforme.com.<br />
Just Host will then check that the name is available.</p>
<p>As this name is still available, we can carry on <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> <br />
If not, you&#8217;ll have to find a different domain name because if somebody else already has your name there&#8217;s not a lot you can do <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<p>In the following page you have to insert your details :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/enter-details1.png" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/enter-details1-560x493.png" alt="enter details1 560x493 HTML / CSS   Putting Your Site On The Web" title="Just Host - Enter your personal details" width="560" height="493" class="alignnone size-large wp-image-515" /></a></p>
<p>For the payment, if you&#8217;re using paypal, just click on the paypal button and the payment will be sorted after.<br />
When you&#8217;ve finished entering your details you&#8217;ll be redirected to Paypal&#8217;s site (which you&#8217;ll probably know if you use eBay). It&#8217;s a safe and easy way to make payments on the Internet, which explains why it&#8217;s had so much success.</p>
<p>Just input your Paypal account details, then you&#8217;ll be redirected to Just Host to confirm that the payment has been accepted.</p>
<p>You should later receive an email containing the necessary details to set your site up. <span class="underline">Keep it safe</span> because you&#8217;ll need it later.</p>
<h2>Using An FTP Client</h2>
<h3>Installing An FTP Client</h3>
<p>FTP means <em>File Transfer Protocol</em> and, to keep things short and simple, it&#8217;s the way we&#8217;re going to send our files to the server.<br />
There are programs that allow us to use FTP to send our files to the Internet.</p>
<p>Of course, there exist a lot of programs to do this.<br />
So that we all know what we&#8217;re doing, I suggest using one that&#8217;s free and easy to use : <strong>FileZilla</strong><br />
First step : download the program <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<p class="centred-image">
<a href="http://downloads.europcsolutions.com/filezilla.exe" class="download" title="Download FileZilla" target="_blank">Download FileZilla</a><br />
<a href="http://downloads.europcsolutions.com/filezilla.exe" title="Download FileZilla" target="_blank">Download FileZilla</a>
</p>
<p>I&#8217;ll trust you to install it correctly, it&#8217;s easy and you shouldn&#8217;t have any problems <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> <br />
Launch the program, this is what you should see :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/filezilla1.jpg" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/filezilla1-560x395.jpg" alt="filezilla1 560x395 HTML / CSS   Putting Your Site On The Web" title="FileZilla Main Screen" width="560" height="395" class="alignnone size-large wp-image-518" /></a></a></p>
<p>At first view, it seems a bit complicated (only at first view). In fact, it really is quite simple.<br />
There are 4 main areas in the window to know :</p>
<ol>
<li>At the top, you&#8217;ll see the messages that the program sends and receives. If you&#8217;re lucky enough, you might even see the server say <q>hello</q> to you ! Generally, this area doesn&#8217;t interest us that much, apart from if there are error messages&#8230; and as they are written in red, they&#8217;re quite hard to miss <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </li>
<li>To the left is your hard drive. In the top part are the folders and underneath are the files inside the current folder.</li>
<li>To the right are the files that are on the Internet. At the moment there isn&#8217;t anything because we aren&#8217;t <q>connected</q>, but that will come, don&#8217;t worry.</li>
<li>Finally, at the bottom, you&#8217;ll see the files that are being transferred (and the percentage of completion).</li>
</ol>
<p>The first step will be to connect yourself to the server of your host.</p>
<h3>Setting Up The FTP Client</h3>
<p>No matter which host you have chosen to go with, the procedure always works in the same way. You will be given 3 details that are indispensable for FileZilla to connect to the server :</p>
<ul>
<li><span class="red-text">The IP</span> : the <q>address</q> of the server. Most often you will be given something like <em>ftp.my-site.com</em>, but it can also be a lot of numbers like <em>122.65.203.27</em>.</li>
<li><span class="red-text">The login</span> : your username that you put when registering with the host. You might have put a username or the name of your site. Mine could be <em>europcsolutions</em>.</li>
<li><span class="red-text">The password</span> : either you were asked to give one when registering (most often) or you&#8217;ll have been given a default password (for example <em>crf45u7h</em>).</li>
</ul>
<p>If you don&#8217;t have these 3 things, you&#8217;ll have to get them, they&#8217;re indispensable. Most of the time they&#8217;re sent to you by mail. If not check your account on your hosts website. If you still can&#8217;t find them don&#8217;t hesitate to contact your host to ask for them.</p>
<p>Now that we have these 3 bits of information, we&#8217;ll give them to FileZilla so that it can connect to the server.<br />
Click on the small icon in the top left of the window (not on the small arrow to the right, but on the image) : <img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/site-manager.jpg" alt="site manager HTML / CSS   Putting Your Site On The Web" title="FileZilla - Site Manager" width="43" height="24" /></p>
<p>A new window appears. Click on <q>New Site</q> and give it the name you want (for example Euro PC Solutions). To the right you have to put in the three bits of information I was talking about just above, like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/site1.jpg" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/site1.jpg" alt="site1 HTML / CSS   Putting Your Site On The Web" title="FileZilla - Enter FTP details" width="499" height="411" class="alignnone size-full wp-image-521" /></a></p>
<p>At the top is the host (that&#8217;s where you have to give the IP address, something like <em>ftp.europcsolutions.com</em>.<br />
To be able to enter your username and password, select <strong>Logon Type : Normal</strong><br />
Here the logon is <em>username</em> and the password is&#8230; hidden (you didn&#8217;t think I&#8217;d give it away did you ?! :p).</p>
<p>Click on <q>Connect</q> and everything is (nearly) sorted.</p>
<h3>Transfering Files</h3>
<p>Now there are two possibilities :</p>
<ul>
<li><span class="green-text">Either the connection goes ahead correctly, and at the top you&#8217;ll see messages in green like <q>connected</q>. In this case the right hand side of the screen should be activated and you&#8217;ll see the files that are on the server (there might already be a few).</span></li>
<li><span class="red-text">Or it doesn&#8217;t work, you&#8217;ll have lots of messages written in red and in that case&#8230; there aren&#8217;t 36 solutions : you&#8217;ve messed up while inserting your IP, username and password. One of these elements is incorrect, try re-inserting them and if it still doesn&#8217;t work ask your host. If they&#8217;re correct it <span class="underline">must</span> work</span></li>
</ul>
<p>If the connection works, what you now have to do is very easy : on the left side, find your site on your hard drive (including .html &#038; .css files &#038; images etc.)<br />
Just select the files you want (in our case the whole site) and drag them over to the right hand side. Wait for FileZilla to say that the transfer queue has finished and your files will be on the internet !<br />
Here&#8217;s an example :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/transfer1.jpg" rel="shadowbox[sbpost-286];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/transfer1-560x394.jpg" alt="transfer1 560x394 HTML / CSS   Putting Your Site On The Web" title="FileZilla - File Transfer" width="560" height="394" class="alignnone size-large wp-image-523" /></a></p>
<p>When the files appear to the right, they&#8217;re available on the server <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
<p class="green-text">Make sure that your home page is called index.html. This is the page that the visitor goes to when writing <q>www.site-name.com</q>.</p>
<p>That&#8217;s about all you need to know.<br />
Although you could have probably done a lot of that by yourselves I wrote this chapter because it can be tricky at first knowing what a registrar is and how to find a host.</p>
<p>Right, get to work, you have files to transfer I believe <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Putting Your Site On The Web" class='wp-smiley' title="HTML / CSS   Putting Your Site On The Web" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-putting-your-site-on-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; What Do We Do Now (Conclusion)</title>
		<link>http://blog.europcsolutions.com/html-css-what-do-we-do-now-conclusion/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-what-do-we-do-now-conclusion</link>
		<comments>http://blog.europcsolutions.com/html-css-what-do-we-do-now-conclusion/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 19:47:47 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[lessons]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=275</guid>
		<description><![CDATA[This is the last chapter of the XHTML / CSS lessons. We'll conclude what we've seen during the tutorials and see what there is to look forward to...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-conclusion.png" rel="shadowbox[sbpost-275];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-conclusion.png" alt="html conclusion HTML / CSS   What Do We Do Now (Conclusion)" title="HTML / CSS - What Do We Do Now (Conclusion)" width="580" height="200" class="alignnone size-full wp-image-284" /></a></p>
<p>It&#8217;s always the same. You see the summary of the tutorial for the first time, look at the list of chapters, and say to yourself : <q><em>What ?! You need to learn ALL that to make a web site ??</em></q><br />
And nonetheless you read the chapters one by one and&#8230; you eventually reach a page called <q>Conclusion</q>.</p>
<p>You ask yourself the question <em><q>Have I learnt everything ?</q></em> or <em><q>What shall I do now ?</q></em>.</p>
<h2>The End Is Near</h2>
<p>I think the first thing we need to do is a summary. That&#8217;s to say, a conclusion of everything we&#8217;ve seen now that everything&#8217;s finished.</p>
<p>At the same time, this will be the occasion to find some things that we haven&#8217;t seen.<br />
Why ?<br />
What&#8217;s the point ?<br />
How to find out more ?</p>
<p>So many questions that I&#8217;ll try to find answers for <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
<h3>Resuming What We&#8217;ve Seen</h3>
<p>You must remember that the lessons were separated into 3 parts :</p>
<ol>
<li>
<p><span class="red-text">Part I : XHTML tags</span> : After a brief introduction about the tools that are used (Notepad, Notepad++) and the browsers (Internet Explorer, Firefox, Opera&#8230;), we started making our first pages entirely in XHTML.<br />
We learnt the basic structure of an XHTML page, how to write text, how to make links, and finally how to insert images.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/text-box.gif" rel="shadowbox[sbpost-275];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/text-box.gif" alt="text box HTML / CSS   What Do We Do Now (Conclusion)" title="HTML Links" width="158" height="57" class="alignnone size-full wp-image-276" /></a></p>
<p>In this part I voluntarily avoided talking about CSS. Okay, the pages we made were extremely ugly, but that allowed us to learn one language at a time to start off.</p>
</li>
<li>
<p><span class="red-text">Part II : It looks nicer with CSS !</span> : After a certain amount of time, I had to start talking about CSS. As soon as I thought you had enough knowledge of XHTML, we started on CSS. The chapters were quite long, I admit, and it was quite challenging. In effect, once the basics of CSS were learnt, we simply had to&#8230; learn the loads and loads of CSS properties.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/colours.png" rel="shadowbox[sbpost-275];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/colours.png" alt="colours HTML / CSS   What Do We Do Now (Conclusion)" title="Using CSS To Add Decoration" width="433" height="180" class="alignnone size-full wp-image-277" /></a></p>
<p>I did my best to stop the chapters from being too repetitive, but CSS is made like that, I didn&#8217;t invent anything.</p>
</li>
<li>
<p><span class="red-text">Part III : XHTML &#038; CSS &#8211; Always Stronger !</span> : After that we went to the next level. In this part, XHTML &#038; CSS worked side by side, and the least we can say is that you had to pay close attention. Right, the first chapter on lists was an easy introduction so that you could see how the two languages worked together. But then came the chapters on blocks, positioning in CSS&#8230; the hardest part of the lessons. It was delicate but indispensable to be able to create a proper design.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/design.jpg" rel="shadowbox[sbpost-275];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/design.jpg" alt="design HTML / CSS   What Do We Do Now (Conclusion)" title="Website Design Made With XHTML And CSS" width="450" height="342" class="alignnone size-full wp-image-278" /></a></p>
<p>After having seen how tables are made, we finally stopped with forms. A chapter which, as you&#8217;ll have guessed, wasn&#8217;t placed at the end for nothing. In effect, it was a frustrating chapter because we could only create forms without being able to process the data.</p>
</li>
</ol>
<p>And I promised to say a bit more about PHP, this famous language that&#8217;ll allow us to retrieve the information from forms. We&#8217;ll talk about that a bit further on.</p>
<p class="blue-text">Are there any XHTML tags and CSS properties that we haven&#8217;t seen ?</p>
<p>The answer is of course&#8230; yes.<br />
Let&#8217;s see them now.</p>
<h3>What We Haven&#8217;t Seen</h3>
<p>First of all, let me clarify things : if there are elements that I haven&#8217;t talked about, it&#8217;s mainly because they didn&#8217;t enter into any of the themes of the chapters. And as I prefered not to make a scrappy chapter name <q>Other Tags</q>, I avoided the subject.<br />
However, because of my honesty, I&#8217;ll still tell you about the things we haven&#8217;t seen <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
<p>So there are tags you don&#8217;t know. Will that penalise you ?<br />
Not really. For example we didn&#8217;t talk about the &lt;hr /&gt; tag. It&#8217;s a tag that creates separation lines on a page. You can explain it in one sentence, so it&#8217;s difficult to create a chapter about it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
<p class="blue-text">So, how can I get the list of XHTML tags that exist to complete my knowledge ?</p>
<p>Simply go to the chapter <q><a href="http://blog.europcsolutions.com/html-list-of-xhtml-tags/" title="View list of XHTML tags">List Of XHTML Tags</a></q> in this tutorial.<br />
There really aren&#8217;t a lot of tags that we haven&#8217;t seen. Because of this, I suggest that you make sure that you understand everything we HAVE SEEN before rushing off to see the other tags.</p>
<p>With CSS, things are a bit different. There are a lot of properties, and I made the effort, as I promised, to make sure you saw the majority of them.<br />
However there are some I didn&#8217;t talk about. Mainly, it&#8217;s because they&#8217;re used in specific cases : there are some for example that are used to show the <q>pronunciation</q>, others to give instructions to printers etc&#8230;<br />
And I simply left some to one side to keep things simple enough to understand.</p>
<p>But once again, if you want to know everything, I invite you to read the chapter <q><a href="http://blog.europcsolutions.com/css-list-of-css-properties/" title="View list of CSS properties">List Of CSS Properties</a></q>.</p>
<p>Also in CSS, you must know that there are a lot of tricks that are used for precise effects. These tricks weren&#8217;t seen in the lessons either because they&#8217;re used in specific cases.<br />
Some allow you to create nice menus, others correct bugs in Internet Explorer etc&#8230;</p>
<h2>We&#8217;re Not Going To Stop Here Are We ?</h2>
<p>I said I would talk about PHP, the moment has finally arrived.<br />
More generally, we&#8217;re going to see if there are any other languages that you can learn <u>in relation to XHTML and CSS</u>.</p>
<p>These languages can be split into 2 categories :</p>
<ul>
<li>
<p><span class="red-text"><q>client based</q> languages</span> : languages that are launched on the visitor&#8217;s computer. In which case it&#8217;s the computer that does the necessary things to obtain the desired effects. Among the client based languages, the best known one is <strong>JavaScript</strong>, which you have probably heard about as it is very popular.</p>
</li>
<li>
<p><span class="red-text"><q>server based</q> languages</span> : this is more serious. These languages are launched on machines called <q>servers</q>. They&#8217;re a sort of huge computer that you&#8217;ll never have seen and whose sole job&#8230; is to distribute your web site to visitors.</p>
<p>Server based languages are more complicated, but also a lot more powerful than client based languages.<br />
There are several server based languages :</p>
<ul>
<li>
<p><span class="green-text">PHP</span> : very popular, you may have heard about it&#8230; Oh yes, I&#8217;ve been going on about it without telling you what it is <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> <br />
All you need to remember for the moment is that PHP is very popular with webmasters who have a bit of experience because it&#8217;s free and very powerful.</p>
</li>
<li>
<p><span class="green-text">ASP</span> : this language is less well known. ASP was developed by a business you know well: Microsoft. And as Microsoft rarely does things for free&#8230; <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> <br />
ASP has therefore been less successful than PHP because it&#8217;s expensive, and I&#8217;m sure you wouldn&#8217;t want to pay to be able to develop your own site (it&#8217;s a human feeling, don&#8217;t be ashamed <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" />  ). It&#8217;s mainly businesses that use ASP. And yet&#8230; a lot of them are converting to PHP, which is just as powerful as ASP and has the advantage of being free.<br />
There are other server based languages as well such as <strong>Perl</strong> but seeing as PHP has dominated them, I won&#8217;t bother going into detail about them.</p>
</li>
</ul>
</li>
</ul>
<p>Now we&#8217;ll talk in more detail about a client based language (JavaScript) and a server based language (PHP).</p>
<h3>A Client Based Language : JavaScript</h3>
<p>Javascript goes back quite a long time. It is, as I said earlier, a language that is launch on the client&#8217;s machine, meaning the visitor&#8217;s computer. It allows us to edit the XHTML code without having to reload the page all the time.</p>
<p>Contrarily to XHTML, Javascript is a programming language.<br />
To give you an idea of what it&#8217;s like, here&#8217;s a bit of Javascript :</p>
<p><strong>Code : JavaScript</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function switch_spoiler(div2)
{
     if (div2.getElementsByTagName('div').length &gt; 0)
          var divs = div2.getElementsByTagName('div');
     else
          var divs = div2.parentNode.nextSibling.getElementsByTagName('div');

     var div3 = divs[0];

     if (div3.style.visibility == 'visible')
          div3.style.visibility = 'hidden';
     else
          div3.style.visibility = 'visible';

     return false;
}
</pre>
<p>This code changes the style of a tag when we click on it : it changes <q>visibility</q> to hidden if it was visible, and to visible if it was hidden. It lets us hide or show text on the screen when the visitor clicks on it.</p>
<p>We can write Javascript directly in a .html file, or better : in a .js file. (just like putting CSS in a .css file).</p>
<p>Javascript is difficult to resume in a couple of lines because it can produce a very large variety of effects :</p>
<ul>
<li>
<p>We&#8217;ll use it often to change CSS properties without reloading the page.<br />
For example, you roll over an image and the site&#8217;s background changes colour (we can&#8217;t do it with <em>:hover</em> because it concerns two different tags, that&#8217;s the limit of CSS).</p>
</li>
<li>
<p>We can use it to change the XHTML source code without reloading the page</p>
</li>
<li>
<p>It can be used to show dialog boxes on the screen</p>
</li>
<li>
<p>Or to change the size of a window&#8230;</p>
</li>
</ul>
<p>Javascript is used in a very popular programming method at the moment, that you may have heard of : <strong>AJAX</strong> (Asynchronous JavaScript And XML). It&#8217;s a language that combines JavaScript and XML to communicates with servers and dynamically reload certain parts of the page. Services such as <a href="http://www.gmail.com" title="Go to GMail" target="_blank">GMail</a> and <a href="http://www.netvibes.com" title="Visit Netvibes" target="_blank">Netvibes</a> use it a lot, and they&#8217;re not alone.</p>
<h3>A Server Based Language : PHP</h3>
<p>Server based languages and client based languages can&#8217;t be compared because they do different things. Therefore don&#8217;t try to compare JavaScript and PHP, these languages aren&#8217;t related.</p>
<p>I&#8217;ve told you about Javascript and explained that the need of this language is minimal. It is used to create certain effects (a lot of them&#8230;), but globally we can manage without it.<br />
However, it&#8217;s practically impossible to manage without PHP. Yes, we can make a web site without PHP (the proof : you can do it), but in the end you&#8217;ll need PHP.</p>
<p>For example, it&#8217;s PHP that allows you to <q>process</q> the information that visitor&#8217;s put in forms, it&#8217;ll send the information to you by email for example. Here&#8217;s a few examples from many, many applications of PHP :</p>
<ul>
<li>Guest Book</li>
<li>Forums</li>
<li>Newsletter</li>
<li>Chat</li>
<li>Visitor Counters</li>
<li>Automatic News Systems</li>
<li>Member Systems</li>
<li>PHP Games for Websites (strategy games, role play games&#8230;)</li>
<li>We&#8217;ll stop there shall we <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </li>
</ul>
<p>PHP also has a very large community of programmers that&#8217;ll be able to help you out.<br />
And it also has a mascot : the elePHPant :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php.gif" rel="shadowbox[sbpost-275];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/php.gif" alt="php HTML / CSS   What Do We Do Now (Conclusion)" title="PHP Mascot - elePHPant" width="130" height="80" class="alignnone size-full wp-image-280" /></a></p>
<p>PHP is quite different to XHTML and CSS because it&#8217;s a real programming language. It is a lot like C++ (the difference is that C++ is for programs, PHP is for websites).</p>
<p>There is one thing that PHP requires : that you <u>already know XHTML and CSS</u>. That&#8217;s alright for you, you&#8217;ve just learnt both of them <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
<p>PHP will, to put things clearly, make your life easier (after having complicated things of course <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" />  ).<br />
It allows you to make your site, in some ways, completely automatic. A PHP site, is a site that updates itself without needing you to be sat in front of your screen.</p>
<p>So, to keep things simple, there are 2 types of site :</p>
<ul>
<li>
<p><span class="red-text">Sites in XHTML and CSS (that you can now do)</span> : these sites work very well, but to update them you systematically need to change the XHTML / CSS. Generally these sites are quite simple, and often are small sites.<br />
A site made in XHTML and CSS are called <q>static</q>, because they can&#8217;t be modified without your intervention.</p>
</li>
<li>
<p><span class="red-text">Sites in XHTML + CSS + PHP</span> : with the addition, the site is, in many ways, automated. Once the XHTML, CSS and PHP code has been set up, you won&#8217;t (hardly ever) need to touch the source code. For example, to add news you simply need to fill in a form and click on <q>submit</q> !<br />
A site made in XHTML, CSS and PHP is called <strong>dynamic</strong> because it is a site that doesn&#8217;t really need your intervention to develop. A dynamic site is a lot more attractive and easier to update, which explains why most of the big sites use PHP.</p>
<p>Do you want a glimpse of PHP to see what it looks like ?</p>
<p><strong>Code : PHP</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
     // Connection to MySQL
     mysql_connect(&quot;localhost&quot;, &quot;epcs&quot;, &quot;password&quot;);
     mysql_select_db(&quot;phplesson&quot;);

     //------------------------------
     // STAGE 1 : check if the IP is already in the table
     // To do that, simply count the number of fields where &lt;q&gt;ip&lt;/q&gt; is the address of the visitor
     $returnip = mysql_query('SELECT COUNT(*) AS number_entries FROM connected WHERE ip='' . $_SERVER[REMOTE_ADDR'] . ''');
     $datas = mysql_fetch_array($returnip);

     if ($datas['number_entries'] == 0)  // The ip isn't in the table, we'll add it
     {
          mysql_query('INSERT INTO connected VALUES('' . $_SERVER['REMOTE_ADDR'] . '', ' . time() . ')' );
     }
     else  // The ip already exists, update the timestamp
     {
          mysql_query('UPDATE connected SET timestamp=' . time() . ' WHERE ip='' . $_SERVER['REMOTE_ADDR'] . '' ' );
     }
?&gt;
</pre>
<p>It&#8217;s a bit of PHP code that allows you to show the number of visitors connected to your site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
</li>
</ul>
<p>If I were you, I&#8217;d carry on practising XHTML and CSS, to be sure that you know them well, then read chapter 1 of the PHP tutorials.</p>
<p>Reading the <a href="http://blog.europcsolutions.com/php-introduction-to-php/" title="View the 1st PHP lesson">1st chapter</a> doesn&#8217;t cost you anything, and it&#8217;ll give you a more clear idea of what PHP is like.<br />
It would be a real shame if you didn&#8217;t learn this language.</p>
<p>This time my friends, it <u>really</u> is the end <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
<p>What can I add before finishing ?</p>
<p>Well, first of all it&#8217;s been a pleasure sharing my knowledge and experience with you.<br />
If you haven&#8217;t looked yet, there are cheat sheets after the chapters of the lesson. You&#8217;ll almost certainly find some extra and useful information in there. There are also some extra chapters such as <span class="blue-text"><q><a href="http://blog.europcsolutions.com/html-css-putti…ite-on-the-web/" title="How to put your site on the web">How to put your site on the web</a></q></span>, or <span class="blue-text"><q>How to earn money through advertising</q></span> etc. etc&#8230;</p>
<p>As you can see, the world of computing holds lots of surprises, which, if we take the time to find and learn about, finish by astonishing us. It&#8217;s this curiosity that you need to keep, in computing, but also elsewhere.</p>
<p>Are you curious about knowing PHP ?<br />
If that&#8217;s the case&#8230; you won&#8217;t stop being astounded <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   What Do We Do Now (Conclusion)" class='wp-smiley' title="HTML / CSS   What Do We Do Now (Conclusion)" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-what-do-we-do-now-conclusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; Forms</title>
		<link>http://blog.europcsolutions.com/html-css-forms/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-forms</link>
		<comments>http://blog.europcsolutions.com/html-css-forms/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 19:05:07 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[check boxes]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[multi line text areas]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[radio buttons]]></category>
		<category><![CDATA[single line text areas]]></category>
		<category><![CDATA[submit buttons]]></category>
		<category><![CDATA[text areas]]></category>
		<category><![CDATA[XHTML / CSS]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=263</guid>
		<description><![CDATA[Welcome back ! Here we will see how to make forms for web sites using elements such as text areas, check boxes, radio buttons and submit buttons...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/forms.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/forms.png" alt="forms HTML / CSS   Forms" title="HTML / CSS - Forms" width="580" height="200" class="alignnone size-full wp-image-273" /></a></p>
<p>Time&#8217;s passing us by, my friends. The further we get through the lesson, the more you&#8217;ll realise we&#8217;re reaching the limits.</p>
<p class="blue-text">What ? You lied to us ?!<br />
XHTML and CSS have limits ? We can&#8217;t do everything with them ?!</p>
<p>On a serious note, yes XHTML and CSS do have limits. You can already make a good site with what I&#8217;ve taught you, but imagine that one day you want to make an awesome site ?<br />
We&#8217;re getting there. What I&#8217;m going to teach you will still be XHTML, but you will realise that we&#8217;ve reached the <q>limits</q> of the language.</p>
<p>But maybe that&#8217;s a good sign. It might mean that you&#8217;ve become good and that XHTML isn&#8217;t enough anymore <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>What will we talk about in this chapter ? We&#8217;re going to talk about <strong>forms</strong>. The idea is simple : you&#8217;ve created a site, and for example, you&#8217;d like it if you&#8217;re visitors could leave their thoughts by ticking boxes, inserting their comments, their suggestions &#8230;</p>
<p>Welcome to the wonderful world of forms, the world where check boxes, buttons and scrolling lists live in perfect harmony <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" />  (or almost <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" />  )</p>
<h2>Creating A Form</h2>
<p>When you want to insert a form into your XHTML page, you need to use the &lt;form&gt; &lt;/form&gt; tags. It&#8217;s the main tag of a form; it allows is to indicate the beginning and the end of the form.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Text before the form&lt;/p&gt;

&lt;form&gt;
     &lt;p&gt;Text inside the form&lt;/p&gt;
&lt;/form&gt;

&lt;p&gt;Text after the form&lt;/p&gt;
</pre>
<p>So that is the basic structure.<br />
Now pay attention, because what I&#8217;m going to say is not evident seeing as we&#8217;re at the limits of XHTML.</p>
<p>A form is created to be sent. We&#8217;ll take an example to make things clear.<br />
Let&#8217;s suppose that a visitor leaves a comment in your form, for example <q>Yeeaahhhh, this site is great !</q> This message needs to be <em>sent</em> so that you can receive it (makes sense doesn&#8217;t it ?), and so that you can find out what the visitor thinks of your site.</p>
<p>Well, that&#8217;s where the problem is, or more precisely :</p>
<ul>
<li>
<p><strong>Problem 1</strong> : how do you send the text left by the visitor ?</p>
</li>
<li>
<p><strong>Problem 2</strong> : once the data has been sent, how do you process it ? Do you want to receive it automatically be email, or do you want it to be saved somewhere, then show it on a page for everyone to see ?<br />
That&#8217;s the same as a guest book if you were following properly <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
</li>
</ul>
<p>There are 2 attributes for the &lt;form&gt; tag so that we can resolve these 2 problems :</p>
<ul>
<li><span class="red-text">method</span> : this attribute indicates how you want to send the data (<strong>problem 1</strong>). There are 2 ways to send information on the web :
<ul>
<li><span class="green-text">method=<q>get</q></span> : isn&#8217;t a very flexible method because you&#8217;re limited to 255 characters. The information is sent to the address of the page (http://&#8230;), but we&#8217;re not really interested by this for the moment, I recommend that you use the other method : <q>post</q>.</li>
<li><span class="green-text">method=<q>post</q></span> : is the most used method for forms because you can send a lot of information.</li>
</ul>
</li>
<li><span class="red-text">action</span> : is the address of the page or program that will <em>process</em> the data (<strong>problem 2</strong>). This page will send you the data by email if that is what you want, or save the message, along with all the others in a database.<br />
We can&#8217;t do this with XHTML / CSS, generally we use another language that you may have heard of : <strong>PHP</strong>. We&#8217;ll see that later, don&#8217;t worry <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </li>
</ul>
<p>We can now complete the &lt;form&gt; tag with the attributes we&#8217;ve just seen.</p>
<p>For <em>method</em>, you might have guessed, I&#8217;ll put the value <q>post</q>.<br />
For <em>action</em>, I&#8217;ll put the name of a special <strong>PHP</strong> page (<q>process.php</q>). This page will be called upon when the visitor clicks on the <q>send</q> button.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Text before the form&lt;/p&gt;

&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;Text inside the form&lt;/p&gt;
&lt;/form&gt;

&lt;p&gt;Text after the form&lt;/p&gt;
</pre>
<p>For the moment, we don&#8217;t know what happens in <q>process.php</q> : all that I ask is that you trust me, and imagine that this page does exist, and works. In the lessons on PHP we&#8217;ll see how this page analyses the data, but for the moment that isn&#8217;t our priority.</p>
<p>Our priority, here, is to see how we insert text areas, buttons and check boxes into our web page using XHTML.<br />
That&#8217;s what we&#8217;re going to learn now <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<h2>Text Areas</h2>
<p>We&#8217;re going to see the tags that allow us to insert text areas into a form.<br />
To start, you need to know that there are 2 types of text areas :</p>
<ul>
<li><strong>single line text areas</strong> : as its name says, we can only write one line of text inside it :p. It&#8217;s for inserting short text, for example : <q>insert your username</q>.</li>
<li><strong>multi line text areas</strong> : this allows us to insert a more important amount of text on several lines, for example : <q>insert your address</q>.</li>
</ul>
<h3>Single Line Text Areas</h3>
<p>You don&#8217;t know what a text area is ?<br />
That&#8217;s alright, I&#8217;ve got a picture of one :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/single-line.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/single-line.png" alt="single line HTML / CSS   Forms" title="A Single Line Text Area" width="250" height="27" class="alignnone size-full wp-image-264" /></a></p>
<p>To insert a single text area, we use the &lt;input /&gt; tag.<br />
We&#8217;ll use this tag a few times in this chapter. Each time the attributes will change.</p>
<p>To insert a single line text area, we need to write :<br />
&lt;input type=<q>text</q> /&gt;</p>
<p>But that&#8217;s not it ! We&#8217;re missing an attribute that will be very important ; the name of the text area. In effect, that will allow us later (in PHP) to recognise which text is the username, which text is the password etc&#8230;<br />
Therefore we need to give a name to the text area with the attribute <q>name</q>. Here, we will suppose that we want the visitor&#8217;s username :<br />
&lt;input=<q>text</q> name=<q>username</q> /&gt;</p>
<p>Now we&#8217;ll test that :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;&lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt;&lt;/p&gt;
&lt;/form&gt;
</pre>
<p class="red-text">Don&#8217;t forget to surround the text area with &lt;p&gt;&lt;/p&gt; or your web page won&#8217;t be valid.</p>
<h3>Labels</h3>
<p>It&#8217;s all very well having a text area, but if a visitor see&#8217;s it, they won&#8217;t know what to put in it. We have to tell them that the box is for their username.<br />
To indicate what a text area is for we use the &lt;label&gt; tag like this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label&gt;Username&lt;/label&gt; : &lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>But that&#8217;s not enough. We need to link the label to the text area.<br />
To do this we need to give the text area a name, not with the attribute name, but with the attribute id (which we can use on all tags).</p>
<p class="blue-text">A name and an id on a text area ? Won&#8217;t they both do the same thing ?</p>
<p>Yes, a bit. Personally, I give the same name to <em>name</em> and <em>id</em>, there&#8217;s no problem.<br />
To link a label to a text area, we need to give it the attribute <q>for</q>, which has the same value as the id of the text area. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> <br />
Here&#8217;s what we have :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;username&quot;&gt;Username&lt;/label&gt; : &lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>Now, if you&#8217;re trying the examples at the same time as me, try clicking on <q>username</q> : you&#8217;ll see that the cursor automatically goes into the corresponding text area.</p>
<p class="blue-text">So&#8230;it&#8217;s just used so that the corresponding text area is selected if we click on <q>username</q> ?</p>
<p>No, not at all <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> <br />
It also allows disabled people to easily go through the form. We don&#8217;t think about it often enough, but often our forms are so large and unorganised, that it can be hard to know what each text area is for.<br />
Here, for example, blind people will know that the text area is for the <q>username</q>, and they will thank you for taking the time to make things clearer with labels.</p>
<h3>A Few Extra Attributes</h3>
<p>There are some other attributes for the &lt;input /&gt; tag which will surely interest you.</p>
<p>It is possible, if you want, to give a default value to a text area.<br />
To do this we just need to add the attribute <q>value</q> to &lt;input /&gt; and give it the value of the text you want to show at the beginning. Example :<br />
&lt;input type=<q>text</q> name=<q>username</q> value=<q>europcsolutions</q> /&gt;</p>
<p>Another thing : you can change the width of the text area as well as the maximum amount of characters that can be inserted in the text area.<br />
The width is defined with <em>size</em>.<br />
The maximum amount of characters is set with <em>maxlength</em>.</p>
<p>In the following example, the text area contains the text <q>europcsolutions</q> by default, the area is 30 characters long, but you can only insert 15 characters maximum :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;username&quot;&gt;Username :&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; value=&quot;europcsolutions&quot; size=&quot;30&quot; maxlength=&quot;15&quot; /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<h3>Password Boxes</h3>
<p>You can easily transform a text area into a <q>password box</q>, which is the area where visitors insert their passwords.<br />
The only thing you need to change is the <em>type</em> attribute in &lt;input /&gt;. Put <em>type=<q>password</q></em> and it&#8217;s sorted !</p>
<p>I&#8217;ll complete the form. It&#8217;ll now ask the visitor for a username AND password :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;username&quot;&gt;Username :&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;username&quot; id=&quot;username&quot; value=&quot;europcsolutions&quot; /&gt;

          &lt;br /&gt;
          &lt;label for=&quot;pass&quot;&gt;Password :&lt;/label&gt;
          &lt;input type=&quot;password&quot; name=&quot;pass&quot; id=&quot;pass&quot; /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<h2>Multi Line Text Areas</h2>
<p>Now we&#8217;ll (at last) see multi line text areas. Don&#8217;t worry, it&#8217;ll be a lot faster now that we&#8217;ve seen labels <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> <br />
Here is a multi line text area :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/multi-line.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/multi-line.png" alt="multi line HTML / CSS   Forms" title="A Multi Line Text Area" width="431" height="202" class="alignnone size-full wp-image-266" /></a></p>
<p>The tag for multi line text areas works in pairs (contrarily to &lt;input /&gt;). It is &lt;textarea&gt;&lt;/textarea&gt;.<br />
With this tag also, we add the attributes <em>name</em>, and use labels.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;improve&quot;&gt;How do you think I can improve my site ?&lt;/label&gt;&lt;br /&gt;
          &lt;textarea name=&quot;improve&quot; id=&quot;improve&quot;&gt;&lt;/textarea&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>We can change the size of the text area using 2 different methods :</p>
<ul>
<li><strong>With CSS</strong> : just apply the properties <em>width</em> and <em>height</em> to the text area. However this doesn&#8217;t work before Internet Explorer 8.</li>
<li><strong>With Attributes</strong> : we can add the attributes <em>rows</em> and <em>cols</em> to &lt;textarea&gt;. The first is the number of rows in the textarea, the second is the number of columns.</li>
</ul>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;improve&quot;&gt;How do you think I can improve my site ?&lt;/label&gt;&lt;br /&gt;
          &lt;textarea name=&quot;improve&quot; id=&quot;improve&quot; rows=&quot;10&quot; cols=&quot;50&quot;&gt;&lt;/textarea&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p class="blue-text">But, hmmmmm&#8230; why open &lt;textarea&gt; to close it straight away ? A solo tag like &lt;input /&gt; would have done the job wouldn&#8217;t it ?</p>
<p>In fact, it&#8217;s to set default text for the textarea. It&#8217;s a bit like what we did earlier with <em>value</em> in the singe line text area, only here we have several lines <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> <br />
You can set a default value for the text like this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;improve&quot;&gt;How do you think I can improve my site ?&lt;/label&gt;&lt;br /&gt;
          &lt;textarea name=&quot;improve&quot; id=&quot;improve&quot; rows=&quot;10&quot; cols=&quot;50&quot;&gt;
               Improve my site ?!&lt;br /&gt;
               It's that great that there's no need to improve it !
          &lt;/textarea&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<h3>Option Elements</h3>
<p>As well as text areas, XHTML offers a whole range of elements to use in your form.<br />
In this part we will see :</p>
<ul>
<li>Check boxes, which you surely know&#8230;</li>
<li>Radio buttons, which you also know&#8230;</li>
<li>Scrolling lists, which you must have seen&#8230; Well, you already know everything <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </li>
</ul>
<p>Or more likely, you&#8217;ve already seen all these elements, but I bet you don&#8217;t know how to make them in XHTML !</p>
<h3>Check Boxes</h3>
<p>These, my friends, are check boxes :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/check-box.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/check-box.png" alt="check box HTML / CSS   Forms" title="Check Boxes" width="70" height="77" class="alignnone size-full wp-image-267" /></a></p>
<p>The good news : it&#8217;ll be quick <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>In effect, you already know the tag we&#8217;re going to use : it&#8217;s &lt;input /&gt;<br />
Only we&#8217;re going to change the value of the attribute <em>type</em> to <q>checkbox</q> :<br />
&lt;input type=<q>checkbox</q> name=<q>choice</q> /&gt;</p>
<p>Add a &lt;label&gt;, and that&#8217;s it !</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          Tick the food you like to eat :&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;chips&quot; id=&quot;chips&quot; /&gt; &lt;label for=&quot;chips&quot;&gt;Chips&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;steak&quot; id=&quot;steak&quot; /&gt; &lt;label for=&quot;steak&quot;&gt;Steak&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;spinach&quot; id=&quot;spinach&quot; /&gt; &lt;label for=&quot;spinach&quot;&gt;Spinach&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;oysters&quot; id=&quot;oysters&quot; /&gt; &lt;label for=&quot;oysters&quot;&gt;Oysters&lt;/label&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>What can I add ?<br />
Because of the labels, you don&#8217;t have to click on the box itself, you can also click on the text.<br />
Also, don&#8217;t forget to give a name to the box, in PHP that&#8217;ll allow us to identify the boxes that the visitor clicked on.</p>
<p>Ah yes, I nearly forgot. You can make a box be ticked by default. To do that you need to add the attribute <em>checked=<q>checked</q></em>. That allows us to have an influence on the choices that are made <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          Tick the food you like to eat :&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;chips&quot; id=&quot;chips&quot; /&gt; &lt;label for=&quot;chips&quot;&gt;Chips&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;steak&quot; id=&quot;steak&quot; checked=&quot;checked&quot; /&gt; &lt;label for=&quot;steak&quot;&gt;Steak&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;spinach&quot; id=&quot;spinach&quot; /&gt; &lt;label for=&quot;spinach&quot;&gt;Spinach&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;checkbox&quot; name=&quot;oysters&quot; id=&quot;oysters&quot; /&gt; &lt;label for=&quot;oysters&quot;&gt;Oysters&lt;/label&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<h3>Radio Buttons</h3>
<p>Radio buttons allow you to make a choice (and only one) from a list :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/radio-button.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/radio-button.png" alt="radio button HTML / CSS   Forms" title="Radio Buttons" width="114" height="62" class="alignnone size-full wp-image-269" /></a></p>
<p>It&#8217;s a bit like check boxes, but with an extra complication, you&#8217;ll see.<br />
The tag to use is still &lt;input /&gt;, but this time the value for <em>type</em> is <q>radio</q>.<br />
The main difference with check boxes is that radio buttons work in <q>groups</q>. A whole group of options <u>have the same names</u>, but the <em>value</em> attribute is different every time.</p>
<p>Things will be clearer with the following example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          Please indicate your age group :&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;less-15&quot; id=&quot;less-15&quot; /&gt; &lt;label for=&quot;less-15&quot;&gt;Less 15 yrs&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;15-25&quot; id=&quot;15-25&quot; /&gt; &lt;label for=&quot;15-25&quot;&gt;15-25 yrs&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;25-40&quot; id=&quot;25-40&quot; /&gt; &lt;label for=&quot;25-40&quot;&gt;25-40 yrs&lt;/label&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>Why use the same name for each option ? Simply so that the browser knows which group the option is in.<br />
Try to take out the <em>name</em> attribute, you&#8217;ll see that you can select every option. But that isn&#8217;t what we want, that&#8217;s why we <q>link</q> them all together with their name.</p>
<p class="green-text">You&#8217;ll notice in the following example that we&#8217;ve got radio buttons with different names. If I had used the same names we wouldn&#8217;t be able to separate them.</p>
<p>If you have 2 different option groups, you have to give a different name to each group :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          Please indicate your age group :&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;less-15&quot; id=&quot;less-15&quot; /&gt; &lt;label for=&quot;less-15&quot;&gt;Less 15 yrs&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;15-25&quot; id=&quot;15-25&quot; /&gt; &lt;label for=&quot;15-25&quot;&gt;15-25 yrs&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;age&quot; value=&quot;25-40&quot; id=&quot;25-40&quot; /&gt; &lt;label for=&quot;25-40&quot;&gt;25-40 yrs&lt;/label&gt;
     &lt;/p&gt;
     &lt;p&gt;
          What continent do you live on ?&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;continent&quot; value=&quot;europe&quot; id=&quot;europe&quot; /&gt; &lt;label for=&quot;europe&quot;&gt;Europe&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;continent&quot; value=&quot;africa&quot; id=&quot;africa&quot; /&gt; &lt;label for=&quot;africa&quot;&gt;Africa&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;continent&quot; value=&quot;asia&quot; id=&quot;asia&quot; /&gt; &lt;label for=&quot;asia&quot;&gt;Asia&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;continent&quot; value=&quot;america&quot; id=&quot;america&quot; /&gt; &lt;label for=&quot;america&quot;&gt;America&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;radio&quot; name=&quot;continent&quot; value=&quot;australia&quot; id=&quot;australia&quot; /&gt; &lt;label for=&quot;australia&quot;&gt;Australia&lt;/label&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>If, instead of putting <em>name=<q>continent</q></em> you put <em>name=<q>age</q></em>, the visitor wouldn&#8217;t be able to choose their age AND continent.<br />
Try changing the names, you&#8217;ll see what happens <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>A last precision : if you want one of the options to be ticked by default, add <em>checked=<q>checked</q></em> just like the check boxes, that&#8217;s it !</p>
<h3>Scrolling Lists</h3>
<p>Scrolling lists are another elegant way of letting visitors choose one option from a group of possibilities.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/scroll-list.png" rel="shadowbox[sbpost-263];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/scroll-list.png" alt="scroll list HTML / CSS   Forms" title="Scroll List" width="162" height="173" class="alignnone size-full wp-image-270" /></a></p>
<p>This works a bit differently to the others. We&#8217;ll use the tag &lt;select&gt;&lt;/select&gt; which indicates the beginning and end of the list.<br />
We add the attribute <em>name</em> to give a name to the list. For example <q>country</q> :<br />
&lt; select name=<q>country</q>&gt;.</p>
<p>And now, inside the &lt;select&gt;&lt;/select&gt;, we insert several &lt;option&gt;&lt;/option&gt; tags (one choice possible).<br />
We add the attribute <em>value</em> to identify the choice made by the visitor.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;country&quot;&gt;What country do you live in ?&lt;/label&gt;&lt;br /&gt;
          &lt;select name=&quot;country&quot; id=&quot;country&quot;&gt;
               &lt;option value=&quot;france&quot;&gt;France&lt;/option&gt;
               &lt;option value=&quot;spain&quot;&gt;Spain&lt;/option&gt;
               &lt;option value=&quot;italy&quot;&gt;Italy&lt;/option&gt;
               &lt;option value=&quot;united-kingdom&quot;&gt;United Kingdom&lt;/option&gt;
               &lt;option value=&quot;canada&quot;&gt;Canada&lt;/option&gt;
               &lt;option value=&quot;usa&quot;&gt;U.S.A&lt;/option&gt;
               &lt;option value=&quot;china&quot;&gt;China&lt;/option&gt;
               &lt;option value=&quot;japan&quot;&gt;Japan&lt;/option&gt;
          &lt;/select&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>It&#8217;s a bit different to the other things we&#8217;ve seen but it&#8217;s still quite easy to understand.</p>
<p>Another new thing : we can&#8217;t use <em>checked=<q>checked</q></em> here, instead we must use <em>selected=<q>selected</q></em>. It allows us to choose a value by default (if not the first value if the default value) :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;country&quot;&gt;What country do you live in ?&lt;/label&gt;&lt;br /&gt;
          &lt;select name=&quot;country&quot; id=&quot;country&quot;&gt;
               &lt;option value=&quot;france&quot;&gt;France&lt;/option&gt;
               &lt;option value=&quot;spain&quot;&gt;Spain&lt;/option&gt;
               &lt;option value=&quot;italy&quot;&gt;Italy&lt;/option&gt;
               &lt;option value=&quot;united-kingdom&quot; selected=&quot;selected&quot;&gt;United Kingdom&lt;/option&gt;
               &lt;option value=&quot;canada&quot;&gt;Canada&lt;/option&gt;
               &lt;option value=&quot;usa&quot;&gt;U.S.A&lt;/option&gt;
               &lt;option value=&quot;china&quot;&gt;China&lt;/option&gt;
               &lt;option value=&quot;japan&quot;&gt;Japan&lt;/option&gt;
          &lt;/select&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>But scrolling lists can do even better !<br />
We can create <strong>option</strong> groups inside the list with the &lt;optgroup&gt;&lt;/optgroup&gt; tag. We have to give it the attribute <em>label</em> which lets us give a name to the group (don&#8217;t mix up with the tag &lt;label&gt; !).</p>
<p>Why not separate the countries by continent in our example ?</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;country&quot;&gt;What country do you live in ?&lt;/label&gt;&lt;br /&gt;
          &lt;select name=&quot;country&quot; id=&quot;country&quot;&gt;
               &lt;optgroup label=&quot;Europe&quot;&gt;
                    &lt;option value=&quot;france&quot;&gt;France&lt;/option&gt;
                    &lt;option value=&quot;spain&quot;&gt;Spain&lt;/option&gt;
                    &lt;option value=&quot;italy&quot;&gt;Italy&lt;/option&gt;
                    &lt;option value=&quot;united-kingdom&quot;&gt;United Kingdom&lt;/option&gt;
               &lt;/optgroup&gt;
               &lt;optgroup label=&quot;America&quot;&gt;
                    &lt;option value=&quot;canada&quot;&gt;Canada&lt;/option&gt;
                    &lt;option value=&quot;usa&quot;&gt;U.S.A&lt;/option&gt;
               &lt;/optgroup&gt;
               &lt;optgroup label=&quot;Asia&quot;&gt;
                    &lt;option value=&quot;china&quot;&gt;China&lt;/option&gt;
                    &lt;option value=&quot;japan&quot;&gt;Japan&lt;/option&gt;
               &lt;/optgroup&gt;
          &lt;/select&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
<p>It can be useful, especially in a big list <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<h2>A Useful Form With Design ?</h2>
<p>Now we&#8217;ll try to take things a bit further.<br />
We&#8217;ll have a double objective : to make our form understandable and to make it look good.</p>
<p>We&#8217;ll do this in 4 stages :</p>
<ol>
<li>Define the order of tabulation (accessibility)</li>
<li>Define the keyboard shortcuts (accessibility)</li>
<li>Organise the form into several areas (accessibility &#038; design)</li>
<li>Add CSS (design)</li>
</ol>
<h3>Defining The Order Of Tabulation</h3>
<p>This is the first point that is supposed to make our lives easier.<br />
As you may know, we can go through a menu by only using the <q>Tab</q> key that is situated on the top left of the keyboard. Every time you press on Tab you go to the following field. Every time you press maj+Tab you go to the preceding field.</p>
<p>Our goal is to say in XHTML in which order we would like to go through the form. For example, after the <q>first name</q> text area, if I press <q>Tab</q> I want to go to <q>last name</q> field, then the address etc&#8230;</p>
<p>We&#8217;ll use the attribute <em>tabindex</em> which can be inserted into all the form tags we have seen.<br />
We must give it a number as a value. Each field of the form must have a <u>different number</u>.</p>
<p>The numbers indicate the order in which we want to go through the form : first n&deg; 1, then n&deg; 2, then n&deg; 3 etc&#8230;</p>
<p class="green-text">You don&#8217;t have to put numbers that follow each other. It is even a good idea to leave a <q>space</q> between the numbers in case you need to insert extra fields later on.<br />
I think a good idea is to count 10 by 10 : n&deg; 10, n&deg; 20, n&deg; 30 etc&#8230; It doesn&#8217;t cost you anything to count in 10s, and if later you need to insert a n&deg; 25, there won&#8217;t be any problems <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>In this form, I&#8217;ve added a <em>tabindex</em> in every field. As we have seen, the first field has the smallest n&deg; and the last field has the smallest n&deg;.</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;last-name&quot;&gt;What's your surname ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;surname&quot; id=&quot;surname&quot; tabindex=&quot;10&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;first-name&quot;&gt;What's your first name ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;first-name&quot; id=&quot;first-name&quot; tabindex=&quot;20&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;email&quot;&gt;What's your email address ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; tabindex=&quot;30&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;country&quot;&gt;Which country do you live in ?&lt;/label&gt;&lt;br /&gt;
          &lt;select name=&quot;country&quot; id=&quot;country&quot; tabindex=&quot;40&quot;&gt;
               &lt;optgroup label=&quot;Europe&quot;&gt;
                    &lt;option value=&quot;france&quot;&gt;France&lt;/option&gt;
                    &lt;option value=&quot;spain&quot;&gt;Spain&lt;/option&gt;
                    &lt;option value=&quot;italy&quot;&gt;Italy&lt;/option&gt;
                    &lt;option value=&quot;united-kingdom&quot;&gt;United Kingdom&lt;/option&gt;
               &lt;/optgroup&gt;
               &lt;optgroup label=&quot;America&quot;&gt;
                    &lt;option value=&quot;canada&quot;&gt;Canada&lt;/option&gt;
                    &lt;option value=&quot;usa&quot;&gt;U.S.A&lt;/option&gt;
               &lt;/optgroup&gt;
               &lt;optgroup label=&quot;Asia&quot;&gt;
                    &lt;option value=&quot;china&quot;&gt;China&lt;/option&gt;
                    &lt;option value=&quot;japan&quot;&gt;Japan&lt;/option&gt;
               &lt;/optgroup&gt;
          &lt;/select&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
</div>
<p>Try hitting the <q>Tab</q> button several times and you&#8217;ll see that you&#8217;ll go through the form in the order of the <em>tabindex</em>. <br />
This is particularly useful for people who don&#8217;t have a mouse (yes, it does exist !).</p>
<p class="green-text">By default, if there isn&#8217;t a <em>tabindex</em>, the browser will take the top field as n&deg; 1 and the last one will be at the bottom of the page.<br />
However I suggest that you put <em>tabindex</em> because if your form becomes more complicated in the future it could be very useful.</p>
<h3>Defining Shortcut Keys</h3>
<p>An access key is a keyboard shortcut that allows users to directly go to a field without clicking with the mouse or pressing Tab several times before reaching the desired field.</p>
<p>The good thing is that XHTML allows you to choose the keys you want to use as shortcuts.<br />
However, different browsers use manners of using shortcuts :</p>
<ul>
<li><span class="red-text">Firefox and Internet Explorer</span> (Windows) : use Ctrl + shortcut. If not use Ctrl + Alt + shortcut.</li>
<li><span class="red-text">Safari and IE-Mac (Macintosh)</span> : use Ctrl + shortcut.</li>
</ul>
<p>To define an access key, you must use the attribute <em>accesskey</em>, which, like <em>tabindex</em> can be put on all the tags we&#8217;ve seen in this chapter.<br />
You must give it the value of the key you wish to use as a shortcut.</p>
<p>In this example, the search bar is accesible with the S key :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;
     &lt;p&gt;
          &lt;label for=&quot;last-name&quot;&gt;What's your surname ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;last-name&quot; id=&quot;last-name&quot; tabindex=&quot;10&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;first-name&quot;&gt;What's your first name ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;first-name&quot; id=&quot;first-name&quot; tabindex=&quot;20&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;email&quot;&gt;What's your email address ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; tabindex=&quot;30&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;search&quot;&gt;What are you looking for on this site ? &lt;em&gt;shortcut : R&lt;/em&gt;&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;search&quot; id=&quot;search&quot; tabindex=&quot;40&quot; accesskey=&quot;R&quot; /&gt;&lt;br /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
</div>
<p>In Windows, you need to press Alt+R to go directly to the search bar.<br />
In Mac you need to press Ctrl+R.</p>
<p class="red-text">The big problem with access keys is that certain keys are already taken by the browser. If you use the same keys, there will be conflicts and visitors won&#8217;t be able to use the keys they&#8217;re used to.</p>
<p>Don&#8217;t forget to write somewhere the access keys that are available or else visitors won&#8217;t know what shortcuts to use.</p>
<h3>Organising Forms Into Several Areas</h3>
<p>The method we&#8217;re about to see has 2 advantages :</p>
<ul>
<li>It makes the form clearer and more accessible</li>
<li>It makes the design look better</li>
</ul>
<p>So what&#8217;s the idea ?<br />
If you have a big enough form (which is generally the case), it is easy for visitors to get lost in the amount of information that has to be sent. It is therefore possible in XHTML to group related data into groups.</p>
<p>We&#8217;ll use the &lt;fieldset&gt;&lt;/fieldset&gt; tag to put the fields into groups.<br />
Inside this tag, we&#8217;ll insert other tags (including &lt;input /&gt;) as well as another tag : &lt;legend&gt;&lt;/legend&gt;. This allows us to give a name to the group.</p>
<p class="blue-text">This is very similar to <em>optgroup</em>&#8230;but why did we use the attribute <em>label</em> to give a title to the group whereas we now have to use the &lt;legend&gt; tag ?</p>
<p>Well, that is one of the big mysteries of XHTML ! I would have personally preferred that everything was uniform : either we use attributes to set a title, or tags. However, it will be up to you to remember in this case. As always, it becomes easier with a few exercises, but still, try to remember it.</p>
<p>Here&#8217;s an example on the use of &lt;fieldset&gt; :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;process.php&quot;&gt;

     &lt;fieldset&gt;
          &lt;legend&gt;Your coordinates&lt;/legend&gt;

          &lt;label for=&quot;surname&quot;&gt;What is your surname ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;surname&quot; id=&quot;surname&quot; tabindex=&quot;10&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;first-name&quot;&gt;What is your first name ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;first-name&quot; id=&quot;first-name&quot; tabindex=&quot;20&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;email&quot;&gt;What is your email address ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; tabindex=&quot;30&quot; /&gt;&lt;br /&gt;
     &lt;/fieldset&gt;

     &lt;fieldset&gt;
          &lt;legend&gt;Your wish&lt;/legend&gt;

          &lt;p&gt;
               Make a wish that you want to come true :&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;rich&quot; id=&quot;rich&quot; tabindex=&quot;40&quot; /&gt; &lt;label for=&quot;rich&quot;&gt;Be rich&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;famous&quot; id=&quot;famous&quot; tabindex=&quot;50&quot; /&gt; &lt;label for=&quot;famous&quot;&gt;Be famous&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;intelligent&quot; id=&quot;intelligent&quot; tabindex=&quot;60&quot; /&gt; &lt;label for=&quot;intelligent&quot;&gt;Be &lt;strong&gt;more&lt;/strong&gt; intelligent&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;other&quot; id=&quot;other&quot; tabindex=&quot;70&quot; /&gt; &lt;label for=&quot;other&quot;&gt;Other...&lt;/label&gt;&lt;br /&gt;
          &lt;/p&gt;

          &lt;p&gt;
               &lt;label for=&quot;precisions&quot;&gt;If &quot;Other&quot; please precise : &lt;/label&gt;&lt;br /&gt;
               &lt;textarea name=&quot;precisions&quot; id=&quot;precisions&quot; cols=&quot;40&quot; rows=&quot;4&quot; tabindex=&quot;80&quot;&lt;/textarea&gt;
          &lt;/p&gt;
     &lt;/fieldset&gt;
&lt;/form&gt;
</pre>
</div>
<p class="green-text">The use of &lt;p&gt;&lt;/p&gt; is not necessary inside &lt;fieldset&gt;&lt;/fieldset&gt; like it was earlier.</p>
<p>The result is a lot clearer : you can see the main categories of the form straight away. The form gains clarity and visitors will thank you for that.<br />
Of course, the form won&#8217;t be perfect without CSS <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<h3>Adding CSS</h3>
<p>The good news is that after having learnt an incalculable amount of new XHTML tags, you won&#8217;t learn any new CSS properties <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> <br />
As you already know everything, I won&#8217;t give you any needless comments <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
input, textarea {
     font-family: &quot;Times New Roman&quot;, Times, serif;  /* change the font of the text inside the text areas */
}

input:focus, textarea:focus {  /* when the curosr is in the text area */
     background-color: #ffff99;
}

label {
     color: blue;  /* put all the labels in blue (why not ?) */
}

legend {  /* give the titles a bit more importance */
     font-family: Arial, &quot;Arial Black&quot;, Georgia, &quot;Times New Roman&quot;, Times, serif;
     color: #ff9933;
     font-weight: bold;
}

fieldset {
     margin-bottom: 15px;  /* a margin to separate the fieldset */
     background-color: #ffffcc;
}
</pre>
</div>
<p>Right, it&#8217;s quite ugly but you get the idea <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>The main thing is to show you that you know enough in CSS to do what you want to the form. You have the tools; it&#8217;s up to you to use them appropriately.</p>
<p>For this example I re-used <q>:focus</q> which, for those who don&#8217;t remember, allows us to apply CSS styles to an element that is selected.</p>
<h2>Now We Just Need To Click On The Button !</h2>
<p>We&#8217;re nearly there.<br />
We&#8217;ve seen most of the elements that can be included in a form but we&#8217;re still missing one thing : the validation button !</p>
<p>Luckily, it&#8217;s easy to create, even more so because you already know the tag&#8230;</p>
<p class="blue-text">What ? It&#8217;s not &lt;input /&gt; again is it ?</p>
<p>Yes it is !<br />
It seems that this tag can do anything.</p>
<p>Right, of course one type of button wasn&#8217;t enough for webmasters, they needed 3 :</p>
<ul>
<li><span class="red-text">The send button</span> : it triggers the sending of the form. The visitor is redirected to the page indicated by the <em>action</em> attribute in the form. A send button is made with the attribute <em>type=<q>submit</q></em>. You can add the attribute <em>value</em> to change the text in the button, but you can also leave the default text, I think it&#8217;s clear enough :<br />
&lt;input type=<q>submit</q> /&gt;</li>
<li><span class="red-text">The send button</span> : automatically resets the values in the form. This time we need to use the attribute <em>input type=<q>reset</q></em><br />
&lt;input type=<q>reset</q> /&gt;</li>
<li><span class="red-text">The button that doesn&#8217;t do anything</span> : it&#8217;s a generic button that doesn&#8217;t do anything in particular. The form isn&#8217;t sent, nothing is reset, nothing happens. What&#8217;s the point ? Mainly it is used to launch scripts made in JavaScript (another language used in web pages). We won&#8217;t be using it but I&#8217;m just telling you about it so that you know it exists if you need it one day.<br />
This time I recommend you include the attribute <em>value</em> so that you know what the button does :<br />
&lt;input type=<q>button</q> value=<q>I don&#8217;t do anything</q> /&gt;</li>
</ul>
<p>We&#8217;ll test the first 2 buttons (send and reset) in a fictional form :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;form method=&quot;post&quot; action=&quot;target-process.php&quot;&gt;

     &lt;fieldset&gt;
          &lt;legend&gt;Your coordinates&lt;/legend&gt;

          &lt;label for=&quot;surname&quot;&gt;What is your surname ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;surname&quot; id=&quot;surname&quot; tabindex=&quot;10&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;firstname&quot;&gt;What is your first name ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;firstname&quot; id=&quot;firstname&quot; tabindex=&quot;20&quot; /&gt;&lt;br /&gt;

          &lt;label for=&quot;email&quot;&gt;What is your email ?&lt;/label&gt;&lt;br /&gt;
          &lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; tabindex=&quot;30&quot; /&gt;&lt;br /&gt;
     &lt;/fieldset&gt;

     &lt;fieldset&gt;
          &lt;legend&gt;Your wish&lt;/legend&gt;

          &lt;p&gt;
               Make a wish you would like to become true :&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;rich&quot; id=&quot;rich&quot; tabindex=&quot;40&quot; /&gt; &lt;label for=&quot;rich&quot;&gt;Be rich&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;famous&quot; id=&quot;famous&quot; tabindex=&quot;50&quot; /&gt; &lt;label for=&quot;famous&quot;&gt;Be famous&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;intelligent&quot; id=&quot;intelligent&quot; tabindex=&quot;60&quot; /&gt; &lt;label for=&quot;intelligent&quot;&gt;Be &lt;strong&gt;more&lt;/strong&gt; intelligent&lt;/label&gt;&lt;br /&gt;
               &lt;input type=&quot;radio&quot; name=&quot;wish&quot; value=&quot;other&quot; id=&quot;other&quot; tabindex=&quot;70&quot; /&gt; &lt;label for=&quot;other&quot;&gt;Other...&lt;/label&gt;&lt;br /&gt;
          &lt;/p&gt;

          &lt;p&gt;
               &lt;label for=&quot;precisions&quot;&gt;If &quot;Other&quot;, please precise : &lt;/label&gt;&lt;br /&gt;
               &lt;textarea name=&quot;precisions&quot; id=&quot;precisions&quot; cols=&quot;40&quot; rows=&quot;4&quot; tabindex=&quot;80&quot;&gt;&lt;/textarea&gt;
          &lt;/p&gt;
     &lt;/fieldset&gt;

     &lt;p&gt;
          &lt;input type=&quot;submit&quot; /&gt; &lt;input type=&quot;reset&quot; /&gt;
     &lt;/p&gt;
&lt;/form&gt;
</pre>
</div>
<p class="red-text">Without PHP this form won&#8217;t do anything. So reassure yourselves, no information was saved.</p>
<p>When you click on <q>submit query</q> the form sends you to the page <q>target-process.php</q>, which is a fictional PHP page <u>that you don&#8217;t know how to do</u>.<br />
As I said earlier, we&#8217;ve now reached the limits : we know how to make things in XHTML / CSS, but to process data (save or send by mail) you need to use PHP&#8230;which I will write lessons about, don&#8217;t worry.</p>
<p>Ladies and gentlemen, I have the immense honour of informing you that you&#8217;ve read the whole chapter about forms and you still don&#8217;t know how to use them.</p>
<p>You have also finished learning about XHTML and CSS ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>But, as I have a conscience, I would hate to leave you to got lost in the wilderness. I&#8217;ll therefore force myself to write an extra chapter, which will be a <strong>conclusion</strong> <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Forms" class='wp-smiley' title="HTML / CSS   Forms" /> </p>
<p>We will  :</p>
<ul>
<li>do a summary of everything we&#8217;ve seen (and what we haven&#8217;t seen)</li>
<li>introduce PHP, the mysterious language that can supposedly process the data in forms (and a lot of other things !)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; Tables</title>
		<link>http://blog.europcsolutions.com/html-css-tables/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-tables</link>
		<comments>http://blog.europcsolutions.com/html-css-tables/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 17:24:06 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[td]]></category>
		<category><![CDATA[th]]></category>
		<category><![CDATA[tr]]></category>
		<category><![CDATA[xhtml]]></category>
		<category><![CDATA[XHTML / CSS]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=245</guid>
		<description><![CDATA[In this chapter, we will see how to make tables in XHTML and how to make them look nice using CSS.]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-table.png" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/html-table.png" alt="html table HTML / CSS   Tables" title="HTML / CSS - Tables" width="580" height="200" class="alignnone size-full wp-image-259" /></a></p>
<p>No, we still haven&#8217;t finished with XHTML (or with CSS either !)</p>
<p>Just to reassure you though : we&#8217;ve seen most of it and we&#8217;re nearly finished <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
There are still a few elements to see though. They might not be the most important elements, maybe not the most used either; however I am willing to bet that you&#8217;ll need them sooner or later.</p>
<p>Among these elements that I want to show you before we finish (already ?! o_0), are tables.<br />
I want bother drawing one; I suppose everybody knows what a table looks like.</p>
<p>&#8230; In fact I will.<br />
Ladies, gentlemen, here is &#8230; a table !</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/table.gif" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/table.gif" alt="table HTML / CSS   Tables" title="An HTML Table" width="281" height="138" class="alignnone size-full wp-image-247" /></a></p>
<p>Okay, that is quite a simple table. Of course, we&#8217;ll learn to make more complicated tables, so that you can do everything you want.<br />
Yet again, we&#8217;ll be using CSS to make the tables look nicer. The good news : there is no new CSS to learn, you nearly know everything ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p>A table is made using XHTML tags. Let&#8217;s start by seeing the basic structure &#8230;</p>
<h2>A Simple Table</h2>
<p>The first tag to know : &lt;table&gt; &lt;/table&gt;. This is the tag that allows us to indicate the beginning and end of a table.<br />
This tag is a block, so it needs to be placed outside of paragraphs.</p>
<p>Example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;This is a paragraph before the table&lt;/p&gt;

&lt;table&gt;
     Put the content of the table here
&lt;/table&gt;

&lt;p&gt;This is a paragraph after the table&lt;/p&gt;
</pre>
<p class="blue-text">Right, and what do we put in the table ?</p>
<p>Now, get ready to receive an avalanche of new tags <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
To start slowly, here are 2 very important tags :</p>
<ul>
<li>&lt;tr&gt; &lt;/tr&gt; : indicates the beginning and end of a line in the table</li>
<li>&lt;td&gt; &lt;/td&gt; : indicates the beginning and end of one cell in the table</li>
</ul>
<p>In XHTML, a table is made line by line. In each line (&lt;tr&gt;), we insert the content of each cell (&lt;td&gt;).<br />
As a diagram, the table I showed earlier looks like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/table-composition.png" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/table-composition.png" alt="table composition HTML / CSS   Tables" title="The Composition of A HTML Table" width="351" height="212" class="alignnone size-full wp-image-249" /></a></p>
<p>We have one line tag (&lt;tr&gt;) that <q>surrounds</q> each of the cells (&lt;td&gt;).<br />
For example, if I wanted to make a table with 2 lines, and 3 cells par line (3 columns), I would write this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;tr&gt;
          &lt;td&gt;Laura&lt;/td&gt;
          &lt;td&gt;21 yrs&lt;/td&gt;
          &lt;td&gt;England&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Michelle&lt;/td&gt;
          &lt;td&gt;33 yrs&lt;/td&gt;
          &lt;td&gt;U.S.A&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
<p class="blue-text">Is that what you call a table? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
All the text follows in a line, and there aren&#8217;t even any borders !</p>
<p>Yes, a table without CSS is rather empty. However, adding borders is very easy : you already know the CSS we need to use !</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
td {  /* all the cells in a table ... */
     border: 1px solid black;  /* have a border of 1px */
}
</pre>
<p>We still haven&#8217;t quite got the effect we wanted. In effect, we only wanted one border between 2 cells, which isn&#8217;t the case here.</p>
<p>Luckily, there is a CSS property that is specific to tables : <em>border-collapse</em>, which makes the borders merge into each other.<br />
This property can take 2 values :</p>
<ul>
<li><span class="red-text">collapse</span> : the borders are merged, which is the effect we want.</li>
<li><span class="red-text">separate</span> : the borders are separated (default value).</li>
</ul>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
table {
     border-collapse: collapse;  /* the borders will be merged (looks nicer) */
}

td {
     border: 1px solid black;
}
</pre>
<p>Further in the chapter, we&#8217;ll see more CSS options. We&#8217;ll also try to make the tables look a bit prettier; I admit that they&#8217;re ugly <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<h3>The Table Header</h3>
<p>Now we have what we wanted, we&#8217;ll add a header line into the table. In our example, the titles are <q>Name</q>, <q>Age</q> and <q>Country</q>.<br />
The header is created with a &lt;tr&gt; like all the other lines, but the cells are a &lt;th&gt; this time instead of &lt;td&gt; !</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Age&lt;/th&gt;
          &lt;th&gt;Country&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Laura&lt;/td&gt;
          &lt;td&gt;21 yrs&lt;/td&gt;
          &lt;td&gt;England&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Michelle&lt;/td&gt;
          &lt;td&gt;33 yrs&lt;/td&gt;
          &lt;td&gt;U.S.A&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>The header line is easily recognizable for 2 reasons :</p>
<ul>
<li>the cells are &lt;th&gt; instead of &lt;td&gt;</li>
<li>it&#8217;s the first line of the table (it&#8217;s a bit idiotic, but I had to precise it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </li>
</ul>
<p>As the name of the cells is a bit different for the header, we need to think about updating the CSS to tell it to apply styles on the cells AND the header :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
table {
     border-collapse: collapse;
}

td, th {  /* put a border on the cells AND the header */
     border: 1px solid black;
}
</pre>
<p>As you can see, your browser has put the text of the header in bold. All the browsers generally do that, but if you want you can change it with CSS, change the background colour of the cells, the font, the border etc&#8230;</p>
<p>We&#8217;ll see more advanced CSS examples on tables a bit later.</p>
<h3>The Table&#8217;s Title</h3>
<p>Normally, all tables must have a title. The title allows the visitor to quickly find out about the content of the table.<br />
In our example we have a list of people &#8230; yes, and ? What does it represent ? Without a title, you see, we are a bit lost <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p>Luckily, there is &lt;caption&gt; (what would we do without it ! ^^)<br />
This tag is placed right at the beginning of a table, just before the header. This tag indicates the title of the table :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;caption&gt;Passengers on flight 377&lt;/caption&gt;

     &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Age&lt;/th&gt;
          &lt;th&gt;Country&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Laura&lt;/td&gt;
          &lt;td&gt;21 yrs&lt;/td&gt;
          &lt;td&gt;England&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Michelle&lt;/td&gt;
          &lt;td&gt;33 yrs&lt;/td&gt;
          &lt;td&gt;U.S.A&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>Now things are a bit clearer ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<h2>More Elaborated Tables</h2>
<p>We&#8217;ve learnt how to make small, simple tables. These small tables are enough in most scenarios, but you might need a more &#8230; complicated table.<br />
We will be seeing 2 different methods :</p>
<ul>
<li>With big tables, it is possible to <strong>split</strong> them into 3 parts :
<ul>
<li>Header</li>
<li>Body</li>
<li>Footer</li>
</ul>
</li>
<li>With some tables, you may need to <strong>merge</strong> several cells together</li>
</ul>
<p>Let&#8217;s start by the first point, we have a big table, and we want to split it into several parts.</p>
<h3>Splitting A Big Table</h3>
<p>If your table is big enough, you have every interest to split it into several parts. For this there are XHTML tags that allow us to define the 3 <q>zones</q> of the table :</p>
<ul>
<li><span class="red-text">Header (at the top)</span> : is defined with the tags &lt;thead&gt;&lt;/thead&gt;</li>
<li><span class="red-text">Body (in the centre)</span> : is defined with the tags &lt;tbody&gt;&lt;/tbody&gt;</li>
<li><span class="red-text">Footer (at the bottom)</span> : is defined with the tags &lt;tfoot&gt;&lt;/tfoot&gt;</li>
</ul>
<p>What should we put in the footer ? Generally, if it&#8217;s a big table, recopy the cells of the header. It allows visitors to see what the information is even when they&#8217;re at the bottom of the table.</p>
<p>As a diagram, a table in 3 parts is like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/three-part-table.png" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/three-part-table.png" alt="three part table HTML / CSS   Tables" title="Three Part Table" width="317" height="214" class="alignnone size-full wp-image-253" /></a></p>
<p>The only tricky bit is getting the tags in the correct order :</p>
<ol>
<li>&lt;thead&gt;</li>
<li>&lt;tfoot&gt;</li>
<li>&lt;tbody&gt;</li>
</ol>
<p>In the code, first we add the header, then the footer, and finally the body. The browser will show everything in the right place, don&#8217;t worry <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p>Here&#8217;s the code to write a table in 3 parts :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;caption&gt;Passengers on flight 377&lt;/caption&gt;

     &lt;thead&gt;
          &lt;tr&gt;
               &lt;th&gt;Name&lt;/th&gt;
               &lt;th&gt;Age&lt;/th&gt;
               &lt;th&gt;Country&lt;/th&gt;
          &lt;/tr&gt;
     &lt;/thead&gt;

     &lt;tfoot&gt;
          &lt;tr&gt;
               &lt;th&gt;Name&lt;/th&gt;
               &lt;th&gt;Age&lt;/th&gt;
               &lt;th&gt;Country&lt;/th&gt;
          &lt;/tr&gt;
     &lt;/tfoot&gt;

     &lt;tbody&gt;
          &lt;tr&gt;
               &lt;td&gt;Laura&lt;/td&gt;
               &lt;td&gt;21 yrs&lt;/td&gt;
               &lt;td&gt;England&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Michelle&lt;/td&gt;
               &lt;td&gt;26 yrs&lt;/td&gt;
               &lt;td&gt;U.S.A.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Carmen&lt;/td&gt;
               &lt;td&gt;32 yrs&lt;/td&gt;
               &lt;td&gt;Spain&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Francois&lt;/td&gt;
               &lt;td&gt;43 yrs&lt;/td&gt;
               &lt;td&gt;France&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;John&lt;/td&gt;
               &lt;td&gt;29 yrs&lt;/td&gt;
               &lt;td&gt;England&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Jonathan&lt;/td&gt;
               &lt;td&gt;13 yrs&lt;/td&gt;
               &lt;td&gt;Australia&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Xu&lt;/td&gt;
               &lt;td&gt;19 yrs&lt;/td&gt;
               &lt;td&gt;China&lt;/td&gt;
          &lt;/tr&gt;
     &lt;/tbody&gt;
&lt;/table&gt;
</pre>
</div>
<p class="green-text">You don&#8217;t have to use these 3 tags (thead, tfoot, tbody) on a table. In fact, only use them if the table is big enough and they help to organise things <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
For <q>small</q> tables just use the method we used at the beginning of the chapter.</p>
<h3>Merging Cells</h3>
<p>On some complicated tables, you&#8217;ll need to <q>merge</q> several cells together.<br />
An example ? Look, this table lists films and says who they&#8217;re for :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/films.png" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/films.png" alt="films HTML / CSS   Tables" title="Table With Horizontally Merged Cells" width="464" height="83" class="alignnone size-full wp-image-254" /></a></p>
<p>With the last film, as you can see, the cells are merged : there&#8217;s only one. That&#8217;s exactly the effect we need.</p>
<p>To merge cells, we need to add an attribute to the &lt;td&gt; tag. There are 2 types of merging :</p>
<ul>
<li>Column merging : is what I&#8217;ve done in the example. We use the attribute <em>colspan</em></li>
<li>Line merging : here, two lines will be merged. The merging is vertical. The attribute is <em>rowspan</em></li>
</ul>
<p>As you know, we need to give a value to the attribute (whether it&#8217;s colspan or rowspan).<br />
The value is <u>the number of cells you want to merge</u>. In the example I merged 2 cells. One in the column <q>for children ?</q> and one in the column <q>for teenagers ?</q> So we need to write :<br />
&lt;td colspan=<q>2</q>&gt;</p>
<p>Which means : <q>this cell is 2 cells merged together</q>.<br />
It is possible to merge more than that together (3, 4, 5 &#8230; as many as you want).</p>
<p>Here&#8217;s the XHTML code to make the example from earlier :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;tr&gt;
          &lt;th&gt;Title of the film&lt;/th&gt;
          &lt;th&gt;For children ?&lt;/th&gt;
          &lt;th&gt;For teenagers ?&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Hostel&lt;/td&gt;
          &lt;td&gt;No, too violent&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Winnie The Pooh&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
          &lt;td&gt;Not violent enough...&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;td&gt;Happy Feet&lt;/td&gt;
          &lt;td colspan=&quot;2&quot;&gt;For the whole family !&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
</div>
<p class="green-text">I haven&#8217;t coloured the text to avoid complicating the XHTML code. However you&#8217;re good enough to do it yourselves now, you just need to add <em>class</em></p>
<p class="blue-text">And how do we use rowspan ?</p>
<p>That complicates thing a bit. For our example we will <q>inverse</q> the order of the table : instead of putting the films to the left, we&#8217;ll put them at the top.</p>
<p>So if we do that, the <em>colspan</em> is no longer of any use, so we&#8217;ll need a <em>rowspan</em>.<br />
Take the time to read and understand this example properly, it&#8217;s worth it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;tr&gt;
          &lt;th&gt;Title of the film&lt;/th&gt;
          &lt;td&gt;Hostel&lt;/td&gt;
          &lt;td&gt;Winnie The Pooh&lt;/td&gt;
          &lt;td&gt;Happy Feet&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;th&gt;For children ?&lt;/th&gt;
          &lt;td&gt;No, too violent&lt;/td&gt;
          &lt;td&gt;Yes&lt;/td&gt;
          &lt;td rowspan=&quot;2&quot;&gt;For the whole family !&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
          &lt;th&gt;For teenagers ?/th&gt;
          &lt;td&gt;Yes&lt;/td&gt;
          &lt;td&gt;Not violent enough...&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
</pre>
</div>
<p>Don&#8217;t get everything mixed up ! If this example is confusing you, just forget it for the moment, it&#8217;s not <q>vital</q>.<br />
You can always come back to it later, when you&#8217;re more used to manipulating tables. There&#8217;s no shame in leaving an example until later <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p>Right, there still isn&#8217;t a lot of <q>design</q> in our tables. As promised, we will see in the last part of this chapter how to make our tables look nicer <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<h2>And With A Bit Of CSS &#8230;</h2>
<p>The good news : you already know most of the CSS properties needed for tables. A few examples :</p>
<ul>
<li>to change the borders of cells we use <em>border</em></li>
<li>to change the colour of a cell, we use <em>background-color</em></li>
<li>to change the image of a cell, we use <em>background-image</em></li>
<li>We can also change the size (<em>font-size</em>), and the font (<em>font-family</em>) of the text in cells</li>
<li>We can change the width of a table (<em>width</em>), and centre it (<em>margin-auto</em> because it&#8217;s a block)</li>
<li>We can centre the text in the cells (<em>text-align: center</em>), change the inner margins of cells (<em>padding</em>) etc&#8230;</li>
</ul>
<p>So, you already know most of the CSS properties <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
The main thing is to think of using them, and use them on the correct tags. For example, if you add a black background colour to the &lt;table&gt; tag, the whole table will be black. However if you put the background colour on the &lt;th&gt; tags, only the header cells will be black.</p>
<h3>Using The CSS Properties We Know</h3>
<p>Do you remember the table in 3 parts we saw earlier ? Let&#8217;s see the code again :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;table&gt;
     &lt;caption&gt;Passengers on flight 377&lt;/caption&gt;

     &lt;thead&gt;
          &lt;tr&gt;
               &lt;th&gt;Name&lt;/th&gt;
               &lt;th&gt;Age&lt;/th&gt;
               &lt;th&gt;Country&lt;/th&gt;
          &lt;/tr&gt;
     &lt;/thead&gt;

     &lt;tfoot&gt;
          &lt;tr&gt;
               &lt;th&gt;Name&lt;/th&gt;
               &lt;th&gt;Age&lt;/th&gt;
               &lt;th&gt;Country&lt;/th&gt;
          &lt;/tr&gt;
     &lt;/tfoot&gt;

     &lt;tbody&gt;
          &lt;tr&gt;
               &lt;td&gt;Laura&lt;/td&gt;
               &lt;td&gt;21 yrs&lt;/td&gt;
               &lt;td&gt;England&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Michelle&lt;/td&gt;
               &lt;td&gt;26 yrs&lt;/td&gt;
               &lt;td&gt;U.S.A&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Carmen&lt;/td&gt;
               &lt;td&gt;32 yrs&lt;/td&gt;
               &lt;td&gt;Spain&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Francois&lt;/td&gt;
               &lt;td&gt;43 yrs&lt;/td&gt;
               &lt;td&gt;France&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;John&lt;/td&gt;
               &lt;td&gt;29 yrs&lt;/td&gt;
               &lt;td&gt;England&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Jonathan&lt;/td&gt;
               &lt;td&gt;13 yrs&lt;/td&gt;
               &lt;td&gt;Australia&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
               &lt;td&gt;Xu&lt;/td&gt;
               &lt;td&gt;19 yrs&lt;/td&gt;
               &lt;td&gt;China&lt;/td&gt;
          &lt;/tr&gt;
     &lt;/tbody&gt;
&lt;/table&gt;
</pre>
</div>
<p>And, using only the CSS properties we already know, we&#8217;ll make the table look a lot better :</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
caption {  /* the title of the table */
     margin: auto;  /* align the table's title in the centre */
     font-family: Arial, Times, &quot;Times New Roman&quot;, serif;
     font-weight: bold;
     font-size: 1.2em;
     color: #009900;
     margin-bottom: 20px;  /* to stop the title from being too close to the table */
}

table {  /* the table itself */
     margin: auto;  /* centre the table */
     border: 4px outset green;  /* green border with 3D effect (outset) */
     border-collapse: collapse;  /* Merge the borders */
}

th {  /* The header cells */
     background-color: #006600;
     color: white;
     font-size: 1.1em;
     font-family: Arial, &quot;Arial Black&quot;, Times, &quot;Times New Roman&quot;, serif;
}

td {  /* The normal cells */
     border: 1px solid black;
     font-family: &quot;Comic Sans MS&quot;, &quot;Trebuchet MS&quot;, Times, &quot;Times New Roman&quot;, serif;
     text-align: center;  /* all the text in the cells will be centred */
     padding: 5px;  /* A small inner margin to stop the text touching the borders */
}
</pre>
</div>
<p>You&#8217;ve got to admit that it&#8217;s not that hard <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> </p>
<p>On table, in particular, you&#8217;ve got every interest to work on the CSS. In effect, with and without the CSS, it&#8217;s day and night.<br />
You&#8217;ve just got to compare. Which one of these tables would you prefer ?</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/03/tables-css.png" rel="shadowbox[sbpost-245];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/03/tables-css.png" alt="tables css HTML / CSS   Tables" title="HTML Table With CSS" width="435" height="404" class="alignnone size-full wp-image-255" /></a></p>
<p>Personally, I know which one I prefer <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Tables" class='wp-smiley' title="HTML / CSS   Tables" /> <br />
And if you don&#8217;t like my design, don&#8217;t hesitate to make your own CSS !</p>
<h3>A Few New CSS Properties</h3>
<p>There are a few properties that can only be applied on tables.<br />
Here are the one I suggest you remember :</p>
<ul>
<li><em>caption-side</em> : indicates where you want to show the title of the table (doesn&#8217;t work before Internet Explorer 8). This property can take the following values :
<ul>
<li><span class="red-text">top</span> : the title is at the top (default value)</li>
<li><span class="red-text">bottom</span> : the title is at the bottom</li>
<li><span class="red-text">left</span> : the title is to the left</li>
<li><span class="red-text">right</span> : the title is to the right</li>
</ul>
</li>
<li><em>border-collapse</em> : we saw this earlier, it allows us to merge borders. This is often used as it gives a very nice effect. It can take the following values :
<ul>
<li><span class="red-text">separate</span> : the borders are separated from each other (default value)</li>
<li><span class="red-text">collapse</span> : the borders are merged</li>
</ul>
</li>
<li><em>vertical-align</em> : vertical alignment of the content in the cells. This property can take the following values :
<ul>
<li><span class="red-text">top</span> : the content is at the top of the cell</li>
<li><span class="red-text">middle</span> : the content is in the middle of the cell</li>
<li><span class="red-text">bottom</span> : the content is at the bottom of the cell</li>
</ul>
</li>
</ul>
<p>As we already know <em>border-collapse</em>, I will show you a table that uses <em>vertical-align</em> and <em>caption-side</em>.<br />
I&#8217;ll use the same XHTML and CSS files as earlier, but I&#8217;ll add the 2 properties we&#8217;ve just learnt to the CSS :</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
caption {
     caption-side: bottom;  /* The title will be at the bottom of the table. */
     margin: auto;
     font-family: Arial, Times, &quot;Times New Roman&quot;, serif;
     font-weight: bold;
     font-size: 1.2em;
     color: #009900;
     margin-top: 20px;  /* the margin needs to be at the top instead of at the bottom now ( the title has moved ) */
}

table {
     margin: auto;
     border: 4px outset green;
     border-collapse: collapse;
}

th {
     background-color: #006600;
     color: white;
     font-size: 1.1em;
     font-family: Arial, &quot;Arial Black&quot;, Times, &quot;Times New Roman&quot;, serif;
}

td {
     height: 80px;  /* make the cells higher so that we can see the vertical alignment */
     vertical-align: bottom;  /* the content will be at the bottom of the cells */
     border: 1px solid black;
     font-family: &quot;Comic Sans MS&quot;, &quot;Trebuchet MS&quot;, Times, &quot;Times New Roman&quot;, serif;
     text-align: center;
     padding: 5px;
}
</pre>
</div>
<p class="green-text">I&#8217;ve put comments on the additional lines.</p>
<p>The title is placed under the table with <em>caption-side</em>.<br />
I also had to change the <em>margin-bottom</em> from earlier to <em>margin-top</em> because the title is now under the table.</p>
<p>To be able to test the vertical alignment, I had to change the height of the cells. In effect, for the alignment to be visible, the cells need to be big enough.<br />
After that, the <em>vertical-align</em> let me say <q>I want the text to be placed at the bottom of the cells !</q></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS – Creating Your Website Design !</title>
		<link>http://blog.europcsolutions.com/html-css-%e2%80%93-creating-your-website-design/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-%25e2%2580%2593-creating-your-website-design</link>
		<comments>http://blog.europcsolutions.com/html-css-%e2%80%93-creating-your-website-design/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 19:53:34 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[first web site]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[lessons]]></category>
		<category><![CDATA[xhtml]]></category>
		<category><![CDATA[XHTML / CSS]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=227</guid>
		<description><![CDATA[In this chapter we'll finally learn how to code a design from A to Z using everything we've learnt previously ...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/creating-a-website.png" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/creating-a-website.png" alt="creating a website HTML / CSS – Creating Your Website Design !" title="HTML / CSS - Creating Your Website Design !" width="580" height="200" class="alignnone size-full wp-image-243" /></a></p>
<p>Finally, we&#8217;re here <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>This chapter is a bit particular, rather different to the ones seen up to now. In fact it will be an exercise; Now you won&#8217;t be able to read the chapter half asleep, you&#8217;ll have to code your site at the same time as me <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> <br />
We&#8217;ll be re-using everything we&#8217;ve learnt up to here. If you feel like you need to, don&#8217;t hesitate to re-read the other chapters to jog your memory.</p>
<p class="blue-text">What is the point of this exercise ?</p>
<p>I think the title is clear enough for this question : we&#8217;ll be making a proper web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> <br />
As I am quite certain that this&#8217;ll be the first time for a lot of you, I suggest you pay close attention to this chapter. Creating a design is not a simple task : you need creativity, a good taste in colours, a bit of talent, and finally experience.</p>
<p>All that I can show you, as you&#8217;ll have understood, is my experience. After that, talent &amp; creativity is something that you do or don&#8217;t have <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h2>Right, Where Do We Start ?</h2>
<p>As you now know, a web page is a combination of 2 files :</p>
<ul>
<li><span class="red-text">An XHTML file</span> (.html or .htm) : the content of the page (the text) is in this file. The file is composed of tags such as &lt;strong&gt;, which indicate if the text is important, if it&#8217;s a paragraph, a quotation etc&#8230;</li>
<li><span class="red-text">A CSS file</span> (.css) : this file creates the presentation of our web page. It indicates that the text is red, that the font is &#8220;Times New Roman&#8221; etc&#8230; In theory CSS is optional. However without CSS our pages would be very ugly <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </li>
</ul>
<p>If you have been following properly up to here, you&#8217;ll know how to start :</p>
<ol>
<li>First we need to write the content of the page (XHTML)</li>
<li>Then modify the presentation (CSS)</li>
</ol>
<p>You&#8217;ll see that the creation of the XHTML file will be (very) quick and easy. However, we&#8217;ll spend more time on the CSS, because it&#8217;s tricky, there are quite a few CSS properties to know, and because, no matter how good you may be, the browser may not show things as you wish.</p>
<h3>Fixed or Stretched Design ?</h3>
<p>A fixed design is a design where the design is defined by a fixed width (for example 800 pixels). Generally there is a margin to the left and right, and the content of the page is centred. Here&#8217;s a fixed page design :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/fixed-design.jpg" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/fixed-design.jpg" alt="fixed design HTML / CSS – Creating Your Website Design !" title="Example Of A Fixed Width Design" width="400" height="320" class="alignnone size-full wp-image-229" /></a></p>
<p>A stretched design is a design that automatically adapts itself to the visitor&#8217;s screen resolution. If the visitor&#8217;s resolution is 1024*768 the width of the site will be 1024 pixels. If the resolution is 1600*1400, the width will be 1600 pixels.</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/stretch-design.jpg" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/stretch-design.jpg" alt="stretch design HTML / CSS – Creating Your Website Design !" title="Expandable Width Design" width="400" height="320" class="alignnone size-full wp-image-230" /></a></p>
<p>Personally, I prefer stretched designs : I find it a shame to leave part of the screen unused.<br />
However, if you browse around a few sites, you&#8217;ll notice that a lot of them have fixed designs. Some people say that they look nicer, but I&#8217;ll tell you the truth : they&#8217;re also a lot easier to create <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p class="blue-text">What kind of design will we be using ?</p>
<p>To tell the truth, coding a stretched design can sometimes be quite complicated, and as this is your first design I don&#8217;t want to complicate things too much. Therefore we&#8217;ll be using a <strong>fixed page design</strong>, which isn&#8217;t a bad start.<br />
When you&#8217;re a bit better, and you&#8217;ve got more experience, you&#8217;ll be able to start coding stretched page designs. You&#8217;ll have plenty of time to learn <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h2>First, The XHTML</h2>
<p>First step : we need to open our text editor (Notepad ++ if you took the one I showed you at the beginning), and create a new XHTML file.<br />
Come on! Come on! Do it at the same time as me <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>To start, we&#8217;ll write the <q>basic</q> code of an XHTML page which I showed you in the first chapters. Here it is again :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
     &lt;title&gt;Welcome to my site !&lt;/title&gt;
     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you already know, all the page content will go between the &lt;body&gt;&lt;/body&gt; tags.<br />
Save this file as <q>index.html</q>, which is always the first page of a web site.</p>
<h3>The General Structure</h3>
<p>Very often, a web page is structured using &lt;div&gt; tags, the famous universal <q>block</q> tag I told you about. Generally, we&#8217;ll have at least 4 blocks, with the following layout :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/structure.gif" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/structure.gif" alt="structure HTML / CSS – Creating Your Website Design !" title="Web Site Structure" width="350" height="367" class="alignnone size-full wp-image-231" /></a></p>
<ol>
<li>At the top, the header. Generally the header contains the title of your site in the form of a banner.</li>
<li>Under that is the main part of the page with :
<ul>
<li>to the left or right, the menu.</li>
<li>on the other side, the body of the page, meaning the part with the page&#8217;s content.</li>
</ul>
</li>
<li>Finally, at the bottom of the page, is the footer, in which you write the author&#8217;s name, maybe an email address, and a copyright.</li>
</ol>
<p>In XHTML, we create the blocks with 4 different &lt;div&gt; tags :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;header&quot;&gt;
    &lt;-- Put the banner here --&gt;
&lt;/div&gt;

&lt;div id=&quot;menu&quot;&gt;
     &lt;-- Put the menu here --&gt;
&lt;/div&gt;

&lt;div id=&quot;body&quot;&gt;
     &lt;-- Put the content (text) of the page here --&gt;
&lt;/div&gt;

&lt;div id=&quot;footer&quot;&gt;
     &lt;-- Put the site's author's name, copyright etc. here --&gt;
&lt;/div&gt;
</pre>
<p>It&#8217;s simple enough, we&#8217;ve just made a &lt;div&gt; block for each major part of the page. Later, we&#8217;ll see what needs to be put in the different blocks.</p>
<p>One thing that might have surprised you is that I used <em>id</em> instead of <em>class</em> for the &lt;div&gt; tags. If you can&#8217;t remember the difference between id and class it might be a good idea to have a quick look at the first chapters on CSS.</p>
<p>To explain things quickly, id and class are more or less the same; however an id can only be used once in a page, whereas class can be used several times. Generally there are few id in a web page, they are mainly used for the main <q>blocks</q> of a page as you can see here.</p>
<p class="orange-text">You must write your blocks in the order that they appear (from top to bottom) in the XHTML code. First is the header, last is the footer. For the menu and the body, which are at the same level, it isn&#8217;t too important. You can change their position in the CSS (menu to the right or to the left).</p>
<p>Right, now what needs doing ? Well, we&#8217;ll see in more detail what needs putting in the different &lt;div&gt; blocks <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>The Header</h3>
<p>This block will be quick. Often the header is just a banner (an image), or for those who don&#8217;t want to do any drawing, a simple &lt;h1&gt; (the page&#8217;s title) will do the job.</p>
<p>We&#8217;ll be using a banner this time :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/header11.png" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/header11-560x73.png" alt="header11 560x73 HTML / CSS – Creating Your Website Design !" title="Mechanical Spirit Header" width="560" height="73" class="alignnone size-large wp-image-469" /></a></p>
<p>All the images used in this chapter are copyright <span class="orange-text">zaz and venom</span> all rights reserved (I promised them I&#8217;d put their names into the tutorial <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" />  ). Thanks to them for the help on this chapter !</p>
<p>How do we put this image into the header ? Well we have 2 choices :</p>
<ul>
<li>Either we can insert it using an &lt;img /&gt; tag. That&#8217;s an easy way to insert an image, anyone can do that.</li>
<li>Or we can write the title &lt;h1&gt; in the header and insert the banner using CSS.</li>
</ul>
<p>I admit that the second solution may be a bit surprising. However we&#8217;ll be using this method so that the image is <strong>shown by simply using CSS</strong>. We&#8217;ll also add a link to the title of the page so that it sends users back to the home page of the site.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;header&quot;&gt;
     &lt;h1&gt;&lt;a href=&quot;index.html&quot; title=&quot;Return to home page&quot;&gt;Mechanical Spirit&lt;/a&gt;&lt;/h1&gt;
&lt;/div&gt;
</pre>
<p>As you can see the link goes to index.html. That&#8217;s because the home page of a web site <strong>must</strong> always be called index.html.</p>
<h3>The Menu &amp; Sub-Menus</h3>
<p>In the menu block (in blue), we&#8217;ll need to make several sub-blocks to separate the different elements in the menu.<br />
Take a good look at the following diagram : it&#8217;s a zoom on the menu block I showed earlier :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/menu.gif" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/menu.gif" alt="menu HTML / CSS – Creating Your Website Design !" title="Detailed Version Of The Menu" width="357" height="360" class="alignnone size-full wp-image-235" /></a></p>
<p>As you can see, it contains 2 sub-blocks (green) which will be sub-menus.<br />
How do we do this ? In XHTML it is very easy :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;menu&quot;&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          Text of the first menu
     &lt;/div&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          Text of the second menu
     &lt;/div&gt;

&lt;/div&gt;
</pre>
<p>All you have to do is <q>nest</q> the &lt;div&gt; tags. The first one (the main one) surrounds the other ones (the sub-menus). I&#8217;ve given these a class called <q>sub-menu</q> so that we can modify their CSS later.</p>
<p>Right, now we need to add text to the menu so that it&#8217;s like the diagram I showed above.<br />
In each <q>sub-menu</q> we need to add a title menu. Do you remember the tag to add titles ? Yes, there are 6 tags (depending on the importance of the title) : from &lt;h1&gt; to &lt;h6&gt;. As the titles of menus are less important (and we want to reserve the important titles for the page content) we&#8217;ll put the menu titles in &lt;h4&gt;.<br />
After that, we&#8217;ll add a list (&lt;ul&gt;) to organise the menu.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;menu&quot;&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          &lt;h4&gt;Menu title&lt;/h4&gt;
          &lt;ul&gt;
               &lt;li&gt;Link&lt;/li&gt;
               &lt;li&gt;Link&lt;/li&gt;
               &lt;li&gt;Link&lt;/li&gt;
          &lt;/ul&gt;
     &lt;/div&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          &lt;h4&gt;Menu title&lt;/h4&gt;
          &lt;ul&gt;
               &lt;li&gt;Link&lt;/li&gt;
               &lt;li&gt;Link&lt;/li&gt;
               &lt;li&gt;Link&lt;/li&gt;
          &lt;/ul&gt;
     &lt;/div&gt;

&lt;/div&gt;
</pre>
<p>Generally, we tend to put lists in menus because it allows us to make an organised menu easily.<br />
You may have noticed that I wrote <q>link</q> but I haven&#8217;t added any &lt;a href=<q>&#8230;</q>&gt; tags. It&#8217;s just to avoid complicating the code too quickly, however we will add links to the menu or else it won&#8217;t be very useful <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;menu&quot;&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          &lt;h4&gt;Menu title&lt;/h4&gt;
          &lt;ul&gt;
               &lt;li&gt;&lt;a href=&quot;page1.html&quot; title=&quot;Go to page 1&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt;&lt;a href=&quot;page2.html&quot; title=&quot;Go to page 2&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt;&lt;a href=&quot;page3.html&quot; title=&quot;Go to page 3&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
     &lt;/div&gt;

     &lt;div class=&quot;sub-menu&quot;&gt;
          &lt;h4&gt;Menu title&lt;/h4&gt;
          &lt;ul&gt;
               &lt;li&gt;&lt;a href=&quot;page4.html&quot; title=&quot;Go to page 4&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt;&lt;a href=&quot;page5.html&quot; title=&quot;Go to page 5&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;li&gt;&lt;a href=&quot;page6.html&quot; title=&quot;Go to page 6&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
     &lt;/div&gt;

&lt;/div&gt;
</pre>
<p>And that&#8217;s it, you&#8217;ve got a nice clean menu, with sub-menus !<br />
You can, if you want, add other sub-menus. There are no limits, but don&#8217;t go over the top or visitor&#8217;s won&#8217;t know what to click on.</p>
<p class="green-text">You don&#8217;t have to (even if it is more common) put links and lists in a menu. If you want to add text to it just use &lt;p&gt;&lt;/p&gt;.</p>
<h3>The body</h3>
<p>The body is the main part of the page. That&#8217;s where we&#8217;ll put the content.</p>
<p>So, as I don&#8217;t know what your site will talk about, I can&#8217;t tell you what to put in it. Only you know that <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>However I can give you some indications to get you started.<br />
To start, we&#8217;ll add a &lt;h2&gt; title which will be the main title of the page (&lt;h1&gt; is the name of the website). Generally, I put the same title in the &lt;title&gt; tag (in &lt;head&gt;) and in the &lt;h2&gt; tag.</p>
<p>After, we need to write paragraphs (&lt;p&gt;), and maybe add some sub-titles (&lt;h3&gt;) to give some structure to the text <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>That gives us quite a simple code for the body :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;body&quot;&gt;
     &lt;h2&gt;My Super Site&lt;/h2&gt;

     &lt;p&gt;
          Welcome to my super site !&lt;br /&gt;
          You will love it here, it's a super site that talks about...hmmm...I'm still looking for a subject for my site.
     &lt;/p&gt;

     &lt;h3&gt;Who is this site for ?&lt;/h3&gt;
     &lt;p&gt;
          For everybody ! If I start to privilege certain people, I'll be accused of discrimination :-0 )&lt;br /&gt;
          Whether you're a fan of weapons or Barbie and Ken, this site is made for you ! Yes it is !
     &lt;/p&gt;

     &lt;h3&gt;The author&lt;/h3&gt;
     &lt;p&gt;
          Who's the author of this site ? It's me, what kind of question is that :-p&lt;br /&gt;
          I will try to make the best site in the world (it can't be that hard). My aim is to attract as many people as possible to my site, to make them addicted to it, then to get them under my control.&lt;br /&gt;
          Then I'll take control of the world. After that I'll search every corner of the Earth for more people to put under my great power. Mouahahahaha !!!
     &lt;/p&gt;
&lt;/div&gt;
</pre>
<p>Don&#8217;t take any notice of the text. It&#8217;s just a load of rubbish to fill up the space <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p class="orange-text">Don&#8217;t forget that you can put whatever you want here. If you want to add images, text, more paragraphs, then go on, feel free ! It is the content of your site after all <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>Finally : The Footer</h3>
<p>As I&#8217;ve already said, the footer is normally for writing the author&#8217;s name, and, if you want, you can add a copyright to your site to give it a bit of extra class <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;footer&quot;&gt;
     &lt;p&gt;Copyright &amp;copy; 2010, &quot;Rubbish Corporation&quot;. All Rights Reserved&lt;/p&gt;
&lt;/div&gt;
</pre>
<h3>The Complete XHTML Code</h3>
<p>We have seen in detail what needs to be put in the 4 blocks.<br />
Now, we&#8217;ll assemble all the code we&#8217;ve been working on, without forgetting the DOCTYPE, &lt;head&gt; etc&#8230;</p>
<p>This is what we&#8217;ve got :</p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
     &lt;title&gt;My Super Site&lt;/title&gt;
     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
&lt;/head&gt;

&lt;body&gt;
     &lt;div id=&quot;header&quot;&gt;
          &lt;h1&gt;&lt;a href=&quot;index.html&quot; title=&quot;Return to home page&quot;&gt;Mechanical Spirit&lt;/a&gt;&lt;/h1&gt;
     &lt;/div&gt;

     &lt;div id=&quot;menu&quot;&gt;
          &lt;div class=&quot;sub-menu&quot;&gt;
               &lt;h4&gt;Title menu&lt;/h4&gt;
               &lt;ul&gt;
                    &lt;li&gt;&lt;a href=&quot;page1.html&quot; title=&quot;Go to page 1&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href=&quot;page2.html&quot; title=&quot;Go to page 2&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href=&quot;page3.html&quot; title=&quot;Go to page 3&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;/ul&gt;
          &lt;/div&gt;

          &lt;div class=&quot;sub-menu&quot;&gt;
               &lt;h4&gt;Title menu&lt;/h4&gt;
               &lt;ul&gt;
                    &lt;li&gt;&lt;a href=&quot;page4.html&quot; title=&quot;Go to page 4&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href=&quot;page5.html&quot; title=&quot;Go to page 5&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href=&quot;page6.html&quot; title=&quot;Go to page 6&quot;&gt;Link&lt;/a&gt;&lt;/li&gt;
               &lt;/ul&gt;
          &lt;/div&gt;
     &lt;/div&gt;

     &lt;div id=&quot;body&quot;&gt;
          &lt;h2&gt;My Super Site&lt;/h2&gt;
          &lt;p&gt;
               Welcome to my super site !&lt;br /&gt;
               You will love it here, it's a super site that talks about...hmmm...I'm still looking for a subject for my site.
          &lt;/p&gt;

          &lt;h3&gt;Who is this site for ?&lt;/h3&gt;
          &lt;p&gt;
               For everybody ! If I start to privilege certain people, I'll be accused of discrimination)&lt;br /&gt;
               Whether you're a fan of weapons or Barbie and Ken, this site is made for you ! Yes it is !
          &lt;/p&gt;

          &lt;h3&gt;The author&lt;/h3&gt;
          &lt;p&gt;
               Who's the author of this site ? It's me, what kind of question is that :-p&lt;br /&gt;
               I will try to make the best site in the world (it can't be that hard). My aim is to attract as many people as possible to my site, to make them addicted to it, then to get them under my control.&lt;br /&gt;
               Then I'll take control of the world. After that I'll search every corner of the Earth for more people to put under my great power. Mouahahahaha !!!
          &lt;/p&gt;
     &lt;/div&gt;

     &lt;div id=&quot;footer&quot;&gt;
          &lt;p&gt;Copyright &amp;copy; 2010, &quot;Rubbish Corporation&quot;. All Rights Reserved&lt;/p&gt;
     &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
</div>
<p>Well, I&#8217;ve got to say : well done !<br />
You&#8217;ve just created your first <strong>real XHTML page !</strong> <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>I realise that you probably wouldn&#8217;t have figured all of that out by yourselves, but the main thing is that you understand and follow along with me. There isn&#8217;t <span class="underline">anything</span> new in this XHTML code; we&#8217;ve already seen all these XHTML tags.<br />
And you&#8217;ve got to admit that this code isn&#8217;t very long (it was a lot longer a few years ago).</p>
<p>However we haven&#8217;t finished yet. Without the CSS our page doesn&#8217;t look like anything spectacular.</p>
<p>The funny thing is that the XHTML code is enough to make the design. All we need to do now is add a bit of CSS and our site will be nice and clean <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>You don&#8217;t believe me ?<br />
Be careful &#8230; don&#8217;t underestimate the power of CSS, you could regret it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h2>Second, The CSS</h2>
<p>Now we can start the CSS.<br />
This part is important because you must understand how each line of code changes the design.</p>
<p>For that reason I&#8217;ll break this part down into lots of <q>stages</q>, and I suggest that you check out your site after each little step.</p>
<p class="green-text">If you want to understand properly, also try making a few changes to the CSS. If you can&#8217;t figure out a line, try taking it out and see what happens. That&#8217;s how I learnt, and I think it&#8217;s one of the best ways to learn <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>Resetting The Layout</h3>
<p>By default, each browser has its own way of showing different tags on the screen. For example, in our design, there is a big space between the titles and the paragraphs. So that we can start from scratch we need to get rid of these default settings.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}
</pre>
<p>Easy ! The * means <q>everything</q>, so with this code we&#8217;re taking the margins off all the tags.<br />
Now save the file as <q>style.css</q> (or something else if you want <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" />  ). All that&#8217;s left to do now is attach the CSS to the XHTML file in the &lt;head&gt; :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; type=&quot;text/css&quot; title=&quot;example-css&quot; href=&quot;style.css&quot; /&gt;
</pre>
<p>As you can now see, if you refresh the web page, all the margins have gone !</p>
<h3>Aligning The Design</h3>
<p>To start with, we&#8217;re just going to work on the &lt;body&gt; tag. Yes, I know we haven&#8217;t really worked on this tag before, but it works in the same way as everything else.<br />
As a reminder, &lt;body&gt; is the tag that surrounds all the content in your page. If we say the &lt;body&gt; is so wide in pixels (for a fixed design), and we want it to be centred (with margin:auto;), then our job is nearly finished <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>For the width of the page, I&#8217;m going to put 760 pixels. Why 760 ? Because it&#8217;s less than 800px, so visitors using a resolution of 800*600 won&#8217;t have to scroll from left to right to see the whole page.</p>
<p>As for the margins, a margin: auto; should be enough to centre the design. I&#8217;ll also add a margin to the top and bottom to stop the design from being glued to the edges of the browser.</p>
<p>Finally I&#8217;ll add a background image so that the page is a bit less empty.</p>
<p class="centred-image">
<a href="http://downloads.europcsolutions.com/first-site-images.zip" class="download" title="download the images used in this tutorial" target="_blank">Download Source Files</a><br />
<a href="http://downloads.europcsolutions.com/first-site-images.zip" title="download the images used in this tutorial" target="_blank">CLICK HERE TO DOWNLOAD THE IMAGES FOR THIS TUTORIAL</a>
</p>
<p>Here&#8217;s what it should give :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;  /* align the page in the centre */
     margin-top: 20px;  /* add a 20 pixel margin at the top */
     margin-bottom: 20px;  /* add a 20 pixel margin at the bottom */
     background-image: url(&quot;images/bg.png&quot;);  /* a background image to avoid it being ugly and white :-p */
}
</pre>
<p>Try taking out a few lines of code to see what they all do :</p>
<ul>
<li>If you take out the background-image, the background of the page will be white</li>
<li>If you take out margin-top or margin-bottom the page will be <q>glued</q> to the edges of the browser</li>
<li>If you take out margin:auto your page will align to the left of the browser.</li>
</ul>
<h3>The Header</h3>
<p>As promised, we&#8217;ll show the header of the site using CSS. Earlier we only put in the title of the site using a &lt;h1&gt; tag. Inserting the header using CSS is useful for sites with the ability to change designs, and using this technique you don&#8217;t need to insert an <q>alt</q> value for you header image <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>Now we have to insert the banner using CSS :</p>
<ol>
<li>
<p>The first thing to do, if we want the banner to be visible, is to enlarge the size of the <q>header</q> block so that we can see the whole banner.<br />
As the banner is 758*100 pixels, we need to input these dimensions :<br />
width: 758 px;<br />
height: 100px;</p>
</li>
<li>
<p>Next we need to insert our background-image (the banner) because the block is still empty.<br />
background-image: url(<q>images/banner.png</q>);</p>
</li>
<li>
<p>Our banner should only have enough room to appear once, but it doesn&#8217;t take a lot to make sure that it isn&#8217;t repeated :<br />
background-repeat: no-repeat;</p>
</li>
<li>
<p>Finally, to avoid the content of the page from being glued to the banner we need to add a small margin to the bottom of the header :<br />
margin-bottom: 10px;</p>
</li>
</ol>
<p>That&#8217;s it. We should now have this :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}
</pre>
<p>However you will notice that the title we made is still on the page. To get rid of it we need to do the following :</p>
<ol>
<li>
<p>set the same widths as the banner :<br />
width: 758px;<br />
height: 100px;</p>
</li>
<li>
<p>transform the link from an inline to a block so that the dimensions can be applied to it :<br />
display: block;</p>
</li>
<li>
<p>indent the text so that it goes out of the screen :<br />
text-indent: -9999px;</p>
</li>
</ol>
<p>Now we have this :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}
</pre>
<p>Now that we have inserted the banner using CSS, all you have to do to change the design of the banner is change the background-image.</p>
<p class="blue-text">Why is there a # before header ? Don&#8217;t you normally use a point ?</p>
<p>No, a quick reminder for those who may have forgotten :</p>
<ul>
<li>For a class, you use a <q>.</q> (point) in front of the name in the CSS.</li>
<li>For an id, you use a <q>#</q> before the name. And look at the XHTML code, <q>header</q> is an id !</li>
</ul>
<h3>The Menu</h3>
<p>This is a bit harder.<br />
We&#8217;ll have to put the menu <q>to the left</q> of the body, whereas at the moment it is above.</p>
<p>To do this, the most common and quickest method, is to use the CSS property <em>float</em>. It&#8217;s a bit of a particular property, as we have already seen, and it will be very useful here to correctly position the body and the menu.</p>
<p>We will also give the menu a width of 120 pixels, so that it isn&#8217;t too big.</p>
<p>After that we&#8217;ll work on the class <q>sub-menu</q> (which is a part of the menu). We&#8217;ll give it a bit of a darker background colour, a background image with repeat-x (which only repeats horizontally).<br />
Then we&#8217;ll add a border to each element of the menu to make them stand out more. <q>2px</q> solid black should be good.<br />
Finally we&#8217;ll put a <em>margin-bottom</em> on each element to separate them.</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}

#menu {
     float: left;  /* The menu will float to the left */
     width: 120px;  /* Very important : give the menu a width */
}

.sub-menu {
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);  /* background image repeated horizontally across the top of the menu */
     background-repeat: repeat-x;
     border: 2px solid black;
     margin-bottom: 20px;  /* separate the different elements of the menu */
}
</pre>
</div>
<p>Yet again, if you want to understand everything, I suggest you remove a few lines of code to see their effect.</p>
<p>As you can see if you test the code, it&#8217;s not wonderful yet, but it is getting better. You can already distinguish the submenus without a problem, however the content goes beneath the menu when it&#8217;s finished.<br />
That is normal because that&#8217;s how a <em>float</em> works. Take another look at this image I showed in a previous chapter :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-left1.png" rel="shadowbox[sbpost-227];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-left1.png" alt="float left1 HTML / CSS – Creating Your Website Design !" title="Image With Left Float" width="304" height="202" class="alignnone size-full wp-image-239" /></a></p>
<p class="blue-text">How do we stop the text from dropping beneath the menu ?</p>
<p>We need to add a margin-left to the body. This is a simple trick that does the job quickly. However we&#8217;ll see that when we get to the body.</p>
<p>We still haven&#8217;t finished on the menu. We still need to add a few effects.<br />
I won&#8217;t waste time explaining everything in detail. It&#8217;s simple, and it&#8217;s just to make things look a bit better.</p>
<p>The main thing to understand here, is that I&#8217;m nesting elements.<br />
Do you remember, when we write for example :<br />
.sub-menu ul<br />
&#8230; means all the &lt;ul&gt; tags inside a sub-menu.</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}

#menu {
     float: left;  /* The menu will float to the left */
     width: 120px;  /* Very important : give the menu a width */
}

.sub-menu {
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
     margin-bottom: 20px;
}

/* a few effects on the menu */

.sub-menu h4 {  /* all the titles in the menu */
     font-size: 20px;
     margin-top: 18px;
     margin-bottom: 12px;
     color: #b3b3b3;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
     text-align: center;
}

.sub-menu ul {  /* all the lists in the menu */
     list-style-image: url(&quot;images/point.png&quot;);  /* change the looks of the points */
     padding: 0px;  /* get rid of any inner margin there may be */
     padding-left: 20px;  /* ... then add a 20 px margin to the left */
     margin: 0px;  /* same thing on the outer margin */
     margin-bottom: 5px;  /* add a 5 px margin to the bottom */
}

.sub-menu a {  /* all the links in the menu */
     color: #b3b3b3;
}

.sub-menu a:hover {  /* when the mouse rolls over the links */
     background-color: #b3b3b3;
     color: black;
}
</pre>
</div>
<p>It&#8217;s already looking nicer isn&#8217;t it ?<br />
And the effect of the :hover on the links in the menu, is easy to do, so everything&#8217;s good so far <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>I&#8217;ve got to precise some things though. You have seen that I put a <q>padding</q> (which modifies the interior margins), then a <q>padding-left</q> (which only modifies the inside margine on the left).<br />
This is just a method to save time. Just read the lines in order :</p>
<ol>
<li>First, modify all the margins and give them all a value of <q>0 px</q> with <em>padding</em></li>
<li>Second, modify the left margin. It was 0 px, now we change its value and make it <q>20 px</q> with <em>padding-left</em> (we <q>squash</q> the old value)</li>
</ol>
<p>If I wanted, I could have done this instead :<br />
padding-top: 0px;<br />
padding-bottom: 0px;<br />
padding-right: 0px;<br />
padding-left: 20px;</p>
<p>But that&#8217;s long, and like all other webmasters, I&#8217;m lazy <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>The Body</h3>
<p>For the body, it&#8217;s very important to define the correct margins.<br />
The problem that needs sorting out urgently is the problem of the text going under the menu. As I said earlier, this is normal because we used <em>float: left</em> on the menu.</p>
<p class="blue-text">How do we stop the text from going under the menu then ?</p>
<p>We just need to change the margin to the left of the body. It&#8217;s the outer margin, so we&#8217;ll use <em>margin-left</em>. We need to give it a big enough value to <q>push</q> the text over to the right, so that it doesn&#8217;t go under the menu (so we need a greater value than the width of the menu). Here for example, we&#8217;ll put a value of 140px. As if by magic, you&#8217;ll see, the body will be correctly placed !</p>
<p>Let&#8217;s not stop now <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> <br />
We&#8217;ll add a <em>margin-bottom</em> so that the footer won&#8217;t be <q>glued</q> to the body :<br />
margin-bottom: 20px;</p>
<p>We&#8217;ll also add a small padding (inside margin) on every side so that the text doesn&#8217;t touch the edge of the body :<br />
padding: 5px;</p>
<p>Then we&#8217;ll add a background colour, a background-image that repeats across the top of the body, a border &#8230; well, all that&#8217;s decoration <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
     padding: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}

#menu {
     float: left;  /* The menu will float to the left */
     width: 120px;  /* Very important : give the menu a width */
}

.sub-menu {
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
     margin-bottom: 20px;
}

.sub-menu h4 {
     font-size: 20px;
     margin-top: 18px;
     margin-bottom: 12px;
     color: #b3b3b3;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
     text-align: center;
}

.sub-menu ul {
     list-style-image: url(&quot;images/point.png&quot;);
     padding: 0px;
     padding-left: 20px;
     margin: 0px;
     margin-bottom: 5px;
}

.sub-menu a {
     color: #b3b3b3;
}

.sub-menu a:hover {
     background-color: #b3b3b3;
     color: black;
}

/* the body of the page */

#body {
     margin-left: 140px;  /* margin to the left to stop the text going under the menu */
     margin-bottom: 20px;  /* bottom margin to separate the body from the footer */
     padding: 5px;  /* to stop the text from touching the edge of the body */
     color: #b3b3b3;
     background-color: #626262;  /* a background colour for the body */
     background-image: url(&quot;images/top-bg.png&quot;);  /* a small image that repeats across the top of the body */
     background-repeat: repeat-x;
     border: 2px solid black;  /* a border to show the edges of the body and look nice */
}
</pre>
</div>
<p>There are still a few things to decorate in the body. For example, the titles : we&#8217;ll change the font and use <q>Arial</q> which I find is nicer on titles.</p>
<p>We&#8217;ll also add a background image to the &lt;h3&gt; titles with <em>background-repeat:no-repeat</em>, which means that the image won&#8217;t repeat (so it will stay to the left).<br />
To avoid the text of the title going over the top of the image, we&#8217;ll add a <em>padding left</em> of a few pixels. That way every time we use a &lt;h3&gt; title we&#8217;ll automatically get a picture of a cog !</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}

#menu {
     float: left;  /* The menu will float to the left */
     width: 120px;  /* Very important : give the menu a width */
}

.sub-menu {
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
     margin-bottom: 20px;
}

.sub-menu h4 {
     font-size: 20px;
     margin-top: 18px;
     margin-bottom: 12px;
     color: #b3b3b3;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
     text-align: center;
}

.sub-menu ul {
     list-style-image: url(&quot;images/point.png&quot;);
     padding: 0px;
     padding-left: 20px;
     margin: 0px;
     margin-bottom: 5px;
}

.sub-menu a {
     color: #b3b3b3;
}

.sub-menu a:hover {
     background-color: #b3b3b3;
     color: black;
}

#body {
     margin-left: 140px;
     margin-bottom: 20px;
     padding: 5px;
     color: #b3b3b3;
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
}

#body h2 {  /* all the h2 titles in body */
     margin-top: 10px;
     margin-bottom: 10px;
     font-size: 28px;
     color: #b3b3b3;
     text-align: center;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
}

#body h3 {  /* all the h3 titles in body */
     height: 30px;
     margin-top: 10px;
     margin-bottom: 10px;
     background-image: url(&quot;images/title.png&quot;);  /* a small background image for h3 titles */
     background-repeat: no-repeat;  /* the image won't repeat, it will be to the left */
     padding-left: 30px;
     font-size: 22px;
     color: #b3b3b3;
     text-align: left;
}
</pre>
</div>
<p>Nice, isn&#8217;t it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>The Footer (And We&#8217;ve Finished !)</h3>
<p>For the footer there is nothing complicated or extraordinary, it&#8217;s just similar to the rest. We add a background colour, a border, check that the borders are okay etc &#8230;</p>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
* {
     border: 0;
     margin: 0;
}

body {
     width: 760px;
     margin: auto;
     margin-top: 20px;
     margin-bottom: 20px;
     background-image: url(&quot;images/bg.png&quot;);
}

#header {
     width: 758px;
     height: 100px;
     background-image: url(&quot;images/banner.png&quot;);
     background-repeat: no-repeat;
     margin-bottom: 10px;
}

h1 a {
     width: 758px;
     height: 100px;
     display: block;
     text-indent: -9999px;
}

#menu {
     float: left;  /* The menu will float to the left */
     width: 120px;  /* Very important : give the menu a width */
}

.sub-menu {
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
     margin-bottom: 20px;
}

.sub-menu h4 {
     font-size: 20px;
     margin-top: 18px;
     margin-bottom: 12px;
     color: #b3b3b3;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
     text-align: center;
}

.sub-menu ul {
     list-style-image: url(&quot;images/point.png&quot;);
     padding: 0px;
     padding-left: 20px;
     margin: 0px;
     margin-bottom: 5px;
}

.sub-menu a {
     color: #b3b3b3;
}

.sub-menu a:hover {
     background-color: #b3b3b3;
     color: black;
}

#body {
     margin-left: 140px;
     margin-bottom: 20px;
     padding: 5px;
     color: #b3b3b3;
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
}

#body h2 {  /* all the h2 titles in body */
     margin-top: 10px;
     margin-bottom: 10px;
     font-size: 28px;
     color: #b3b3b3;
     text-align: center;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, Times, serif;
}

#body h3 {  /* all the h3 titles in body */
     height: 30px;
     margin-top: 10px;
     margin-bottom: 10px;
     background-image: url(&quot;images/title.png&quot;);
     background-repeat: no-repeat;
     padding-left: 30px;
     font-size: 22px;
     color: #b3b3b3;
     text-align: left;
}

/* The footer (generally at the bottom for the copyright) */

#footer {
     padding: 5px;
     text-align: center;
     color: #b3b3b3;
     background-color: #626262;
     background-image: url(&quot;images/top-bg.png&quot;);
     background-repeat: repeat-x;
     border: 2px solid black;
}
</pre>
</div>
<p>And that&#8217;s the end of the CSS, the design is finished !<br />
To make your whole site just save your page as <q>page1.html</q>, <q>page2.html</q>, <q>page3.html</q> etc&#8230; then you can change the content of the different pages !</p>
<p>Our site is finally ready. The <q>Mechanical Spirit</q> design, which was created just for this tutorial, probably won&#8217;t suit your needs. However that was done a bit on purpose <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> <br />
Now that the design is finished, you know what to do, and the main ideas to follow. It&#8217;s up to you to create the complete design for your site, to add your colours, your backgrounds, your fonts, your effects &#8230;<br />
Well, now you know how to do it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p>You are allowed (and encouraged) to use my CSS as an inspiration. I know that it isn&#8217;t the easiest thing in the world when you&#8217;re starting and trying to create first design, and all those lines of code can make you go dizzy.<br />
The good news, is that with practice, not only will you stop getting dizzy, but you&#8217;ll also be able to create your complete design without anybody&#8217;s help <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<p class="centred-image">
<a href="http://downloads.europcsolutions.com/first-site.zip" class="download" title="download source code and images" target="_blank">Download Source Files</a><br />
<a href="http://downloads.europcsolutions.com/first-site.zip" title="download source code and images" target="_blank">CLICK HERE TO DOWNLOAD SOURCE CODE FOR THIS TUTORIAL</a>
</p>
<h2>Download Source Files</h2>
<p>If you want to re-use our source code, modify it, or simply check it out, just <a href="http://downloads.europcsolutions.com/first-site.zip" title="download source code and images">click here</a> to download. The file contains the index.html page, the CSS, and the images used during this tutorial.</p>
<h2>Wait, It&#8217;s Not Finished !</h2>
<p>I&#8217;ve got a few bits of information to give you. Most of it&#8217;s just details, but you might discover a few new things, so pay attention, it won&#8217;t be long <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
<h3>Change The CSS, Change The Design !</h3>
<p>By modifying the CSS, you can change the whole design <u>without touching the XHTML code</u> !</p>
<p>In fact, have a look at our final XHTML code : it doesn&#8217;t contain any information on the design. It just says that there&#8217;s a header, a menu, a body to put the content in, and a footer. That&#8217;s it !</p>
<h3>Let The Visitor Choose The Design</h3>
<p>One last thing I would like to show you : <em>alternative style sheets</em>.</p>
<p>If you have made several designs for your site, you can let your visitors decide which design they want to use.<br />
For that, you have to add &lt;link /&gt; tags between &lt;head&gt; and &lt;/head&gt;.</p>
<p>As well as the tag to link the CSS to the XHTML page, you have to add this line :<br />
&lt;link rel=&quot;alternate stylesheet&quot; media=&quot;screen&quot; type=&quot;text/css&quot; title=&quot;Pink design for girls&quot; href=&quot;pink-poney-design.css&quot; /&gt;</p>
<p>This line indicates that there is another stylesheet (<q>alternate stylesheet</q>). If the visitor has a recent browser (pretty much anything apart from Internet Explorer), he (or she) will be able to choose the design he wants.<br />
For information : in Firefox if you go to View -> Stylesheet, you can choose the design you want.</p>
<p class="green-text">Sites offering several designs are rare. A lot of webmasters don&#8217;t even know it&#8217;s possible to easily do, others can&#8217;t be bothered making several designs <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS – Creating Your Website Design !" class='wp-smiley' title="HTML / CSS – Creating Your Website Design !" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-%e2%80%93-creating-your-website-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211;  Site Layout (Part 2/2)</title>
		<link>http://blog.europcsolutions.com/html-css-site-layout-part-22/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-site-layout-part-22</link>
		<comments>http://blog.europcsolutions.com/html-css-site-layout-part-22/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 19:07:30 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[absolute]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[floats]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[learn css]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[positioning]]></category>
		<category><![CDATA[relative]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=205</guid>
		<description><![CDATA[This is the second chapter about laying out a site. We'll see how to place things where we want on the screen, transform inlines to blocks and make elements float...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/website-layout2.png" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/website-layout2.png" alt="website layout2 HTML / CSS    Site Layout (Part 2/2)" title="HTML / CSS -  Site Layout Part 2" width="580" height="200" class="alignnone size-full wp-image-207" /></a></p>
<p>In the first part of the &quot;site layout&quot; lesson we saw the CSS properties that let you change the appearance and size of blocks. As a quick summary, we saw :</p>
<ul>
<li>How to change the size of blocks</li>
<li>How to change the borders on blocks</li>
<li>How to change margins on blocks</li>
</ul>
<p>In this second part, we&#8217;ll see how to position them. We still need to learn how to say &quot;I want my menu to be on the left, the content on the right, the logo of my site at the top of the page&quot; etc&#8230;<br />
Just to make things clear, positioning in CSS is not the easiest thing in the world&#8230; there&#8217;s theory, and there&#8217;s reality. In this chapter, we&#8217;ll only be seeing the theory (it&#8217;s a needed passage), and in the next chapter we&#8217;ll do the real thing (which will be more interesting for you !).</p>
<p>One thing is for sure, and you&#8217;ll need to get this straight, you&#8217;ll never make a site that&#8217;ll show up the same a pixel close on every browser. We&#8217;ll learn to make sites show up <q>more or less correctly</q> on every browser, which isn&#8217;t a bad place to start <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<h2>Transforming Inlines To Blocks (And Vice Versa)</h2>
<p>Now I&#8217;m going to teach you to <span class="cross-out">defy the laws of physics</span> modify the laws of CSS (brrr&#8230;).</p>
<p>Images (&lt;img /&gt;) are inline tags, would you prefer them to be blocks ? No problem !<br />
Titles (&lt;h1&gt;) are block tags, would you prefer them to be inline ? Still no problems !</p>
<p>There is a very powerful CSS property called <em>display</em> (to use with caution, if not you might destroy everything  <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_lol.gif' alt="icon lol HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" />  ).<br />
This property can take the following values :</p>
<ul>
<li><span class="red-text">block</span> : the concerned tag will become a block</li>
<li><span class="red-text">inline</span> : the concerned tag will become an inline</li>
</ul>
<p>In fact <em>display</em> can take a lot of other values, but I&#8217;m only going to show you the 2 most used ones.</p>
<p>To transform an inline tag into a block, you must type :<br />
display: block;</p>
<p>For example, if I want ALL of my images to be blocks I would write this :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
img {
     display: block;
}
</pre>
<p class="orange-text">Be careful, after doing this all of your images will automatically show up on a new line, like other block tags do.</p>
<p>Nobody said that ALL of your images had to become blocks though. I hope that you&#8217;ve already understood that you can use <q>class</q> on a tag so that it can have a different presentation.<br />
For example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;image.png&quot; alt=&quot;This image is normal (inline)&quot; /&gt;
&lt;img src=&quot;image.png&quot; class=&quot;imageblock&quot; alt=&quot;This image is modified (block)&quot; /&gt;
</pre>
<p>&#8230;and of course you&#8217;ll need the following CSS code to make the second image into a block :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.imageblock {
     display: block;
}
</pre>
<p>I hope I&#8217;m not teaching you anything new about the use of <em>class</em>, if so return to the first chapter of the second part <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p class="blue-text">And the other way ? How do you transform a block into an inline ?</p>
<p>Well, it&#8217;s the same thing, but you use <q>display: inline</q> <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> <br />
I&#8217;m not going to redo an example code, I think you&#8217;re good enough now to do it yourselves <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>A quick comment : Generally we transform inline tags to blocks but the inverse is rarely done. That&#8217;s because block tags have quite a lot of advantages : you can modify their size, margin, border etc&#8230; Well, you already know all that <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<h2>Floating</h2>
<p>The first technique we are going to see is <strong>floating</strong>. It&#8217;s a bit of a strange name, I agree, but it&#8217;s not that hard to understand.<br />
So that you can see what we&#8217;re going to do, here&#8217;s an example of what we&#8217;re going to learn :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-left.png" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-left.png" alt="float left HTML / CSS    Site Layout (Part 2/2)" title="Image With Left Float" width="304" height="202" class="alignnone size-full wp-image-211" /></a></p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-right.png" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/float-right.png" alt="float right HTML / CSS    Site Layout (Part 2/2)" title="Image With Right Float" width="305" height="203" class="alignnone size-full wp-image-212" /></a></p>
<p>This allows us to &quot;surround&quot; an element (here an image) with text. It creates a nice presentation easily.</p>
<p>I imagine that the question you&#8217;re asking yourself is &quot;But which magic property makes things float ?!&quot;.<br />
The answer is&#8230;<strong>float</strong>. This property can take 2 values, which you can probably guess <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" />  :</p>
<ul>
<li><span class="red-text">left</span> : the element will float to the left</li>
<li><span class="red-text">right</span> : the element will float to the right</li>
</ul>
<p>Using <em>float</em> is very easy, so easy that we tend to complicate things unnecessarily. In fact, there are only 2 things to do :</p>
<ol>
<li>Apply a <em>float</em> to a tag</li>
<li>Then continue to write text after it as normal</li>
</ol>
<p class="green-text">You can use the property <em>float</em> on block tags &#038; inline tags, you&#8217;ll see&#8230;</p>
<h3>Floating Images</h3>
<p>Here we&#8217;ll learn how to make an image float (which is inline). Here&#8217;s the image we&#8217;ll be using. Copy it into your images folder :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/flash.gif" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/flash.gif" alt="flash HTML / CSS    Site Layout (Part 2/2)" title="Adobe Flash Logo" width="56" height="62" class="alignnone size-full wp-image-214" /></a></p>
<p>Here&#8217;s the XHTML code we need to write to get started :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;&lt;img src=&quot;../images/flash.gif&quot; class=&quot;floatingimage&quot; alt=&quot;Floating Image&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a normal paragraph text, written after an image, but which will &lt;q&gt;surround&lt;/q&gt; it because the image is floating&lt;br /&gt;
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum mollis scelerisque nulla. Donec feugiat augue et sem. Nulla ut purus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla volutpat leo quis magna. Donec accumsan lobortis ligula. Donec nec ante eu wisi tempus dictum. Sed nulla est, laoreet nec, consequat quis, iaculis non, tortor. Nunc sed purus. Sed metus. Donec posuere. Pellentesque porttitor tortor non eros. Ut rutrum erat a nunc. Duis non erat et orci viverra mollis. Sed lacinia velit a magna. Etiam aliquam, felis eu imperdiet auctor, ante augue dignissim odio, a pharetra tellus neque vel urna. Cras gravida adipiscing lectus. Nullam lorem ipsum, convallis eleifend, congue placerat, dictum non, leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.&lt;/p&gt;
</pre>
<p class="orange-text">A common mistake people make is putting the image after the text. No, you shouldn&#8217;t, the image should be <span class="underline">before</span> the text whether it&#8217;s floating on the left or the right.<br />
If you try putting &lt;img /&gt; after the paragraph, you&#8217;ll see that it doesn&#8217;t work. <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>All that you need to understand now is that we only need to modify the CSS of the image, and not of the paragraph. The paragraph doesn&#8217;t need modifying, it will automatically be placed as needed.<br />
Here&#8217;s the only bit of CSS code we need to make the image float to the left :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.floatingimage {
     float: left;
}
</pre>
<p>You can also have fun floating the image to the right, just put <q>float: right</q>, and it&#8217;s done ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<h3>Create An Illuminated Letter (exercise)</h3>
<p>Sometimes I have a nightmare. I imagine that I&#8217;m writing a long lesson on floating in CSS and everyone is yawning, falling asleep, getting bored.  Brrr&#8230; This vision gives sends chill down my spine every time.</p>
<p>So, to avoid my worst nightmare coming true I decided to make you work a bit on a small exercise.</p>
<p>Do you know what an illuminated letter is ? No.<br />
Well it&#8217;s not that complicated <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>An illuminated letter is the first letter of a paragraph written a lot bigger than the rest. You see them quite often in books (if you read books !). Here&#8217;s what you need to try and do :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/illuminated.gif" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/illuminated.gif" alt="illuminated HTML / CSS    Site Layout (Part 2/2)" title="Illuminated Letter" width="180" height="104" class="alignnone size-full wp-image-216" /></a></p>
<p>The only guidelines are that you must use the following code and <u>you&#8217;re not allowed to modify it</u>.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;The viewers of Euro PC Solutions want to learn how to make websites. They have already read 12 chapters on coding in XHTML and CSS but still haven't learnt to make a complete site ! However of this will soon change. After this rather long chapter on block tags and inlines they will do a complete exercise to build a website from a design made in Photoshop !&lt;/p&gt;
</pre>
<p>Your objectives are to make a CSS file that will make in illumainated letter at the beginning of the paragraph. You can&#8217;t modify the HTML but in CSS every move is possible : you can use the properties you wish. If you&#8217;re having trouble remembering how to change the first letter just go back to the chapter on pseudo formats.</p>
<p>Get to work ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_evil.gif' alt="icon evil HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" />  <br />
&#8230;<br />
&#8230;<br />
&#8230;<br />
Brrriiiiinng!!! It&#8217;s time to stop what you&#8217;re doing !<br />
You had to use float:left; evidently, but how do you make the first letter change ? Without modifying the XHTML ?<br />
If you found out by yourselves that you had to use the pseudo element :first-letter then well done ! It was the only real difficulty, after everything else is easy and you can do what you want.<br />
You need to think mainly of using the property <em>font-size:</em> so that it changes size and takes&#8230;let&#8217;s say 3 times more place than usual. For this I&#8217;ve put the value <q>3em</q> (= 3 lines in height), but if you write 300% it&#8217;s the same thing ! However you should avoid putting something like 50px because we don&#8217;t know the size of the text in the paragraph, it can change.</p>
<p>Here&#8217;s the code I used to make the illuminated letter :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p:first-letter {  /* I want to modify the first letter of the paragraph */
     float: left;  /* Float to the left */
     font-size: 3em;  /* Use Arial if possible */
     font-family: Arial, Georgia, &quot;Times New Roman&quot;, Times, serif;
     font-weight: bold;  /* Put the letter in bold (it's more visible) */
     margin-right: 5px;  /* Put a 5 pixel margin to stop the text from sticking too close to the illuminated letter */
}
</pre>
<p>But there&#8217;s no need to stop there ! Nothing&#8217;s stopping you from writing the letter in white on a black background or even using a background image ! Just use your imagination <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<h3>Stopping A Float</h3>
<p>When you use a float, the text <q>surrounds</q> it, that&#8217;s understood.<br />
But what do you do if you want to stop the float and make the text go underneath the floated element ? You could use several &lt;br /&gt; one after the other but it&#8217;s neither practical nor very clean from a code point of view&#8230;</p>
<p>Here&#8217;s what we would like to do :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/stop-float.gif" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/stop-float.gif" alt="stop float HTML / CSS    Site Layout (Part 2/2)" title="Stopping A Float In CSS" width="240" height="101" class="alignnone size-full wp-image-217" /></a></p>
<p>There exists a CSS property which allows us to say : &quot;Stop, this text needs to be underneath the float, not next to it&quot;. It&#8217;s the property <em>clear</em> which can take 3 values :</p>
<ul>
<li><span class="red-text">left</span> : the text goes underneath a left float</li>
<li><span class="red-text">right</span> : the text goes underneath a right float</li>
<li><span class="red-text">both</span> : the text goes underneath any float</li>
</ul>
<p>To simplify things we&#8217;ll use clear:both all the time, which works after float:left; and float:right; (it works all the time).<br />
To see how it works we&#8217;ll use the following XHTML code :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;&lt;img src=&quot;images/flash.gif&quot; class=&quot;floatingimage&quot; alt=&quot;Floating Image&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This text is written next to a floating image&lt;/p&gt;
&lt;p class=&quot;underneath&quot;&gt;This text is written under a floating image&lt;/p&gt;
</pre>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.floatingimage {
     float: left;
}

.underneath {
     clear: both;
}
</pre>
<p>And that&#8217;s all you need to do <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> <br />
You just apply a clear:both; to the paragraph you want to continue under the floating image !</p>
<h2>Absolute, Fixed &#038; Relative Positioning</h2>
<p>Apart from floats there are 3 different ways to change the position of a block :</p>
<ul>
<li><span class="red-text">Absolute positioning</span> : allows us to position a block anywhere on the page (top left, bottom right, center etc&#8230;).</li>
<li><span class="red-text">Fixed positioning</span> : same as absolute positioning but the block is always visible, even if you scroll the page. It&#8217;s a bit like <em>background-attachment: fixed;</em> (if you can still remember <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" />  )</li>
<li><span class="red-text">Relative positioning</span> : The most complicated. Lets us position the block in relation to its normal position.</li>
</ul>
<p class="green-text">As with <em>float</em>, absolute, fixed &#038; relative positioning also work on inline tags such as &lt;img /&gt; However you&#8217;ll see that they&#8217;re used most often on block tags.</p>
<p>First of all you need to choose the method you want to use. To do this we use the CSS property <em>position</em> followed by one of the following :</p>
<ul>
<li><span class="red-text">absolute</span> : absolute positioning</li>
<li><span class="red-text">fixed</span> : fixed positioning</li>
<li><span class="red-text">relative</span> : relative positioning</li>
</ul>
<p>We&#8217;ll have a look at all these methods one by one.</p>
<h3>Absolute Positioning</h3>
<p>You know that to use absolute positioning you need to write :<br />
<em>position: absolute;</em></p>
<p>However that is not enough <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>You&#8217;ve said that you want to use absolute positioning but you still need to say <strong>where you want the block to be placed on the screen</strong>.<br />
For this we will use 4 CSS properties that you&#8217;re probably starting to know quite well by now :</p>
<ul>
<li><span class="red-text">left</span> : position in relation to the left of the screen</li>
<li><span class="red-text">right</span> : position in relation to the right of the screen</li>
<li><span class="red-text">top</span> : position in relation to the top of the screen</li>
<li><span class="red-text">bottom</span> : position in relation to the bottom of the screen</li>
</ul>
<p>You can give the values in pixels, like <q>14px</q>, or as a percentage, like <q>50%</q>.</p>
<p>If it&#8217;s not very clear to some of you, here is a diagram that should help you understand :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/margins2.png" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/margins2-560x410.png" alt="margins2 560x410 HTML / CSS    Site Layout (Part 2/2)" title="Example Of Margins" width="560" height="410" class="alignnone size-large wp-image-445" /></a></p>
<p>With that, you should be able to correctly place your block <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>We need to use the property <em>position</em> followed by at least one of the above properties (top, right, left, bottom). For example if you write :<br />
<em>position: absolute;<br />
right: 0px;<br />
bottom: 0px;</em><br />
&#8230;your block will be placed at the bottom right of the screen (0 pixels from the right and 0 pixels from the bottom).</p>
<p>For this example we will use a universal tag &lt;div&gt; (block). I will write a paragraph and will place two or three words in the block :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;
     This is a normal paragraph.&lt;br /&gt;
     Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer vel libero. Cras dolor. Quisque quis odio eget justo pulvinar aliquet. Morbi luctus mi. Fusce leo. Integer eleifend condimentum felis. Phasellus vitae nibh. Mauris pellentesque porta magna. Quisque at turpis. Praesent semper odio eget risus. Praesent bibendum imperdiet massa. Quisque ac arcu ac augue dapibus vestibulum. Pellentesque gravida. Mauris turpis. Aenean molestie. Praesent at quam et ligula pellentesque luctus.
&lt;/p&gt;

&lt;div&gt;Placed Block&lt;/div&gt;
</pre>
<p>At the moment you&#8217;ll notice that nothing extraordinary has happened. You can just see a paragraph followed by a couple of words.<br />
Now let&#8217;s add some CSS to position the div block :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
div {
     background-color: yellow;
     border: 1px solid green;

     position: absolute;
     left: 35px;
     top: 50px;
}
</pre>
<p>I&#8217;ve put in a yellow background and green border so that you can see the block better.</p>
<p>As you can see the block goes over the paragraph; it masks the paragraph. It&#8217;s one of the main advantages and defaults of absolute positioning, there is no control, you can really put the block <strong>where you want on the page</strong>, but be careful not to mask your text.</p>
<p>Here&#8217;s another example to show you that you can really put the block anywhere :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
div {
     background-color: yellow;
     border: 1px solid green;

     position: absolute;
     right: 50%;
     bottom: 20px;
}
</pre>
<p class="green-text">Here&#8217;s a small technical precision for those who want to go further (the others can ignore it): if you want to use absolute positioning on block A, and inside this block you want to use absolute positioning on a block B, the positioning will be in relation to the top left corner of block A and not of the screen.<br />
Ahhh&#8230;the joys of positioning in CSS <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<h3>Fixed Positioning</h3>
<p>This works in <strong>exactly the same way</strong> as absolute positioning, however this time the block will always stay in the same place on the screen, even if you scroll.</p>
<p class="orange-text">Fixed positioning works on every browser apart from Internet Explorer 6 and earlier. On these versions the block won&#8217;t be placed at all.</p>
<p>Instead of writing <em>position: absolute;</em> we need to write <em>position: fixed;</em> in our CSS. Like before we use top, left, right and bottom to place the block where we desire.</p>
<p><em>position: fixed;</em> can be particularly useful to make a menu that is always visible :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;
     Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed dapibus, purus et suscipit nonummy, nisl sapien varius velit, a dapibus velit diam a magna. Ut bibendum, velit ut ultricies blandit, metus tortor bibendum diam, vitae aliquet magna ligula id diam. Etiam id diam. Cras volutpat ligula vel arcu. Aenean ullamcorper mauris ultrices neque. Praesent blandit nunc a lectus. Aliquam leo tellus, dictum feugiat, pharetra sed, fringilla non, dui. Cras tincidunt. Proin in dui nec risus tristique porttitor. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In posuere interdum quam. Nam sed dolor.&lt;br /&gt;
     Vivamus a dolor a erat dapibus pretium. Aliquam pulvinar neque id sem. Vestibulum ut pede. Aliquam scelerisque, wisi volutpat accumsan accumsan, diam diam sagittis elit, at tempor orci tortor ac urna. Aliquam dapibus arcu id libero. Praesent pharetra. Aliquam erat volutpat. Morbi lorem lorem, varius nec, venenatis sit amet, scelerisque et, lacus. Vivamus eget erat eleifend est laoreet ullamcorper. Morbi erat elit, tincidunt non, imperdiet ac, viverra ut, tellus. Cras ipsum risus, consectetuer malesuada, pulvinar non, posuere in, mauris. Cras erat tellus, mollis in, ullamcorper vel, semper ut, mauris. Pellentesque nonummy libero eu pede. Praesent quam pede, tincidunt quis, rutrum at, accumsan at, felis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent vel est placerat velit vestibulum tempus. Integer sollicitudin rutrum neque. Integer pretium nulla. Proin a mi. Integer suscipit vestibulum ligula.&lt;br /&gt;
     Quisque vitae purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam ultricies interdum tortor. Fusce pellentesque urna sed turpis. Maecenas sit amet enim et enim aliquet semper. Morbi risus. Pellentesque varius erat vitae mi. Integer sapien dolor, tempus a, fermentum et, viverra eu, leo. Sed vitae felis. Proin enim. Donec tincidunt pede sed urna. Sed in velit. Sed gravida ultricies dolor. Aenean tortor nibh, cursus quis, vestibulum vehicula, semper non, nunc. Etiam fermentum, mauris ut rhoncus hendrerit, pede nunc mattis felis, eu molestie lacus metus id eros. In hac habitasse platea dictumst.&lt;br /&gt;
Vestibulum non leo in purus convallis auctor. Praesent quis arcu. Nunc magna. Vestibulum vel dolor. Curabitur diam. Suspendisse ut justo. Sed at quam quis massa viverra iaculis. Suspendisse eget augue nec arcu condimentum molestie. Vivamus tincidunt mauris vitae ante. Cras metus turpis, ullamcorper eu, consectetuer a, commodo feugiat, metus. Donec sit amet sem. Nunc blandit nibh. Curabitur eros libero, sagittis id, accumsan vel, dignissim id, orci. Donec eleifend erat ac tellus. Integer in nunc vitae quam aliquet interdum. Pellentesque blandit, ante ac ultricies varius, nibh eros vulputate justo, sit amet facilisis sem enim sit amet nunc. Maecenas at ligula vel mauris laoreet placerat. Integer pulvinar libero sit amet nulla. Praesent nibh turpis, sagittis vitae, congue non, malesuada sed, dui. Nunc et mauris.
&lt;/p&gt;

&lt;div&gt;
     &lt;p&gt;Menu&lt;/p&gt;
     &lt;ul&gt;
          &lt;li&gt;Home&lt;/li&gt;
          &lt;li&gt;Forum&lt;/li&gt;
          &lt;li&gt;Guest Book&lt;/li&gt;
     &lt;/ul&gt;
&lt;/div&gt;
</pre>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
div {
     background-color: yellow;
     border: 1px solid green;
     width: 150px;
     height: 250px;

     position: fixed;
     right: 40px;
     top: 60px;
}

p {
     width: 300px;
}
</pre>
<h3>Relative Positioning</h3>
<p>A bit more delicate to use, relative positioning can rapidly become very tricky if you&#8217;re not careful.<br />
Let&#8217;s take for example some important text, situated between &lt;strong&gt; tags.</p>
<p>To start I&#8217;ll put a red background on it to make it more visible.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;There's no doubt, &lt;strong&gt;this text is important&lt;/strong&gt; if you want to correctly understand relative positioning.&lt;/p&gt;
</pre>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
strong {
     background-color: red;  /* the background is red */
     color: yellow;  /* the text is yellow */
}
</pre>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/relative.gif" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/relative.gif" alt="relative HTML / CSS    Site Layout (Part 2/2)" title="Relative Positioning" width="365" height="60" class="alignnone size-full wp-image-220" /></a></p>
<p>When you use <em>position: relative;</em> and you apply <em>top, left, right, bottom</em> properties the text on the red background will be moved <span class="underline">in relation to its original point</span>.</p>
<p>I did say it was more complicated <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" />  You just need to do a few tests to understand it.<br />
Let&#8217;s take an example : I want the text to move 55 pixels to the right and 10 pixels down. I will therefore ask the left side to move over by 55 pixels and the top to move by 10 pixels :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
strong {
     background-color: red;
     color: yellow;

     position: relative;
     left: 55px;
     top: 10px;
}
</pre>
<p>The text is moved in relation to its original position :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/relative-1.gif" rel="shadowbox[sbpost-205];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/relative-1.gif" alt="relative 1 HTML / CSS    Site Layout (Part 2/2)" title="Relative Positioning Example" width="389" height="72" class="alignnone size-full wp-image-224" /></a></p>
<p>That&#8217;s the main idea. It&#8217;s up to you to decide if you need it or not but at least you know how it works <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
<p>Now that you know that, you&#8217;re ready for the next chapter&#8230;<br />
But what was the next chapter again ?&#8230;Ah yes! It&#8217;s a practical exercise <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> <br />
The next chapter will not teach you anything new, but will interest you a lot : I&#8217;ll be showing you how to code a design from A to Z with what we&#8217;ve learnt <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS    Site Layout (Part 2/2)" class='wp-smiley' title="HTML / CSS    Site Layout (Part 2/2)" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-site-layout-part-22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; Site Layout (Part 1/2)</title>
		<link>http://blog.europcsolutions.com/html-css-site-layout-part-12/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-site-layout-part-12</link>
		<comments>http://blog.europcsolutions.com/html-css-site-layout-part-12/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 17:21:02 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[learn css]]></category>
		<category><![CDATA[margins]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[span]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=192</guid>
		<description><![CDATA[We'll see how to create margins for our website and how to create different blocks to prepare for your design. We'll also revisit the difference between inline and block.]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/website-layout1.png" rel="shadowbox[sbpost-192];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/website-layout1.png" alt="website layout1 HTML / CSS   Site Layout (Part 1/2)" title="HTML / CSS - Site Layout Part 1" width="580" height="200" class="alignnone size-full wp-image-203" /></a></p>
<p>Are you ready ? Good because it&#8217;s now that everything&#8217;s going to start coming together. Up until now you could follow my small examples and invent your own but you still couldn&#8217;t create a web site.<br />
The 2 chapters that you are now going to read are the turning point in these lessons : after this, you&#8217;ll be able to design your own web site with its design and everything ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" />  And for those who are scared of not being able to manage don&#8217;t worry : I&#8217;m not going to abandon you. I&#8217;ve already planned to show you the whole process in a complete web design exercise <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>The title of this chapter says quite a lot. We&#8217;ll be <q>setting up</q> our web site, which means it&#8217;ll soon be ready !<br />
And, as I&#8217;ve thought that some of you may not have listened properly when I was talking about the <em>inline / block</em> tags, I don&#8217;t think it would hurt to quickly see what they are again <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<h2>Block &amp; Inline Aren&#8217;t The Same !</h2>
<p>All the way through the previous chapters, I kept on saying <q>inline</q> and <q>blocks</q>. I insisted on the fact that it was important to understand, because a lot would be based around it after.<br />
Well, guess what, it&#8217;s now that understanding the difference is important. If you can&#8217;t tell the difference between an inline tag and a block tag, you will quickly be unsettled. Therefore don&#8217;t hate me for this small reminder <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p class="blue-text">Euhh, what are we talking about here ?</p>
<p>We&#8217;re talking about tags. We can class XHTML tags in one of these two categories : <strong>inline and block</strong>.<br />
What I&#8217;m expecting of you is that you know if a tag is inline or block.</p>
<p>For example, &lt;p&gt;&lt;/p&gt; ?<br />
Yes, it&#8217;s a <strong>block</strong> tag.<br />
And &lt;a&gt;&lt;/a&gt; ?<br />
That&#8217;s an <strong>inline</strong> tag.</p>
<p class="blue-text">But how do I recognise an inline tag or a block tag ?</p>
<p>In fact, it&#8217;s easy enough to understand :</p>
<ul>
<li><span class="red-text">block</span> : a <q>block</q> type tag will automatically create a new line before and after itself. Your website will be created with a series of blocks, one placed after the other. But you will see as well that it&#8217;s possible to put one block inside another, which will give us considerably more possibilities to create our site !</li>
<li><span class="red-text">inline</span> : a tag of th type <q>inline</q> has to be placed inside a block. An inline tag doesn&#8217;t create a new line after, the text inside it therefore just goes after the existing text in the block which explains why it&#8217;s called <q>inline</q> (on the same line).</li>
</ul>
<p>Does &lt;p&gt;&lt;/p&gt; start a new line ?<br />
Yes, it&#8217;s therfore a block tag.<br />
Does &lt;a&gt;&lt;/a&gt; start a new line ?<br />
No, the text just puts itself next to what is already written, it stays on the same line. It&#8217;s therefore an inline tag.</p>
<p>Easy, isn&#8217;t it ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>For those who are still having problems, here&#8217;s a quick diagram I made. This diagram illustrates how I see things :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/block-inline-diagram.gif" rel="shadowbox[sbpost-192];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/block-inline-diagram.gif" alt="block inline diagram HTML / CSS   Site Layout (Part 1/2)" title="Inline / Block Diagram" width="350" height="300" class="alignnone size-full wp-image-194" /></a></p>
<p>On the blue background is everything that is type block. On the yellow background is an inline tag. I could have put a block inside a block but I don&#8217;t want to compicate things too much for the moment <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" />  The inline tag &lt;a&gt;&lt;/a&gt; is inside a block tag (which I said was necessary), and the text is written on the same line. In fact, like on this image, you can ask yourself <q>can &lt;a&gt;&lt;/a&gt; go inside such a tag ?</q> If the answer is yes then the tag is a block, if not it&#8217;s inline.</p>
<h3>A Few Examples</h3>
<p>To help you recognise inline tags and block tags, here&#8217;s a small table with some of the most common tags :</p>
<p class="centred-image"><a href="http://localhost/europcsolutions/europcblog/wp-content/uploads/2011/02/block-inline-table.gif" rel="shadowbox[sbpost-192];player=img;"><img src="http://localhost/europcsolutions/europcblog/wp-content/uploads/2011/02/block-inline-table.gif" alt="block inline table HTML / CSS   Site Layout (Part 1/2)" title="Block / Inline Table" width="213" height="219" class="alignnone size-full wp-image-196" /></a></p>
<p>This table is not complete, it&#8217;s far from it. If you want to have the complete list of tags that exist, go to our annexe containing all the tags.</p>
<h3>Universal Tags</h3>
<p>You already know them because I presented them a few chapters ago. These tags don&#8217;t do anything in particular (differently to &lt;p&gt; which is a <q>paragraph</q>, &lt;strong&gt; which is <q>important</q> etc&#8230;).<br />
The main interest of these tags is that we can apply a class (or id) to them when no other tag is convenient.</p>
<p>There are 2 generic tags, and as if by pure luck the only difference between them is that one is inline and the other block :</p>
<ul>
<li>
<p><span class="red-text">&lt;span&gt;&lt;/span&gt;</span> <em>(inline)</em> : we&#8217;ve already used it if you remember. I used it to show you a few CSS properties in the middle of a line. Do you remember the following code ?</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;As &lt;span class=&quot;name&quot;&gt;Neil Armstrong&lt;/span&gt; said on 20 July 1969...&lt;/p&gt;
</pre>
<p>If there was an XHTML tag &lt;name&gt;&lt;/name&gt; I would have used it. But as that&#8217;s not the case I had to use &lt;span&gt; and apply a class to it that I invented (<q>name</q>).</p>
</li>
<li><span class="red-text">&lt;div&gt;&lt;/div&gt;</span> <em>(block)</em> : this tag, like span, doesn&#8217;t have any particular meaning. I personally think of it as an invisible box used to do whatever you wish. In the following chapters we will use it a lot, namely for creating the design of your web site. You will see that a design, in fact, is a series of blocks placed as we want.</li>
</ul>
<h3>Respect The Semantics !</h3>
<p>Universal tags are <q>useful</q> in certain cases, but don&#8217;t abuse them. I&#8217;ll warn you now : a lot of webmasters use &lt;div&gt; and &lt;span&gt; too often and forget that other, more adapted tags exist.<br />
Here are 2 examples :</p>
<ul>
<li>
<p><strong>Example of a useless span :</strong><br />
I should never see in one of your codes :<br />
&lt;span class=&quot;important&quot;&gt;<br />
&#8230;when &lt;strong&gt; exists for that purpose !</p>
</li>
<li>
<p><strong>Example of a useless div :</strong><br />
In the same way, this is completely useless :<br />
&lt;div class=&quot;title&quot;&gt;<br />
&#8230;as there already exists tags made especially for titles (&lt;h1&gt;&lt;h2&gt;&lt;h3&gt;&#8230;)</p>
</li>
</ul>
<p>Yes, but you&#8217;ll say that the final result (visually) is the same.. I agree completely.<br />
But, whereas the tags span and div don&#8217;t mean anything in particular, the tags strong and h1 do have a meaning. Strong means <q>important</q> and h1 means <q>main title</q>. These tags are therefore important for Google and other search engines !</p>
<p>In XHTML, we ask that you use meaningful tags as often as possible. We call it <u>respecting the semantics</u>.<br />
The advantage is that, by respecting this, your code will have &quot;logic&quot;. When Google&#8217;s robots reference your site, they will understand the meaning of the tags which will make your search engine rankings better <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<h2>Size</h2>
<p>For the moment we&#8217;ll only work on <q>block</q> tags.</p>
<p>To start with, we&#8217;ll look at the size of the blocks. Differently to an inline, a block has precise dimensions. It has a width and a height.<br />
Which means that, what a surprise, we have 2 CSS properties :</p>
<ul>
<li><span class="red-text">width</span> : the width of the block. It can be given in pixels (px) or as a percentage (%)</li>
<li><span class="red-text">height</span> : the height of the block. Once again it can be given in px or %.</li>
</ul>
<p>By default, and it&#8217;s very important to know this, a block uses 100% of the available width. Look for example at this XHTML code that doesn&#8217;t use any CSS properties.</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur sapien pede, malesuada ac, ultricies in, dignissim eget, mauris. Nullam varius diam ac ligula. Morbi mattis posuere odio. Ut mattis risus ac erat. Nam volutpat, nisl vitae venenatis mollis, ante erat tincidunt purus, nec ornare felis tellus sed purus. Phasellus orci.&lt;/p&gt;
</pre>
<p>If you copy the code into a HTML document you&#8217;ll notice that the paragraph takes the whole width of the screen (like all the other block tags).<br />
Now let&#8217;s add a bit of CSS to modify the width of our paragraphs. The following CSS says &quot;I want my paragraphs to use half of the available space&quot; :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 50%;
     text-align: justify;  /* Justified text to better see the width that's used */
}
</pre>
<p>Let&#8217;s test the code on the previous HTML code. You&#8217;ll see that the paragraph now uses half of the screen !</p>
<p>Percentages are very useful for making sites that adapt themselves automatically to the resolution of your visitor&#8217;s screen.<br />
However, you may need a size in pixels :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 250px;
     text-align: justify;
}
</pre>
<h3>Minimum &amp; Maximum</h3>
<p>It will also be useful for you to tell your blocks to have a maximum or minimum size. It&#8217;s here that the following 4 CSS properties come into play :</p>
<ul>
<li>min-width : minimum width</li>
<li>min-height : minimum height</li>
<li>max-width : maximum width</li>
<li>max-height : maximum height</li>
</ul>
<p>Be careful however, the properties don&#8217;t work at all on Internet Explorer 6, and only partially on IE7.</p>
<h3><q>Cutting</q> Blocks With An Overflow</h3>
<p>Let&#8217;s suppose that you have a very long paragraph and you want (for a reason that only concerns you), that it&#8217;s 250px wide and 100px high.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 250px;
     height: 100px;
     text-align: justify;
}
</pre>
<p class="blue-text">Wait, I thought the paragraph would be 100px high !?</p>
<p>Yes, but if the text doesn&#8217;t have enough room, the block will enlarge itself to make all the text visible. If you want to <q>cut</q> your paragraph so that it has an exact dimension of 250&#215;100, you&#8217;ll need to use the CSS property <em>overflow</em>.<br />
The values that <em>overflow</em> can take are :</p>
<ul>
<li><span class="red-text">visible</span> (by default) : if the text goes over the size limits, the block will be enlarged to make everything visible.</li>
<li><span class="red-text">hidden</span> : if the text goes over the limits it will be cut off. You won&#8217;t be able to see the rest of it</li>
<li><span class="red-text">scroll</span> : here again the text will be cut off if it goes over the limits. However, this time the browser will add scroll bars so that you can see the text. It&#8217;s a bit like a frame inside a page.</li>
<li><span class="red-text">auto</span> : <q>automatic pilot</q> mode  <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_lol.gif' alt="icon lol HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" />  . Your bowser decides whether or not to put scroll bars (they will be added if needed).</li>
</ul>
<p>With CSS we can test <em>overflow</em> :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {  /* All the paragraphs will have these properties */
     width: 250px;
     height: 100px;
     text-align: justify;
}

/* And each of the paragraphs will have one of the following properties */
.cut {
     overflow: hidden;
}

.scroll-bars {
     overflow: scroll;
}

.auto {
     overflow: auto;
}
</pre>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h2&gt;overflow: hidden&lt;/h2&gt;

&lt;p class=&quot;cut&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur sapien pede, malesuada ac, ultricies in, dignissim eget, mauris. Nullam varius diam ac ligula. Morbi mattis posuere odio. Ut mattis risus ac erat. Nam volutpat, nisl vitae venenatis mollis, ante erat tincidunt purus, nec ornare felis tellus sed purus. Phasellus orci.&lt;/p&gt;

&lt;h2&gt;overflow: scroll&lt;/h2&gt;

&lt;p class=&quot;scroll-bars&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur sapien pede, malesuada ac, ultricies in, dignissim eget, mauris. Nullam varius diam ac ligula. Morbi mattis posuere odio. Ut mattis risus ac erat. Nam volutpat, nisl vitae venenatis mollis, ante erat tincidunt purus, nec ornare felis tellus sed purus. Phasellus orci.&lt;/p&gt;

&lt;h2&gt;overflow: auto&lt;/h2&gt;

&lt;p class=&quot;auto&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur sapien pede, malesuada ac, ultricies in, dignissim eget, mauris. Nullam varius diam ac ligula. Morbi mattis posuere odio. Ut mattis risus ac erat. Nam volutpat, nisl vitae venenatis mollis, ante erat tincidunt purus, nec ornare felis tellus sed purus. Phasellus orci.&lt;/p&gt;
</pre>
<p>With hidden we can&#8217;t see the text at all.<br />
With scroll, horizontal and vertical bars have been added (even though we don&#8217;t need a horizontal one).<br />
In auto, the browser has thought <q>I don&#8217;t need a horizonatal scroll bar</q> and taken it away.<br />
As you may have guessed, mainly we use overflow:auto when making websites and we want to limit the size of the text boxes.<br />
overflow can be useful if you wish to create <q>frames</q> inside your web page.</p>
<p class="orange-text">There exists an old HTML tag &lt;iframe&gt;, which gives more or less the same result. However this tag no longer exists in XHTML (it&#8217;s outdated). So you&#8217;ll have to use an overflow in its place</p>
<h2>Borders</h2>
<p>CSS offers a wide variety of borders to decorate your page. So many that there are a lot of CSS properties, and if I gave them you all now you wouldn&#8217;t know where to start.<br />
So, to get to the essentials, I&#8217;ve decided to just show the mega-property that regroups everything. Do you remember a mega-property ? Yes, we saw one : background. It was for the background of your web page. Go to the chapter on backgrounds (Text Formatting part 2/2) to see if you can&#8217;t remember.</p>
<p>Here, we&#8217;re going to see the mega-property straight away, because in reality it&#8217;s what we use the most often.<br />
The mega-property in question is border. It&#8217;s this property that allows us to indicate which border we want to add to a block.</p>
<p>Like all mega-properties that respect themselves, you can give it several values (here, there are 3 values to use). You don&#8217;t have to use them all (you can use 2, or just 1), and <u>the order doesn&#8217;t have any importance</u>.<br />
Don&#8217;t forget that, because a lot of people think there&#8217;s a certain order to respect and rack their brains for nothing <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>As I&#8217;ve just said, with <em>border</em> there are 3 values we can use to change the appearance of our borders :</p>
<ul>
<li>
<p><span class="red-text">the width</span> : give the width of your border. Put a value in pixels (like 2px), or use one of the following keywords :</p>
<ul>
<li><span class="green-text">thin</span> : Thin border</li>
<li><span class="green-text">medium</span> : Medium border</li>
<li><span class="green-text">thick</span> : Thick border</li>
</ul>
<p>It&#8217;s the browser that decides how many pixels thin, medium &amp; thick will be. Generally, it&#8217;s roughly the same on every browser (even Internet Explorer :p).<br />
Personnally, I prefer to use values in pixels to <q>thin</q> and company&#8230;But that&#8217;s just a question of taste after all <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
</li>
<li>
<p><span class="red-text">the colour</span> : it&#8217;s the colour of your border. Use, as we have learnt, either the name of a colour (<q>black</q>, <q>red</q>&#8230;), or the hexadecimal value (#FF0000), or the RGB value (rgb(198, 212, 37))</p>
</li>
<li>
<p><span class="red-text">the type of border</span> : here, you have some choice. Your border can be a simple line, or dashes or 3D etc&#8230; Here are the different values available :</p>
<ul>
<li><span class="green-text">none</span> : No border (by default)</li>
<li><span class="green-text">solid</span> : A straight line</li>
<li><span class="green-text">dotted</span> : A straight line made up of dots</li>
<li><span class="green-text">dashed</span> : Border made of dashes</li>
<li><span class="green-text">double</span> : A double border</li>
<li><span class="green-text">groove</span> : Border with a groove in it</li>
<li><span class="green-text">ridge</span> : 3D effect</li>
<li><span class="green-text">inset</span> : Another 3D effect (impression that it&#8217;s going down)</li>
<li><span class="green-text">outset</span> : Another 3D effect (impression that it&#8217;s going up)</li>
</ul>
</li>
</ul>
<p>Now let&#8217;s test all that a bit <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p><strong>Code : HTML</strong></p>
<div class="bigconsole">
<pre class="brush: xml; title: ; notranslate">
&lt;h2&gt;none (no border)&lt;/h2&gt;

&lt;p class=&quot;nothing&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;solid&lt;/h2&gt;

&lt;p class=&quot;solid&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;dotted&lt;/h2&gt;

&lt;p class=&quot;dotted&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;dashed&lt;/h2&gt;

&lt;p class=&quot;dashed&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;double&lt;/h2&gt;

&lt;p class=&quot;double&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;groove&lt;/h2&gt;

&lt;p class=&quot;groove&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;ridge&lt;/h2&gt;

&lt;p class=&quot;ridge&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;inset&lt;/h2&gt;

&lt;p class=&quot;inset&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;h2&gt;outset&lt;/h2&gt;

&lt;p class=&quot;outset&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;
</pre>
</div>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
p {
     width: 300px;  /* All the paragraphs are 300px wide */
     text-align: justify;  /* All the text will be justified */
}

.nothing {
     border: none;
}

.solid {
     border: 2px solid black;
}

.dotted {
     border: green 2px dotted;
}

.dashed {
     border: dashed red 2px;
}

.double {
     border: 4px double maroon;
}

.groove {
     border: 4px groove teal;
}

.ridge {
     border: 4px ridge green;
}

.inset {
     border: inset 3px black;
}

.outset {
     border: black outset 3px;
}
</pre>
</div>
<p>There&#8217;s enough stuff to have fun, as you can see <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<h3>Top, Right, Left, Bottom&#8230;</h3>
<p>Who said that you had to put 4 borders on your block ? Who said they all had to be the same ?<br />
If you want to put different borders depending on the side (top, bottom, left or right), you can do it without a problem. In any case, you can use these 4 properties :</p>
<ul>
<li><span class="red-text">border-top</span> : the top border</li>
<li><span class="red-text">border-bottom</span> : the bottom border</li>
<li><span class="red-text">border-left</span> : the left border</li>
<li><span class="red-text">border-right</span> : the right border</li>
</ul>
<p>These are also mega-properties, they work like border but only on one side.<br />
Here are a few test borders :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h2&gt;A Few Borders I've Invented&lt;/h2&gt;

&lt;p class=&quot;top-bottom&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;p class=&quot;dots&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;

&lt;p class=&quot;very-solid&quot;&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lacinia leo ac nunc. Nulla aliquet. Nullam quam leo, volutpat vitae, venenatis eget, blandit eu, augue. Proin ac libero nec magna laoreet tempus. Nullam felis. Nam et libero. Sed velit dui, tempus in, nonummy venenatis, accumsan id, justo. Ut ullamcorper. Cras sem diam, vulputate nec, tempor at, pretium at, magna.&lt;/p&gt;
</pre>
<p><strong>Code : CSS</strong></p>
<div class="bigconsole">
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;
}

h2 {
     border-bottom: 2px solid black;
}

.top-bottom {
     border-top: 1px dashed red;
     border-bottom: 1px dashed red;
}

.dots {
     border-top: 3px dotted blue;
     border-left: 2px solid green;
     border-right: 2px solid green;
     border-bottom: 3px dotted blue;
}

.very-solid {
     border-left: 6px solid black;
     border-right: 6px solid gray;
}
</pre>
</div>
<p>In particular, you&#8217;ll notice that I&#8217;ve applied a border to the bottom of the title. It doesn&#8217;t have anything to do with underlining.<br />
As I told you earlier : by default, a block (like the title), uses 100% of the available width. Here, the block uses the whole width of the screen. Putting a border undereath it shows this.</p>
<p>Putting a border at the bottom of a title is quite a <q>stylish</q> decorating method. That way the title creates a separation line, which gives more structure and balance to your page. What&#8217;s more is that it&#8217;s easy to use.<br />
After, either you like it or you don&#8217;t&#8230;<br />
&#8230;I like it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p class="green-text">If you want to apply the same border 4 times in your block don&#8217;t bother with using all these CSS properties : just use <em>border</em>.</p>
<h3>It Also Works On Inline Tags !</h3>
<p>I told you that all the CSS properties that we have just seen are mainly applied to block tags&#8230;but not always. For example, you can use border on inline tags (even if it is done more rarely).</p>
<p>There&#8217;s an inline tag upon which we often use border : it&#8217;s &lt;img /&gt; (for images). In effect, do you remember that if you make an image into a link, it&#8217;s surrounded by an ungly blue border ?</p>
<p>Now with CSS you can avoid this eye-sore :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
a img {  /* All the images contained in a link */
     border: none;  /* Take the border away */
}
</pre>
<p>CSS is magic <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>For those who have (already) forgotten, I used nesting. If I write <q>a img</q>, it means <q>all the &lt;img /&gt; tags contained inside a link &lt;a&gt;&#8230;</q></p>
<p class="green-text">Instead of <q>border: none</q>, I could have written <q>border: 0px</q> or <q>border: 0</q> (it works aswell, with 0 you don&#8217;t need a measurement). Most webmasters put <q>border:0</q> simply because it&#8217;s the shortest method.<br />
Don&#8217;t forget, webmasters are humans like everybody else : the less they do, the happier they are <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<h2>Margins</h2>
<p>Ah, the joy of margins <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> <br />
It&#8217;s not the moment to sleep my friends <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>Properly understanding margins is vital. If you don&#8217;t know exactly how a block&#8217;s margins work, you will have big problems putting together your design !</p>
<p>Every block has a margin. The important thing is to know that there are <strong>2 types of margins :</strong></p>
<ul>
<li><span class="green-text">Internal margins</span></li>
<li><span class="red-text">External margins</span></li>
</ul>
<p>Look at this diagram :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/margins.gif" rel="shadowbox[sbpost-192];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/margins.gif" alt="margins HTML / CSS   Site Layout (Part 1/2)" title="Internal / External Margins" width="350" height="329" class="alignnone size-full wp-image-197" /></a></p>
<p>I&#8217;ve put a border on this block so that you can see the margins better.</p>
<p>The distance between the text and the border is the internal margin (<span class="green-text">in green</span>).<br />
The distance between the border and the next block is the external margin (<span class="orange-text">in red</span>).</p>
<p>In CSS, we can modify the sizes of the margins with the two following properties :</p>
<ul>
<li><span class="green-text">padding</span> : gives the size of the inside margin. Normally given in pixels (px).</li>
<li><span class="orange-text">margin</span> : gives the size of the outside margin. Given in pixels (px).</li>
</ul>
<p>To be able to see the margins, let&#8217;s take 2 paragraphs with a small border :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;
     border: 1px solid black;
     text-align: justify;
}
</pre>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h2&gt;Margin Tests&lt;/h2&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla arcu. Nam malesuada ligula vitae orci. Proin nec est. Sed sapien. Integer in wisi. Aenean iaculis, pede nec feugiat viverra, magna erat cursus odio, nec volutpat velit odio sed quam. Maecenas a metus. Nullam scelerisque nunc eu velit. Integer vitae libero ut arcu ullamcorper accumsan. Maecenas pulvinar lacinia ante. Curabitur iaculis nisl non diam malesuada vulputate. Suspendisse quis odio et libero tincidunt rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse potenti. Vestibulum eget nulla. Curabitur a dui at sem porttitor tincidunt. Cras blandit, wisi eget faucibus ornare, leo enim lobortis nulla, in sodales dui nulla id massa.&lt;/p&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla arcu. Nam malesuada ligula vitae orci. Proin nec est. Sed sapien. Integer in wisi. Aenean iaculis, pede nec feugiat viverra, magna erat cursus odio, nec volutpat velit odio sed quam. Maecenas a metus. Nullam scelerisque nunc eu velit. Integer vitae libero ut arcu ullamcorper accumsan. Maecenas pulvinar lacinia ante. Curabitur iaculis nisl non diam malesuada vulputate. Suspendisse quis odio et libero tincidunt rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse potenti. Vestibulum eget nulla. Curabitur a dui at sem porttitor tincidunt. Cras blandit, wisi eget faucibus ornare, leo enim lobortis nulla, in sodales dui nulla id massa.&lt;/p&gt;
</pre>
<p>As you&#8217;ll notice, by default there is no padding. However there is a margin. It&#8217;s this margin that stops the 2 paragraphs from being glued together and gives the impression that we&#8217;ve jumped a line.</p>
<p>Let&#8217;s suppose that I want to add an internal margin of 12px to the paragraphs :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;
     border: 1px solid black;
     text-align: justify;
     padding: 12px;  /* Inside margin of 12 pixels */
}
</pre>
<p>Now I want the paragraphs to have more room between them. Just add the property margin to get a 50px distance between them:</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;
     border: 1px solid black;
     text-align: justify;
     padding: 12px;
     margin: 50px;  /* 50 pixels distance between 2 paragraphs */
}
</pre>
<p class="green-text">What ??? A margin&#8217;s appeared on the left as well !</p>
<p>Yes, <em>margin</em> (just like padding) is applied to 4 sides of the block.<br />
If you want to indicate a margin for the top, bottom, left or right you need to use precise properties&#8230;and you&#8217;ll see that the creators of CSS didn&#8217;t spend too long thinking about it, it works exactly the same way as border.</p>
<h3>Top, Right, Left, Bottom&#8230;Here We Go Again !</h3>
<p>You all know what top, bottom, left &amp; right mean but I&#8217;ll still give you the list of properties for margin &amp; paadding.</p>
<p>Here&#8217;s the list for margin :</p>
<ul>
<li><span class="red-text">margin-top</span> : outside margin at the top</li>
<li><span class="red-text">margin-bottom</span> : outside margin at the bottom</li>
<li><span class="red-text">margin-left</span> : outside margin to the left</li>
<li><span class="red-text">margin-right</span> : outside margin to the right</li>
</ul>
<p>Here&#8217;s the list for padding :</p>
<ul>
<li><span class="red-text">padding-top</span> : inside margin at the top</li>
<li><span class="red-text">padding-bottom</span> : inside margin at the bottom</li>
<li><span class="red-text">padding-left</span> : inside margin to the left</li>
<li><span class="red-text">padding-right</span> : inside margin to the right</li>
</ul>
<p>Is it me or that very repetitive ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>Right, to test that we&#8217;ll use margin-bottom to add space between each paragraph, that way we&#8217;ll avoid having a margin to the left like before. And, just for fun, I&#8217;ve added a left margin to the title (h2), so that it moves over a bit.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;
     border: 1px solid black;
     text-align: justify;
     padding: 12px;
     margin-bottom: 50px;  /* 50 pixels distance between 2 paragraphs */
}

h2 {
     margin-left: 30px;
}
</pre>
<p class="blue-text">Just one question&#8230;what&#8217;s the difference between margin-left and text-indent ?</p>
<p>That&#8217;s a good question <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
<p>Do you remember that to move the title a bit, we used a text-indent in a chapter in part 2 ? Here, margin-left seems to have the same effect&#8230;<br />
Visually, it is the same, at least for the moment. But try adding a really long title. With text-indent the second line will start right on the left hand side again whereas with margin-left the text will always be moved across a bit. If you add a border at the bottom of the title you will see this small difference : with margin-left the border won&#8217;t go to the edge of the screen, but it will with text-indent.</p>
<p>I suggest that you only use text-indent on paragraphs, to move the first line. The rest of the time just mess about with margin and padding to get the effect you desire.</p>
<h3>Centering Blocks</h3>
<p>It is possible to centre blocks, it&#8217;s even very useful when you want to do a design that&#8217;s placed in the centre of the screen.</p>
<p><strong>However</strong>, and this is very important, this will only work if you&#8217;ve entered a precise width for the block.  If you haven&#8217;t entered a width, the block won&#8217;t be centred !</p>
<p>Let&#8217;s take the case of our paragraphs. We&#8217;ve given them a precise width; now if we want to centre them we can give them the value <q>auto</q> in <em>margin</em>, like this :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p {
     width: 350px;  /* We've given the block a width */
     border: 1px solid black;
     text-align: justify;
     padding: 12px;
     margin: auto;  /* We can ask the block to be centred with &lt;q&gt;auto&lt;/q&gt; */
     margin-bottom: 20px;  /* 50 pixels distance between 2 paragraphs */
}
</pre>
<p>That way, the browser automatically centers our paragraphs. Don&#8217;t forget, I repeat once again, that <u>margin:auto only works if you&#8217;ve given a precise width to you block</u>!</p>
<p>All these theoretical notions on blocks can be a bit frustrating I know.<br />
However, it&#8217;s something you need to know and (good news) and it&#8217;s the last obstacle before the creatio of your site. Really, once you&#8217;ve understood this, you can finally do what you want.</p>
<p>That&#8217;s why you need to pay good attention. Without this it&#8217;ll be really hard making your design work. This lesson is still not finished : there&#8217;s still a second part to this lesson.<br />
I just have one good piece of advice to give you : don&#8217;t rush through things. Take the time to be certain you&#8217;ve understood. And most of all&#8230;<br />
Do Tests&#8230;<br />
Do Tests&#8230;<br />
Do Tests&#8230;<br />
Do Tests&#8230;<br />
Do Tests&#8230;<br />
Do Tests&#8230;</p>
<p>Have you started to understand yet ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> <br />
In effect, if you don&#8217;t practice enough you probably won&#8217;t learn. Take the CSS examples from this chapter, and try to modify them. It&#8217;s with practice that you learn best <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Site Layout (Part 1/2)" class='wp-smiley' title="HTML / CSS   Site Layout (Part 1/2)" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-site-layout-part-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML / CSS &#8211; Using Lists</title>
		<link>http://blog.europcsolutions.com/html-css-using-lists/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-css-using-lists</link>
		<comments>http://blog.europcsolutions.com/html-css-using-lists/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 16:54:37 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[definition lists]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[learn css]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[ordered lists]]></category>
		<category><![CDATA[unordered lists]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=181</guid>
		<description><![CDATA[This is the first chapter of the part 3 where we'll be mixing HTML &#038; CSS. In this chapter we'll see ordered, unordered and definition lists.]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/check-list.png" rel="shadowbox[sbpost-181];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/check-list.png" alt="check list HTML / CSS   Using Lists" title="HTML / CSS - Using Lists" width="580" height="200" class="alignnone size-full wp-image-185" /></a></p>
<p>So, you&#8217;ve reached the third part of these lessons I see. Well done, you&#8217;re doing well <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> <br />
You&#8217;ve still got quite a bit to learn on XHTML &#038; CSS. Mainly, and it&#8217;s important, you will learn how to make the design of your web site in this part.</p>
<p>In part 3 we&#8217;ll learn new things in XHTML <span class="underline">and</span> in CSS. The plan of the lesson can be summarised like so :</p>
<ol>
<li>XHTML</li>
<li>CSS</li>
<li>XHTML &#038; CSS &#8211; The combined power of both languages</li>
</ol>
<p>Ah, did you notice what I did there ? I used a list to write down the different parts, and that&#8217;s what I&#8217;ll teach you in this chapter !</p>
<p>It&#8217;s not very hard to understand, and it&#8217;s a nice introduction chapter to part 3 which will get a bit more complicated as we go along.<br />
And yes, for those who are asking themselves, this is the most <q>difficult</q> part. But there&#8217;s no need to worry, if you pay good attention every thing should be fine <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<h2>Different types of lists (XHTML)</h2>
<p>In this chapter we&#8217;ll do the following : firstly we&#8217;ll see how to set up lists in XHTML, and after that we&#8217;ll see how to decorate them with CSS. To start with, you should know that there are 3 types of lists :</p>
<ul>
<li>Ordered lists</li>
<li>Unordered lists</li>
<li>Definition lists (rarer)</li>
</ul>
<p>We will see how to create each one of these lists. It&#8217;s easy, but still pay attention as you will need lists in the following chapters (in fact you need lists in most web sites&#8230;). In effect, differently to what you may think about lists, they are used a lot, they will be used mainly to create the menu of your site !</p>
<h3>Unordered Lists</h3>
<p>An unordered list looks like this :</p>
<ul>
<li>Strawberries</li>
<li>Raspberries</li>
<li>Cherries</li>
</ul>
<p>This is a system that allows us to make a list of elements, without any order (no <q>first</q> or <q>last</q>). Creating an unordered list is very easy. You just write the tag &lt;ul&gt; which is closed later with &lt;/ul&gt;</p>
<p>Start by writing this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt; &lt;/ul&gt;
</pre>
<p>And now, here&#8217;s what we&#8217;re going to do : we&#8217;re going to write each of the elements of our list between the tags &lt;li&gt; &lt;/li&gt;. All these tags have to be between &lt;ul&gt; and &lt;/ul&gt;. You&#8217;ll understand straight away with this example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
     &lt;li&gt;Strawberries&lt;/li&gt;
     &lt;li&gt;Raspberries&lt;/li&gt;
     &lt;li&gt;Cherries&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>&lt;ul&gt; &lt;/ul&gt; is a list<br />
&lt;li&gt; &lt;/li&gt; is a new element in the list</p>
<p>Of course, you can put as many elements as you want in a list, you aren&#8217;t limited to 3 <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>And that&#8217;s it, you know how to make an unordered list !<br />
It wasn&#8217;t too hard was it ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p class="green-text">If you need to make a complicated list, you should know that you can make a list inside a list. If you want to do that open a second &lt;ul&gt;&lt;/ul&gt; inside a &lt;li&gt;&lt;/li&gt;<br />
If you close the tags in the right order there shouldn&#8217;t be any problems <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<h3>Ordered Lists</h3>
<p>You&#8217;ve already found out that making unordered lists is really easy&#8230;well, now you&#8217;re going to find out how hard it is to make a web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>To make an ordered list, we&#8217;re not going to mess about. We only need to change the &lt;ul&gt;&lt;/ul&gt; tags, which now become &lt;ol&gt;&lt;/ol&gt; (<strong>u</strong>l for <strong>unordered</strong> list, <strong>o</strong>l for <strong>ordered</strong> list).<br />
Inside nothing changes, we still use &lt;li&gt;&lt;/li&gt;</p>
<p class="orange-text">However, this time the order of the elements is important. The 1st &lt;li&gt;&lt;/li&gt; is element 1, the 2nd &lt;li&gt;&lt;/li&gt; is element 2 etc&#8230;</p>
<p>As it is rather instinctive, I&#8217;ll leave you to admire the simplicity of this example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ol&gt;
     &lt;li&gt;I get up&lt;/li&gt;
     &lt;li&gt;I eat and drink&lt;/li&gt;
     &lt;li&gt;I go back to sleep&lt;/li&gt;
&lt;/ol&gt;
</pre>
<p>Compared to the last example, all we had to change was the &lt;ol&gt; tag.</p>
<h3>Definition Lists</h3>
<p>Here however, it&#8217;s different to the previous examples. It&#8217;s <q>a bit</q> more difficult (but truly just a bit <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" />  )<br />
The global idea is the same. We indicate the beginning and end of the list with tags. This time it isn&#8217;t &lt;ul&gt; or &lt;ol&gt;, but as you may have guessed &lt;dl&gt; (abbreviation of <q><strong>D</strong>efinition <strong>L</strong>ist</q>).</p>
<p>Let&#8217;s start by writing this :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;dl&gt; &lt;/dl&gt;
</pre>
<p>Right, now the small difference is that we don&#8217;t use &lt;li&gt; to indicate the elements of the list.<br />
In effect, in a definition list, there are <u>2 different types of elements</u> :</p>
<ul>
<li>The words</li>
<li>And their definitions</li>
</ul>
<p>The words go between &lt;dt&gt;&lt;/dt&gt;, and the definitions go between &lt;dd&gt;&lt;/dd&gt;</p>
<p>What you need to understand is that we must first put the word (&lt;dt&gt;), and then its definition (&lt;dd&gt;). If you want to add a second definition, you need to restart : a <em>dt</em>, then a <em>dd</em>.</p>
<p>Have a good look at this example :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;dl&gt;
     &lt;dt&gt;Cat&lt;/dt&gt;
     &lt;dd&gt;Animal with 4 legs that goes &quot;Miaow !&quot;&lt;/dd&gt;
     &lt;dt&gt;Dog&lt;/dt&gt;
     &lt;dd&gt;Animal with 4 legs that goes &quot;Woof Woof !&quot;&lt;/dd&gt;
     &lt;dt&gt;Maths Teacher&lt;/dt&gt;
     &lt;dd&gt;Alien from another planet that teaches something that nobody understands&lt;/dd&gt;
&lt;/dl&gt;
</pre>
<p>As you can see, when you test the code, the definitions are slightly to the right of the words. At the moment it doesn&#8217;t look very nice, but everyone knows that with a bit of CSS magic we can make the words  become bold and blue, and the definitions flashing red. If you can&#8217;t do that by yourself you might have gone through part 2 quickly <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>So, elements in a definition list go in pairs. Once you have understood that you need to write first the word, then the definition, well, you know how to use definition lists ! <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>What would you say to spicing it all up with some CSS ? It should be even better after <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<h2>Decorating Lists (CSS)</h2>
<p>No, don&#8217;t worry, I&#8217;m not going to teach you how to make the definitions flash on a red background <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" />  You already know how to do that :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
dd {
     background-color: red;
     /* . . . */
}
</pre>
<p>Anyhow, that&#8217;s already been seen several times, and now I&#8217;ve just put you on the right path <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> <br />
What we are now going to see are CSS properties specialised in the presentation of lists. There are 3 of them. We&#8217;ll see how each of them works.</p>
<h3>List Position</h3>
<p>The first property I&#8217;m going to show you is easy to use. It allows you to say if you want the elements content to wrap itself around the bullet point. This property is called <em>list-style-position</em>, and can take 2 values :</p>
<ul>
<li><span class="red-text">inside</span> : the element wraps around</li>
<li><span class="red-text">outside</span> : the element doesn&#8217;t wrap around (by default)</li>
</ul>
<p>This diagram will show you the difference between inside and outside :</p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/list-position.jpg" alt="list position HTML / CSS   Using Lists" title="List Positions" width="250" height="200" class="alignnone size-full wp-image-435" /></p>
<p>Here&#8217;s the CSS to allow you to test the positions :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.no-wrap {
     list-style-position: outside;
}

.wrap {
     list-style-position: inside;
}
</pre>
<p>and an XHTML code with a list :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Here is a list that doesn't wrap (by default) :&lt;/p&gt;

&lt;ul class=&quot;no-wrap&quot;&gt;
     &lt;li&gt;Bullet&lt;br /&gt;Point List&lt;/li&gt;
     &lt;li&gt;Line 1&lt;br /&gt;Line 2&lt;/li&gt;
     &lt;li&gt;You can see that&lt;br /&gt; the text stays aligned&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a list that wraps :&lt;/p&gt;

&lt;ul class=&quot;wrap&quot;&gt;
     &lt;li&gt;Bullet&lt;br /&gt;Point List&lt;/li&gt;
     &lt;li&gt;Line 1&lt;br /&gt;Line 2&lt;/li&gt;
     &lt;li&gt;You can see that&lt;br /&gt;the text is no longer aligned&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>So that you can see the difference you&#8217;ll need at least 2 lines of text in the elements (which is why I&#8217;ve put a &lt;br /&gt;).</p>
<h3>Bullet Point Style</h3>
<p>A lot more interesting, the property <em>list-style-type</em> lets you change the appearance of the bullet point. In effect, the point doesn&#8217;t need to be a black circle, just as ordered lists don&#8217;t need to be numbered (you can also use a, b, c, d&#8230;).</p>
<p>The property <em>list-style-type</em> can take several values. Some of them only concern unordered lists, the others concern ordered lists :</p>
<ul>
<li>For unordered lists (&lt;ul&gt;) :
<ul>
<li><span class="red-text">disc</span> : a black disc (by default)</li>
<li><span class="red-text">circle</span> : an empty circle</li>
<li><span class="red-text">square</span> : a square</li>
<li><span class="red-text">none</span> : nothing will be shown</li>
</ul>
</li>
<li>For ordered lists (&lt;ol&gt;) there&#8217;s a lot of choice :
<ul>
<li><span class="red-text">decimal</span> : numbers 1, 2, 3, 4, 5&#8230; (by default)</li>
<li><span class="red-text">decimal-leading-zero</span> : numbers starting with 0 (01, 02, 03, 04, 05&#8230;)<span class="red-text"> Doesn&#8217;t work on older versions of Internet Explorer</span></li>
<li><span class="red-text">upper-roman</span> : latin notation in capitals (I, II, III, IV, V &#8230;)</li>
<li><span class="red-text">lower-roman</span> : latin notation in small letters (i, ii, iii, iv, v &#8230;)</li>
<li><span class="red-text">upper-alpha</span> : alphabetic notation in capitals (A, B, C, D, E &#8230;)</li>
<li><span class="red-text">lower-alpha</span> : alphabetic notation in small letters (a, b, c, d, e &#8230;)</li>
<li><span class="red-text">lower-greek</span> : greek notation <span class="red-text">Doesn&#8217;t work in IE</span></li>
</ul>
</li>
</ul>
<p>There also exist other notations for ordered lists, like the armenian notation, georgian, hebrew, japanese etc&#8230;however I&#8217;ll spare you the trouble (and I don&#8217;t think you&#8217;ll mind !). What I have given you above should be more than enough <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>And if we tested some of our modified lists ? Here&#8217;s the XHTML code that will let us test (it&#8217;s a bit big, but don&#8217;t worry, it&#8217;s very repetitive <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" />  )</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h2&gt;A few unordered lists&lt;/h2&gt;

&lt;p&gt;Here's an unordered list without any modifications (= &lt;em&gt;disc&lt;/em&gt;) :&lt;/p&gt;
&lt;ul&gt;
     &lt;li&gt;Bullet&lt;/li&gt;
     &lt;li&gt;Point&lt;/li&gt;
     &lt;li&gt;List&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;em&gt;circle&lt;/em&gt; :&lt;/p&gt;
&lt;ul class=&quot;circle&quot;&gt;
     &lt;li&gt;Bullet&lt;/li&gt;
     &lt;li&gt;Point&lt;/li&gt;
     &lt;li&gt;List&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;em&gt;square&lt;/em&gt; :&lt;/p&gt;
&lt;ul class=&quot;square&quot;&gt;
     &lt;li&gt;Bullet&lt;/li&gt;
     &lt;li&gt;Point&lt;/li&gt;
     &lt;li&gt;List&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With &lt;em&gt;nothing&lt;/em&gt; (no points) :&lt;/p&gt;
&lt;ul class=&quot;nothing&quot;&gt;
     &lt;li&gt;Bullet&lt;/li&gt;
     &lt;li&gt;Point&lt;/li&gt;
     &lt;li&gt;List&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;A few ordered lists&lt;/h2&gt;

&lt;p&gt;Here's an ordered list without any modifications (= &lt;em&gt;decimal&lt;/em&gt;) :&lt;/p&gt;
&lt;ol&gt;
     &lt;li&gt;one&lt;/li&gt;
     &lt;li&gt;two&lt;/li&gt;
     &lt;li&gt;three&lt;/li&gt;
     &lt;li&gt;four&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;with &lt;em&gt;Decimal Leading Zero&lt;/em&gt; (&lt;strong&gt;Doesn't work on IE&lt;/strong&gt;) :&lt;/p&gt;
&lt;ol class=&quot;leading-zero&quot;&gt;
     &lt;li&gt;one&lt;/li&gt;
     &lt;li&gt;two&lt;/li&gt;
     &lt;li&gt;three&lt;/li&gt;
     &lt;li&gt;four&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;with &lt;em&gt;lower alpha&lt;/em&gt; :&lt;/p&gt;
&lt;ol class=&quot;small-letters&quot;&gt;
     &lt;li&gt;one&lt;/li&gt;
     &lt;li&gt;two&lt;/li&gt;
     &lt;li&gt;three&lt;/li&gt;
     &lt;li&gt;four&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;with &lt;em&gt;upper roman&lt;/em&gt; :&lt;/p&gt;
&lt;ol class=&quot;roman letters&quot;&gt;
     &lt;li&gt;one&lt;/li&gt;
     &lt;li&gt;two&lt;/li&gt;
     &lt;li&gt;three&lt;/li&gt;
     &lt;li&gt;four&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;with &lt;em&gt;lower greek&lt;/em&gt; :&lt;/p&gt;
&lt;ol class=&quot;greek-letters&quot;&gt;
     &lt;li&gt;one&lt;/li&gt;
     &lt;li&gt;two&lt;/li&gt;
     &lt;li&gt;three&lt;/li&gt;
     &lt;li&gt;four&lt;/li&gt;
&lt;/ol&gt;
</pre>
<p>&#8230;and the CSS to go with it :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
/* unordered lists */
.circle {
     list-style-type: disc;
}

.square {
     list-style-type: square;
}

.nothing {
     list-style-type: none;
}

/* ordered lists */
.leading-zero {
     list-style-type: decimal-leading-zero;
}

.small-letters {
     list-style-type: lower-alpha;
}

.roman-letters {
     list-style-type: upper-roman;
}

.greek-letters {
     list-style-type: lower-greek;
}

/* a few added styles for presentation and to help you remember ;o) */

h2 {
     text-indent: 20px;
     font-family: Arial, Verdana, &quot;Times New Roman&quot;, serif;
}

em {
     background-color: yellow;
}

strong {
     color: red;
}
</pre>
<p>I&#8217;ve not put all the styles, but you can try them if you want <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<h3>Change The Image Of The Points</h3>
<p>If none of these presentations suit your needs why not create your own ? That is exactly what the property <em>list-style-image</em> allows us to do. It lets you use any image instead of a point.</p>
<p>You must give it the value <q>url</q> followed by the address. It works in exactly the same way as <em>background</em> (which if you remember, lets us add a background).</p>
<p>For example, copy the following image then use the example code, you&#8217;ll see, it&#8217;s a lot nicer <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/folder.png" alt="folder HTML / CSS   Using Lists" title="Folder Icon" width="15" height="15" class="alignnone size-full wp-image-190" /></p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
ul {  /*My list will have points in the shape of folders */
     list-style-image: url(&quot;../images/folder.png&quot;);
}

/* Just to make the presentation better */
a {
     color: blue;
     text-decoration: none;
}

a:hover {
     text-decoration: underline;
}
</pre>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
     &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contracts&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Presentations&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Web Sites&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Videos&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p class="green-text">The format of the image can be any type (PNG, GIF or JPEG).<br />
However, be careful, the image mustn&#8217;t be too big or it will be cut. I suggest that you make them about 15&#215;15 pixels.</p>
<p>So we&#8217;ve done pretty much everything possible with lists.<br />
I agree that the names of the tags aren&#8217;t very clear, but at least they&#8217;re short, and there aren&#8217;t very many to learn <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" />  You&#8217;ll see that you&#8217;ll remember them soon enough <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
<p>And now is not the moment to go to sleep. <span class="underline">The following chapters are very important</span>. If you want to manage to make your web site and learn to make a design, pay close attention from now on !<br />
We&#8217;re going to discover a lot of new things, mainly in CSS <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink HTML / CSS   Using Lists" class='wp-smiley' title="HTML / CSS   Using Lists" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/html-css-using-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS &#8211; Pseudo Formats</title>
		<link>http://blog.europcsolutions.com/css-pseudo-formats/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-pseudo-formats</link>
		<comments>http://blog.europcsolutions.com/css-pseudo-formats/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 22:15:56 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[change links]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[learn css]]></category>
		<category><![CDATA[link rollover]]></category>
		<category><![CDATA[paragraphs]]></category>
		<category><![CDATA[pseudo formats]]></category>
		<category><![CDATA[span]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[text formatting]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=165</guid>
		<description><![CDATA[This is the last chapter of the second part. We'll see how to use pseudo formats to change the colour of your links, change the first line or first letter of text etc...]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/pseudo-format.png" rel="shadowbox[sbpost-165];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/pseudo-format.png" alt="pseudo format CSS   Pseudo Formats" title="CSS - Pseudo Formats" width="580" height="200" class="alignnone size-full wp-image-175" /></a></p>
<p>We have just seen a lot of CSS properties in the previous chapter. You now know how to modify the size of text, its font, its colour etc etc&#8230;<br />
In this chapter we&#8217;ll see a new aspect of CSS : what we call&#8230;<em>pseudo formats</em></p>
<p>We won&#8217;t learn any new CSS properties (you already know quite a few), we are going to see how to apply them in precise cases. For example, we will see how to change the looks of a link when the mouse passes over it, how to automatically change the first letter of a paragraph etc&#8230;</p>
<p>All these elements should allow you to add more dynamism to you web site. Happy times <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<h2>Nice Links</h2>
<p>If you followed the previous chapters properly, you know how to modify the appearance of links. You just need to apply styles to the &lt;a&gt; tags and that&#8217;s it.</p>
<p>By default, links are shown in blue and are underlined. Let&#8217;s suppose that you don&#8217;t want to underline them, you would use :<br />
text-decoration: none;</p>
<p>&#8230;which will get rid of the underline. Therefore your links will no longer be underlined.</p>
<p>Right, up to there I hope I&#8217;m not teaching you anything new <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
Okay, a quick example, just to get started, then we&#8217;ll pass on to the serious things. Here&#8217;s a CSS that applies 2-3 styles to change the ugly default links :</p>
<pre class="brush: css; title: ; notranslate">
a {
     text-decoration: none;  /* The links will not be underlined */
     color: red;  /* The links will be red instead of blue */
     font-style: italic;  /* The links will be in italic (why not ?) */
}
</pre>
<p>We&#8217;re going to learn how to change the appearance of links :</p>
<ul>
<li>&#8230;when the visitor&#8217;s mouse hovers over them</li>
<li>&#8230;when the visitor clicks on them</li>
<li>&#8230;when the visitor has selected them</li>
<li>&#8230;when the visitor has already seen a page</li>
</ul>
<h3>When The Mouse Hovers Over</h3>
<p>The first pseudo format I&#8217;m going to show you is called :hover. Like all the pseudo formats that I&#8217;m going to show you, it&#8217;s information that we add after a tag (or class) in CSS, like this :</p>
<pre class="brush: css; title: ; notranslate">
a:hover {
     /*properties go here*/
}
</pre>
<p><q>:hover</q> means <q>over</q>.<br />
<q>a:hover</q> therefore means <q>when the mouse is over the link</q>.<br />
To the left you write the concerned tag (here it is &lt;a&gt;, the link tag), and to the right you put the pseudo format.</p>
<p>And from there, it&#8217;s up to you to say what you want your links to look like when you go over them.<br />
Here&#8217;s an example of links presentation, but don&#8217;t hesitate to try your own :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
a {
     text-decoration: none;  /* The links won't be underlined */
     color: red;  /* The links will be red instead of blue */
     font-style: italic;  /* The links will be in italic (why not ?) */
}

a:hover {  /* When the mouse goes over the link */
     text-decoration: underline;  /* The link will become underlined */
     color: green;  /* The text will go green */
}
</pre>
<p>&#8230;and as we&#8217;ll be working on a few link examples here&#8217;s an XHTML code I made quickly :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;A Few Useful Addresses&lt;/h1&gt;

&lt;p&gt;
     Do you know &lt;a href=&quot;http://www.google.com&quot;&gt;Google&lt;/a&gt; ? It's the most used search engine in the world !&lt;br /&gt;
     Do you know &lt;a href=&quot;http://www.w3.org&quot;&gt;W3C&lt;/a&gt; ? They define the standards of XHTML &amp; CSS.&lt;br /&gt;
     Do you know &lt;a href=&quot;http://blog.europcsolutions.com&quot;&gt;Euro PC Solutions&lt;/a&gt; ? Errmmm yes, what a stupid question...
&lt;/p&gt;
</pre>
<p>Sweet, isn&#8217;t it ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>The good news is that you can apply the pseudo format <q>:hover</q> to any tag.<br />
The bad news is that on Internet Explorer 6 <q>:hover</q> only works on links. However, from memory this was fixed in Internet Explorer 7.</p>
<p>On all the other browsers (including Mozilla Firefox, which I hope you downloaded a while ago <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" />  ) it works perfectly.</p>
<p>Here&#8217;s an example with :hover on a paragraph :</p>
<pre class="brush: css; title: ; notranslate">
p:hover {
     background-color: #CFE1EB   /* The background will become pale blue when the mouse goes over */
     text-indent: 20px;
}
</pre>
<p>When you go over the paragraphs, they will change colour. It&#8217;s not very useful, but after all the purpose of CSS is to decorate isn&#8217;t it ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<h3>When The Visitor Clicks</h3>
<p>The pseudo format <strong>:active</strong> allows us to apply a particular style at the <span class="underline">moment of the click</span>. This style won&#8217;t be seen for very long : only when the visitor clicks on the link with the mouse. Really, it&#8217;s not always very visible.</p>
<p>Personally, I don&#8217;t really bother with this pseudo format, however if I were to use it I&#8217;d probably change the background colour of the link so that you can tell if you&#8217;ve properly clicked <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" />  :</p>
<pre class="brush: css; title: ; notranslate">
a:active {  /* when the visitor clicks on the link */
     background-color: #FFCC66;
}

a:hover {  /* when the visitor goes over the link */
     text-decoration: underline;
     color: green;
}

a {  /* normal link */
     text-decoration: none;
     color: red;
     font-style: italic;
}
</pre>
<h3>When The Link Is Selected</h3>
<p>It&#8217;s hardly different to what we&#8217;ve just seen. The pseudo format <strong>:focus</strong> applies a style when the link is selected.</p>
<p class="blue-text">Meaning ?</p>
<p>This means that it&#8217;s a bit like <strong>:active</strong>, it&#8217;s at the moment of the click (for a link anyway).<br />
This pseudo format, applied to other XHTML tags that we haven&#8217;t seen yet, will let us create some nice effects, you&#8217;ll see <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>Unfortunately, this doesn&#8217;t work on any of the versions of Internet Explorer before IE8.<br />
Differently to <strong>:link</strong> which only worked on links, this won&#8217;t work at all on older versions of IE.</p>
<p>I&#8217;ll give you a very similar example to the last one (changing the background colour) so that you can see :</p>
<pre class="brush: css; title: ; notranslate">
a:focus {   /* When the visitor selects the link */
      background-color: #FFCC66;
}

a:hover {  /* When the visitor goes over the link */
     text-decoration: underline;
     color: green;
}

a {
     text-decoration: none;
     color: red;
     font-style: italic;
}
</pre>
<p>As you can see : the link keeps its background colour for longer. Personally, I prefer using <strong>:focus</strong> to <strong>:active</strong> because it&#8217;s more visible.<br />
However, as IE can&#8217;t understand everything, I apply the same style to :focus and :active, as I showed you in the first chapter on CSS, by separating the names with a comma :</p>
<pre class="brush: css; title: ; notranslate">
a:active, a:focus {  /* Apply the same style to active and focus links */
     background-color: #FFCC66;
}
</pre>
<p>The advantage to doing this is that if the browser is older than IE8, it will use a:active (and the background will change briefly), but if the visitor has another browser, :focus will be used and the background colour will be more visible.</p>
<p>It&#8217;s up to you to do what you want, I&#8217;m not making you do anything <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<h3>When A Page Has Already Been Visited</h3>
<p>It&#8217;s possible to apply a style when a page has already been seen. By default, browsers put links in an ugly purple colour (even worse than the underlined blue links <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" />  )</p>
<p>Personally, I avoid changing the looks of links that have already been seen because I find that in the end it looks a bit unpleasant visually. But once again, that&#8217;s just a personal opinion and you&#8217;re free to do what you wish <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>The pseudo format that does this is <strong>:visited</strong>. A fun use of this pseudo format (although not very useful) would be to cross out the links that have been visited :</p>
<pre class="brush: css; title: ; notranslate">
a:visited {  /* When the visitor has already seen the page */
     text-decoration: line-through;
}

a:focus, a:active {  /* When the visitor clicks on the link */
     background-color: #FFCC66;
}

a:hover {  /* When the visitor goes over the link */
     text-decoration: underline;
     color: green;
}

a {  /* The normal link */
     text-decoration: none;
     color: red;
     font-style: italic;
}
</pre>
<p>If you&#8217;ve used the same XHTML example as before and already clicked on all the links, all the links will be crossed out and you won&#8217;t see a lot <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>More seriously, if you want to apply a precise style to links that have already been visited, I suggest putting a slightly lighter colour than the normal links.<br />
However, it&#8217;s only a suggestion, but I find that it can look good.</p>
<p>Right, I&#8217;m going to stop giving you all my ideas, or else all your sites will look like eachother <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
We&#8217;ve finished talking about pseudo formats for links. We&#8217;ll now have a look at the pseudo formats to change the first letter or first line of a paragraph.</p>
<h2>First Letter &#038; First Line</h2>
<p>In CSS, it&#8217;s possible to automatically modify the appearance of the fist letter and first line of text in a tag.<br />
Once again we&#8217;ll be using pseudo formats to achieve this. Even though most of my examples will be on paragraphs don&#8217;t forget that it also works on other tags (such as titles etc&#8230;).</p>
<h3>The First Letter</h3>
<p>To modify the appearance of the first letter, you use the pseudo format <strong>:first-letter</strong>.</p>
<p>We can use it to write the first letter of your paragraphs in bold and bigger.<br />
If you also want to indent your text with <em>text-indent</em>, we&#8217;ll end up by thinking we&#8217;re in a storey or newspaper article <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
p:first-letter {  /* the first letter of each paragraph */
     font-weight: bold;  /* in bold */
     font-size: 1.2em;  /* a bit bigger than normal */
     color: blue;  /* written in blue */
}

p {
     text-indent: 20px;
}
</pre>
<p>&#8230;and I&#8217;ll give you a new example to work with :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse ornare tristique pede. Aliquam arcu leo, imperdiet eget, dapibus non, accumsan quis, est. Sed eget massa. Praesent mi. Cras sollicitudin erat non tellus. Quisque sit amet leo. Sed volutpat faucibus eros. Duis eget libero. Ut luctus. Nullam sit amet nibh vel quam accumsan aliquam. Curabitur elementum. Nulla purus dolor, aliquet ac, gravida sit amet, vehicula non, elit. Morbi neque quam, viverra eget, bibendum dictum, condimentum sit amet, nibh. Nunc sit amet nisl eu eros ullamcorper dictum. In orci ligula, viverra non, tempus sit amet, dapibus sit amet, lectus. Pellentesque pharetra. Nam gravida. Pellentesque dignissim. Ut eu leo sed urna ullamcorper aliquam. Nunc ultricies quam sed mauris bibendum iaculis.&lt;/p&gt;

&lt;p&gt;Vivamus pulvinar diam sit amet quam. Nunc dui elit, mattis ut, rhoncus quis, accumsan in, tellus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur eu mauris at risus ullamcorper consequat. Praesent vulputate metus ac pede. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum orci leo, euismod vitae, pulvinar a, aliquet a, tellus. Morbi tincidunt malesuada leo. Proin tincidunt libero at nibh. Cras sollicitudin vulputate nunc. Suspendisse blandit purus vel magna. Nulla dignissim lectus euismod odio.&lt;/p&gt;

&lt;p&gt;Ut ultrices dapibus velit. Aliquam erat volutpat. In tempus libero. Proin tempus. Aenean odio wisi, laoreet nec, viverra et, congue ac, risus. Morbi consectetuer elit et turpis. Vivamus pulvinar. Donec ornare dapibus nibh. Sed odio. In eget turpis.&lt;/p&gt;

&lt;p&gt;Maecenas pretium eros nec tortor. Morbi at ipsum quis massa varius tempus. Morbi placerat eros sit amet quam. Nulla in lorem ut neque volutpat adipiscing. Pellentesque erat magna, volutpat non, rhoncus sollicitudin, tincidunt vitae, felis. Praesent eget magna. Sed dictum. Mauris vehicula auctor risus. Curabitur neque nunc, interdum et, vestibulum id, placerat sit amet, elit. Etiam nec elit id nisl molestie dictum. Maecenas elementum lectus ut magna. In ut sem. Proin suscipit, metus non viverra sodales, elit diam fermentum est, a feugiat eros lorem id risus.&lt;/p&gt;

&lt;p&gt;Nunc ac quam. Curabitur neque orci, malesuada eget, imperdiet ac, tincidunt vel, nisl. Fusce faucibus. Aliquam eleifend, nisl vitae molestie posuere, erat velit sollicitudin wisi, in laoreet est sapien et quam. Sed tincidunt. In sodales neque vel dui. Nunc ut orci in metus molestie tempor. Sed urna. Etiam ut neque auctor sem elementum rutrum. Etiam ac lectus. Sed mollis sem nec tortor. Sed volutpat risus sed magna.&lt;/p&gt;
</pre>
<h3>The First Line</h3>
<p>Another pseudo format that can be interesting is <strong>:first-line</strong>.</p>
<p>When applied to paragraphs. It allows us to change the whole first line. For example, you could put the first line in small capitals to make it more attractive :</p>
<pre class="brush: css; title: ; notranslate">
p:first-line {  /* The first line of each paragraph */
     font-variant: small-caps;  /* In small capitals */
}

p {
     text-indent: 20px;
}
</pre>
<p>Well, we won&#8217;t spend 3/4 hour on that, it&#8217;s easy to use so I&#8217;ll just leave you to mess around with it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<h2>Before / After</h2>
<p>The pseudo formats we are now going to see are very interesting and change a bit from what we&#8217;re used to in CSS. It&#8217;s also a bit more difficult than the rest, so pay attention, it&#8217;s worth it.<br />
As always, there&#8217;s a small detail that will get in our way (again !). These pseudo formats don&#8217;t work at all on Internet Explorer before IE8. Nothing will happen on this browser.</p>
<p>As several people still use Internet Explorer 7 and 6, you shouldn&#8217;t use too many of these pseudo formats so that you don&#8217;t penalise these visitors (or you could do just to teach them a lesson&#8230;) <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
They do however work without any problems on all the other browsers and I think it best that you learn how to use them. It&#8217;s not an old browser, that isn&#8217;t up to date, that should limit your knowledge <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>Right, so what are we talking about ?<br />
We&#8217;re talking of the possibility to automatically add text before and after certain paragraphs, to reduce the amount of text you have to write.</p>
<p>For example, let&#8217;s suppose that I want to ask a lot of questions in a web page. Normally I would write the following in XHTML to ask a question :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;p&gt;Question : How old is the webmaster ?&lt;/p&gt;
</pre>
<p>Right, now let&#8217;s suppose that I&#8217;m a lazy webmaster (you don&#8217;t have a clue how many lazy webmasters there are, and I&#8217;m included :p ). I would like to automatically insert <q>Question : </q> at the beginning and a question mark at the end so that I don&#8217;t have to repeat it 50 times in my XHTML code.<br />
I will create a class <q>question</q> which will allow me to automatically sort out the questions in my text.</p>
<p>Here&#8217;s the XHTML code to help you understand :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;A Lot Of Questions&lt;/h1&gt;

&lt;p&gt;I created the Euro PC Solutions' Blog because I was fed up of not being able to find good tutorials.&lt;/p&gt;

&lt;p class=&quot;question&quot;&gt;When was this site created&lt;/p&gt;

&lt;p&gt;The Blog was started in 2010&lt;/p&gt;

&lt;p class=&quot;question&quot;&gt;What was the first name of the site&lt;/p&gt;

&lt;p&gt;It's not old enough to have changed name ! It's always been called &quot;Euro PC Solutions&quot;&lt;/p&gt;

&lt;p class=&quot;question&quot;&gt;How long did you spend looking for a name&lt;/p&gt;

&lt;p&gt;About two weeks, and then it wasn't even me who found it ! A friend did&lt;/p&gt;

&lt;p class=&quot;question&quot;&gt;How old is the webmaster of this site&lt;/p&gt;

&lt;p&gt;Who ? Me ? My age won't interest anyone !&lt;br /&gt;

Right, okay, one small clue, with that you'll be able to find my age : I started creating this site when I was 20.&lt;/p&gt;
</pre>
<p>Now we&#8217;ll use the following pseudo formats :</p>
<ul>
<li><strong>:before</strong> : what we want to add in front</li>
<li><strong>:after</strong> : what we want to put at the end</li>
</ul>
<p>We&#8217;ll also be using a new CSS property to insert the text : <span class="underline">content</span>.<br />
Look at how I use :before and :after on paragraphs that are part of <q>question</q> :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.question:before {  /* before each question */
     content: &quot;Question : &quot;;  /* start by Question : */
}

.question:after {  /* after each question */
     content: &quot; ?&quot;  /* add a question mark */
}
</pre>
<p><em>content</em> truly is a peculiar property, as it allows us to indicate the text that we want to add before or after. It is a bit different to what we have seen previously(and I promise you, it&#8217;s the only <q>strange</q> property).</p>
<p>You don&#8217;t have to just put <em>content</em> inside :before and :after. You can also use all the other CSS styles that you know. These styles will be applied to the text added by :before and :after.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
.question:before {
     content: &quot;Question : &quot;;
     font-weight: bold;  /* &lt;q&gt;Question&lt;/q&gt; will be put in bold */
     color: blue;  /* &lt;q&gt;Question&lt;/q&gt; will be in blue */
}

.question:after {
     content: &quot; ?&quot;;
}
</pre>
<p>As you can see, the text in :before has become blue and bold.</p>
<p class="orange-text">If you apply the pseudo format :first-letter to the class question, for example to make the first letter bold, it&#8217;s the first letter of <q>Question : </q> (the Q) that will become bold and not the first letter just after <q>Question : </q>. :first-letter will therefore be applied in the :before pseudo function.</p>
<h3>Using Images Instead Of Text</h3>
<p>It is possible to insert images instead of text with :before and :after.</p>
<p>Save the following image in your images folder :</p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/qst.gif" alt="qst CSS   Pseudo Formats" title="Question Mark" width="37" height="37" class="alignnone size-full wp-image-430" /></p>
<p>We still use the CSS property <em>content</em>, but instead of writing text, we give a url value like this :</p>
<pre class="brush: css; title: ; notranslate">
.question:before {
     content: url(&quot;../images/qst.gif&quot;);  /* put an image before the question */
}

.question:after {
     content: &quot; ?&quot;;
}
</pre>
<p class="orange-text">Don&#8217;t forget that the related path to your image is from the CSS file and not the XHTML file. If the path is wrong the image won&#8217;t be shown.</p>
<p>What I have shown you are only examples, you will certainly find more useful things to do with them in your web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
Don&#8217;t forget however that these pseudo formats don&#8217;t work on older versions of IE, so make sure that everything still looks alright in this browser.</p>
<h3>A Quick Summary</h3>
<p>Pseudo formats are a very interesting aspect of CSS, even though they do sometimes bring confusion.<br />
Really, pseudo formats aren&#8217;t used very often on the internet apart from those concerning links. It&#8217;s true that making your links change colour etc is a nice feature to have <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
:first-line and :first-letter work well on every browser (including Internet Explorer) but aren&#8217;t used very often which is a shame because they can make sites look nicer <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> <br />
:before and :after only started working in Internet Explorer when IE8 came out so they&#8217;re not used a lot either. It&#8217;s a shame because a lot of webmasters, including myself, would like to use them more often. Until most people have started using IE8 or a different browser I recommend that you don&#8217;t use them either <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_sad.gif' alt="icon sad CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>That&#8217;s already the end of part II of these lessons.<br />
However the four chapters were very rich in new properties to learn <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>If we summarise what we have done up until now :</p>
<ol>
<li>In part 1 I taught you the basics of XHTML, so that you could make pages with text and images. The pages were a bit ugly but well&#8230;</li>
<li>In part II we introduced CSS. Now, without changing anything in the XHTML code, you can give a nice look to your pages using .css files. The possibilities are practically unlimited.</li>
<li>However, we still haven&#8217;t seen everything on creating web sites. There are still the more complicated XHTML tags to see, mainly the tags for creating tables and forms (mixed with CSS to give them a nice look). Then we need to create a fully functional web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </li>
</ol>
<p>So in part III we will be mixing CSS and XHTML which will finally let you control the full design of your web site <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
<p>When you are ready you can carry on to part III <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Pseudo Formats" class='wp-smiley' title="CSS   Pseudo Formats" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/css-pseudo-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS &#8211; Text Formatting In CSS (Part 2/2)</title>
		<link>http://blog.europcsolutions.com/css-text-formatting-in-css-part-22/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-text-formatting-in-css-part-22</link>
		<comments>http://blog.europcsolutions.com/css-text-formatting-in-css-part-22/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 21:02:26 +0000</pubDate>
		<dc:creator>Daniel Lucas</dc:creator>
				<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[XHTML & CSS Lessons]]></category>
		<category><![CDATA[background colours]]></category>
		<category><![CDATA[background images]]></category>
		<category><![CDATA[bold text]]></category>
		<category><![CDATA[font colours]]></category>
		<category><![CDATA[font styles]]></category>
		<category><![CDATA[html css]]></category>
		<category><![CDATA[html lessons]]></category>
		<category><![CDATA[html tutorials]]></category>
		<category><![CDATA[italic text]]></category>
		<category><![CDATA[style effects]]></category>
		<category><![CDATA[text decoration]]></category>
		<category><![CDATA[upppercase]]></category>

		<guid isPermaLink="false">http://localhost/europcsolutions/europcblog/?p=136</guid>
		<description><![CDATA[This is the second part of the text formatting tutorial. In this chapter we'll see how to style text, align text, and then add background colours &#038; images !]]></description>
			<content:encoded><![CDATA[<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/text-formatting.png" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/text-formatting.png" alt="text formatting CSS   Text Formatting In CSS (Part 2/2)" title="CSS - Text Formatting In CSS (Part 2)" width="580" height="200" class="alignnone size-full wp-image-179" /></a></p>
<p>Welcome to the second part of the chapter dedicated to text formatting <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> <br />
CSS still holds plenty of secrets for you, so don&#8217;t wait any longer, let&#8217;s go <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h2>Style Effects</h2>
<p>In CSS there is a surprising amount of properties which allow us to give a bit more style to our web pages (and I don&#8217;t think anyone will refuse that <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" />  )<br />
These styles go from making your text bold, italic, to underlining your text and putting all the letters in capitals, to making your text flash <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h3>Putting Text In Italic</h3>
<p>Stop, stop there ! I thought &lt;em&gt; let us make text italic ?!</p>
<p>I never said that <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> <br />
I never said that &lt;em&gt; was made to make the text italic, just as I never said that &lt;strong&gt; was to make the text become bold. That&#8217;s just what they do by default.</p>
<p>&lt;em&gt; is made to help words stand out from the rest of a paragraph. It means that the words it is surrounding are a bit important.<br />
To represent this importance most navigators make the text go italic.</p>
<p>We can make text become italic in CSS, so it can be useful just for <strong>presentation purposes</strong>. Because, I remind you, CSS is made to sort out the presentation of web sites.</p>
<p>To put text in italic in CSS we use <em>font-style</em> which can take 3 values :</p>
<ul>
<li><span class="red-text">italic</span> : Makes the text italic</li>
<li><span class="red-text">oblique</span> : Makes the text italic. What, this does as well ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" />  Errmmm, I can&#8217;t tell you any more than that. I&#8217;ve used both of them and they both seem to do the same thing. Just use the one you want <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </li>
<li>
<p><span class="red-text">normal</span> : The text will be normal (by default). It allows you to take any text effects away (such as italic). For example, if you don&#8217;t want your text in &lt;em&gt; tags to be italic any longer, you should write :</p>
<pre class="brush: css; title: ; notranslate">
em {
     font-style: normal;
}
</pre>
</li>
</ul>
<p>In the following example, I&#8217;ll use <em>font-style</em> to put my &lt;h2&gt; titles in italic :</p>
<pre class="brush: css; title: ; notranslate">
h1 {
     text-align: center;
     font-family: Arial, &quot;Times New Roman&quot;, Verdana, serif;
}

h2 {
     font-style: italic; /* The h2 titles will be italic ! */
     text-indent: 30px; /* Move our titles across to the right a bit */
     font-family: Arial, &quot;Times New Roman&quot;, &quot;Arial Black&quot;, Verdana, serif;
}
</pre>
<p>Well, it&#8217;s easy to use. We won&#8217;t stay stuck on that for too long <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h3>Making Text Bold</h3>
<p>And if we carried on to making text bold ?<br />
Here, the same with &lt;strong&gt;, I&#8217;m not going to re-give the same speech as earlier. Making text bold in CSS lets us have for example bold titles, bold paragraphs etc&#8230;It&#8217;s up to you.</p>
<p>The CSS property that allows us to make text become bold is font-weight, which takes the following values :</p>
<ul>
<li><span class="red-text">bold</span> : the text will be bold</li>
<li><span class="red-text">normal</span> : the text will be written normally (by default)</li>
<li><span class="red-text">lighter</span> : the text will be thinner</li>
</ul>
<p>Here&#8217;s an example to make paragraphs go bold :</p>
<pre class="brush: css; title: ; notranslate">
     font-weight: bold;
</pre>
<h3>Capitals In CSS</h3>
<p>CSS allows us to apply some interesting effects on text, by automatically putting it into capitals.<br />
We&#8217;re going to see 2 CSS properties that allow us to work with capitals.</p>
<p>Let&#8217;s start with the property <em>font-variant</em>, which only takes 2 values :</p>
<ul>
<li><span class="red-text">small-caps</span> : the text will be written in small capitals</li>
<li><span class="red-text">normal</span> : the text will be written normally (by default)</li>
</ul>
<p>Example :</p>
<pre class="brush: css; title: ; notranslate">
p {
     font-variant: small-caps;
}
</pre>
<p>You write your paragraphs normally (as usual), and just leave the CSS to automatically transform all your letters into small capitals. Isn&#8217;t that great <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>But wait, there&#8217;s a second CSS property that works with capitals as well : <em>text-transform</em>. It can take several values :</p>
<ul>
<li><span class="red-text">uppercase</span> : all the text will be written in capitals</li>
<li><span class="red-text">lowercase</span> : all the text will be in small letters</li>
<li><span class="red-text">capitalize</span> : the first letter of each word will be a capital</li>
<li><span class="red-text">none</span> : no transformation (by default)</li>
</ul>
<p>Go on then, seeing as I haven&#8217;t done it for a while I&#8217;ll give you a HTML code to work with <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> <br />
Look in particular at how I use classes</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;I am very angry&lt;/h1&gt;

&lt;p&gt;...but I will try to stay calm. At least, if I can, I'm making no promises...&lt;br /&gt;
&lt;span class=&quot;shout&quot;&gt;ahhh !!! no this time I can't ! Who put mayonnaise on my chips !??&lt;br /&gt;disgusting !&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;whisper&quot;&gt;THIS IS A PARAGRAPH THAT I'M WHISPERING, ALTHOUGH IT'S WRITTEN IN UPPERCASE IN THE XHTML CODE&lt;/p&gt;
</pre>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
h1 {
     text-align: center;
     font-family: Arial, &quot;Times New Roman&quot;, Verdana, serif;
     text-transform: capitalize; /* The first letter of each word will be a capital */
}

.shout {
     text-transform: uppercase; /* I want to be heard, so everything is in capitals */
}

.whisper {
     text-transform: lowercase;
     font-style: italic; /* The whispered text will be in small, italic letters */
}
</pre>
<p>As you can see, the property <em>text-transform</em> is very useful for changing the appearance of text in the wink of an eye !</p>
<p>That shows that CSS can do more than just align text and change its font. It can also act <strong>directly</strong> upon text to modify its case (uppercase / lowercase).</p>
<h3>A Bit Of Decoration ?</h3>
<p>This CSS property has a good name : <em>text-decoration</em><br />
It allows us, among other things, to underline text. Here are the different values it can take :</p>
<ul>
<li><span class="red-text">underline</span> : underlines the text</li>
<li><span class="red-text">line-through</span> : crosses out your text (puts a line through the middle)</li>
<li><span class="red-text">overline</span> : puts a line over the top of the text</li>
<li><span class="red-text">blink</span> : makes text blink. Be careful, this property doesn&#8217;t work on Internet Explorer. However it does work well on every other browser, including Mozilla Firefox.</li>
<li><span class="red-text">none</span> : normal (by default)</li>
</ul>
<p>This CSS will allow us to test the <em>text-decoration</em> effects :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
h1 {
     text-align: center;
     font-family: &quot;Arial Black&quot;, Arial, &quot;Times New Roman&quot;, serif;
     text-decoration: blink; /* The title blinks (won't work in Internet Explorer) */
}

.under {
     text-decoration: underline;
}

.cross-out {
     text-decoration: line-through;
}

.over {
     text-decoration: overline;
}
</pre>
<p>And here&#8217;s the XHTML code to go with it :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;Do not miss this !&lt;/h1&gt;

&lt;p&gt;The CSS property &lt;em&gt;text-decoration&lt;/em&gt; lets you decorate your text :&lt;br /&gt;
&lt;span class=&quot;under&quot;&gt;by underlining it&lt;/span&gt;. . .&lt;br /&gt;
&lt;span class=&quot;cross-out&quot;&gt;by putting a line through it&lt;/span&gt;. . .&lt;br /&gt;
. . .or &lt;span class=&quot;over&quot;&gt;by putting a line over it&lt;/span&gt;.&lt;/p&gt;
</pre>
<p>Don&#8217;t forget that the power of CSS is the fact that it can mix styles. I&#8217;ve created a class <q>under</q> which only underlines in the example, but in reality we often mix styles like for example a class <q>important</q> which underlines text, makes it bold, and puts it in uppercase <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h2>Colours</h2>
<p>Now let&#8217;s carry on to the vast subject of <span class="orange-text">colo</span><span class="blue-text">urs</span></p>
<p class="blue-text">What do you mean, vast ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_surprised.gif' alt="icon surprised CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>There are several possibilities for indicating a colour, as was the case with text size.<br />
Here we&#8217;re going to see all the possibilities that CSS offers for choosing colours.</p>
<p>The first thing to know : the property that lets you change the colour of your text is <em>color</em> (easy to remember <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" />  ), you even used it quickly in the introduction to CSS.</p>
<h3>Indicating The Name Of The Colour</h3>
<p>The easiest and most practical way to choose a colour is by writing its name in English.<br />
The only default with this method is that there are only 16 <q>standard</q> colours. Some other colours exist as well but as they don&#8217;t work on every browser I won&#8217;t be showing them to you.</p>
<p>Here are the 16 colours you can use by simply writing their names :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/colour-chart.jpg" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/colour-chart.jpg" alt="colour chart CSS   Text Formatting In CSS (Part 2/2)" title="Colour Chart With Standard Colours" width="173" height="463" class="alignnone size-full wp-image-413" /></a></p>
<p>You can learn them all by heart if you want, it&#8217;s not that hard <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>Here&#8217;s the CSS :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
h1 {
     text-align: center;
     font-family: Arial, &quot;Arial Black&quot;, &quot;Times New Roman&quot;, serif;
     text-decoration: underline;
     color: green; /* The title in green (why not ?) */
}

p {
     text-indent: 20px;
     color: blue; /* Paragraphs in blue */
}

strong { /* And the important words in flashing red ! */
     color: red;
     text-decoration: blink;
}
</pre>
<p>. . . and the XHTML page to go with it :</p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;In every colour&lt;/h1&gt;

&lt;p&gt;Hello and welcome to this page that's full of colours ! I am using &lt;strong&gt;standard colour names&lt;/strong&gt; in my CSS to make the page look nicer.&lt;/p&gt;

&lt;p&gt;With the attribute &lt;em&gt;color&lt;/em&gt; in CSS I managed to &lt;strong&gt;automatically&lt;/strong&gt; convert all my important words (in a &quot;strong&quot; tag) into flashing red text ! That way nobody should miss them :0&lt;/p&gt;
</pre>
<p>The important words in red flash&#8230;well yeah, you had to think of it ! Come on, you need a bit of imagination <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h3>Hexadecimal Notation</h3>
<p>When you know that most of our screens can show 16 million colours, 16 is a bit limited.<br />
On the other hand, if somebody had to give names to 16 million colours&#8230;</p>
<p>Luckily, in CSS there are several ways to choose colours. The first one (and my personal favourite) I&#8217;m going to show you is the hexadecimal notation.<br />
I won&#8217;t spend that long explaining it because it&#8217;s not very easy to explain and it&#8217;s only through practice that you&#8217;ll get used to it.</p>
<p>A name of a colour in hexadecimal looks like this : #FF5A28. To make it simpler it&#8217;s a combination of letters and numbers which indicate a colour. It must always start with a dies (<span class="red-text">#</span>) followed by six letters or numbers going from 0 to 9 and A to F (imagine A to F carrying on the numbers, they&#8217;re 10 to 15).<br />
These letters and numbers go together in pairs. The first two indicate the quantity of red, the next two the quantity of green,  and the last two are the quantity of blue. By mixing these quantities (which are the components of <span class="orange-text">Red</span>-<span class="green-text">Green</span>-<span class="blue-text">Blue</span> in the colour) we can get the colour we want.</p>
<p>So, using this method, #000000 corresponds to black and #FFFFFF is white. But now, don&#8217;t ask me what the combination is to produce sunset orange. I couldn&#8217;t tell you. In fact I could guess. #FF0000 is red so we need to add some green to make it orange. A rough guess would be about #FF8000.</p>
<p class="green-text">Certain graphics programs, such as Photoshop for example, do give you hexadecimal notations for colours. It is therefore easier to find your wanted colour than trying to guess it through trial and error.</p>
<p>Here is a quick example for making your text white :</p>
<pre class="brush: css; title: ; notranslate">
p {
     color: #FFFFFF;
}
</pre>
<h3>Using RGB</h3>
<p>What does RBG mean? It is an abbreviation of Red-Green-Blue. Like with the hexadecimal notation, you define the quantity of Red, Green &#038; Blue you want to make up a colour.</p>
<p class="blue-text">What ?! Yet another twisted story of red, green &#038; blue quantities ?</p>
<p>Yes, but this time you can find your colour with a simple drawing program like Paint. Here are the steps to take :</p>
<ol>
<li>Launch Paint from the start menu</li>
<li>
<p>Click on Edit colors (on windows 7), on earlier versions of Windows, go to <q>Colors</q>=><q>Edit colors</q> :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/change-colour1.png" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/change-colour1-560x402.png" alt="change colour1 560x402 CSS   Text Formatting In CSS (Part 2/2)" title="Changing Colour In Paint" width="560" height="402" class="alignnone size-large wp-image-417" /></a></p>
</li>
<li>Move the cursor in the colour palette to choose the colour you want</li>
<li>
<p>Let&#8217;s suppose that I get the mad idea to put my titles in Barbie pink (we&#8217;re only supposing). I just select the colour in the palette like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/choose-colour.png" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/choose-colour.png" alt="choose colour CSS   Text Formatting In CSS (Part 2/2)" title="Colour Values In Paint" width="463" height="337" class="alignnone size-full wp-image-151" /></a></p>
</li>
<li>
<p>Get the quantities of Red, Green &#038; Blue in the colour from the bottom right of the window (here 242-83-231). Copy these values in that order into the CSS, like this :</p>
<pre class="brush: css; title: ; notranslate">
h1 {
     text-align: center;
     color: rgb(242, 83, 231);
}
</pre>
<p>And that&#8217;s all there is to it <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>As you may have noticed in the example, to use the RGB method, you need to write <em>rgb(Red, Green, Blue)</em>, replacing <q>Red, Green, Blue</q> with the corresponding numbers. For your information, so that you know the scale and can make a quick guess of the needed quantities, the numbers go from 0 to 255. So if one day you write a red quantity of 327, there&#8217;s a problem <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
</li>
</ol>
<h3>Added Bonus</h3>
<p>As I have already said, my favourite method is using hexadecimal values. But that&#8217;s just a preference and you can use whichever method you wish <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> <br />
For those of you who don&#8217;t have an advanced graphics editor such as photoshop, I have found a nice, simple to use program, that allows you to find out the codes of colours. Just open the colour palette in Paint, or if you&#8217;ve found a colour you like in a picture, keep it handy, then open <a href="http://www.europcsolutions.com/dls/ColorPix.exe" title="Download ColorPix">ColorPix</a> and put the cursor over the colour you like. Then just press any key on your keyboard and you&#8217;ll get the hexadecimal &#038; RGB values of the colour <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" />  It looks like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/colorpix.jpg" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/colorpix.jpg" alt="colorpix CSS   Text Formatting In CSS (Part 2/2)" title="Finding Colours With ColorPix" width="343" height="311" class="alignnone size-full wp-image-154" /></a></p>
<p>Well, if you think it could be any help you can <a href="http://www.europcsolutions.com/dls/ColorPix.exe" title="download ColorPix">download ColorPix here :</a></p>
<p class="centred-image">
<a href="http://www.europcsolutions.com/dls/ColorPix.exe" class="download" title="Download ColorPix">Download ColorPix</a><br />
<a href="http://www.europcsolutions.com/dls/ColorPix.exe" title="Download ColorPix">Download ColorPix Here</a>
</p>
<p>Well, there you are, I thought the colour choosing capacities of this program might be useful <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h2>Backgrounds</h2>
<p>Differently to what you might think, background doesn&#8217;t necessarily mean the background of a whole web site. You can also apply background uniquely to titles, or paragraphs, or even certain words in a paragraph.</p>
<p>Firstly you need to know that there are 2 types of background :</p>
<ul>
<li>Backgrounds with solid colours</li>
<li>Backgrounds with images</li>
</ul>
<p>We&#8217;ll start with solid colour backgrounds, and then we&#8217;ll see how to use images in the background.</p>
<h3>Background Colours</h3>
<p>To indicate a background colour we use the CSS property <em>background-color</em>. This is used in exactly the same way as <em>color</em>, meaning that you just give the name of your colour in English, hexadecimal, or RGB.</p>
<p>To give a background colour to your whole web page you need to work on the &lt;body&gt; tag. Yes, &lt;body&gt; is the whole web page, so if we change its colour the whole page&#8217;s background will change.</p>
<p>Look at this CSS code :</p>
<pre class="brush: css; title: ; notranslate">
body { /* we're working on the body tag, which is the WHOLE page */
     background-color: black; /* The background of the page will be black */
     color: white; /* The text will be white */
}
</pre>
<p>Try it out to see !</p>
<p class="blue-text">Hey, but you put the white text in &lt;body&gt;, and now all the &lt;p&gt; paragraphs and &lt;h1&gt; titles have this colour. Why is that ?</p>
<p>I was hoping this question would come along so that I could talk about it. This is called <strong>heritage</strong>. No no, don&#8217;t worry; it doesn&#8217;t have anything to do with dead people <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>In CSS, if you apply a style to a tag, all the tags inside it use the same styles.</p>
<p>Really, it&#8217;s quite simple to understand. The &lt;body&gt; tag, as you know, contains all the other elements of your page, including your &lt;p&gt; paragraphs and &lt;h1&gt; titles.</p>
<p>Therefore if I apply a black background and white text to &lt;body&gt;, all my titles and text will also have a black background and white text. This is what is called <q>heritage</q> : we say that the tags inside a tag <q>inherit</q> its properties.</p>
<p class="blue-text">Are you saying that ALL the text of my web site will be written in white ?</p>
<p>No, not necessarily. If you then say for example that you want your titles to be red, this style will have priority and your titles will become red. However, if you don&#8217;t put anything, as we did before, your titles will be white.<br />
This doesn&#8217;t only work with colours. All the CSS properties are inherited : you can for example put a text size of <q>1.3em</q> in &lt;body&gt; and all your titles and text will be this size.</p>
<p>Here&#8217;s an example, to show you how to <q>cancel</q> heritage so that our titles won&#8217;t be written in white.  I&#8217;ve also used the opportunity to create a class <q>highlight</q> which puts the text on a yellow background, to give a highlighting effect.</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
body {
     background-color: black;
     color: white;  /* All the tags inside body will have white text and a black background */
}

h1 {
     color: red;  /* . . .apart from if I ask them to do something else */
}

.highlight {  /* A style to let us highlight some words in the text */
     background-color: yellow;
     color: black;  /* the highlighted text will be black */
}
</pre>
<p>&#8230;and this time I&#8217;ve decided to give you the complete XHTML code to go with it just so you don&#8217;t forget everything we learned before <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p><strong>Code : HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
     &lt;title&gt;Example Of How To Use An External CSS File&lt;/title&gt;
     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
     &lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; type=&quot;text/css&quot; title=&quot;Style&quot; href=&quot;test.css&quot; /&gt;
&lt;/head&gt;

&lt;body&gt;
     &lt;h1&gt;Who turned off the light ?&lt;/h1&gt;

     &lt;p&gt;Brr, it's all black on this site, it's a bit of a &lt;span class=&quot;highlight&quot;&gt;worrying&lt;/span&gt; atmosphere don't you think ?&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>As you will see when you test it, we haven&#8217;t indicated a particular colour for the &lt;p&gt; paragraphs so they&#8217;re still white. However the title isn&#8217;t white because we wanted it to be red.<br />
The class <q>highlight</q> shows you with no problems how to give a background to certain words in a text. And the effect is kind of nice, wouldn&#8217;t you say ? <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<h3>Background Images</h3>
<p>Just like with background colours, background images don&#8217;t have to be applied to the whole page, we can also give a background to paragraphs, quotations, titles etc&#8230;</p>
<p>The property that lets us use background images is <em>background-image</em>. As a value we must put <em>url(<q>image-name.png</q>)</em>. For example :<br />
background-image: url(&quot;images/background.png&quot;);</p>
<p>Of course, you&#8217;re background doesn&#8217;t have to be a PNG. It can also be a JPEG or GIF.<br />
The address of the image can be absolute (http://&#8230;) or related (images/image.jpg).</p>
<p class="orange-text">Be careful when you&#8217;re giving a related path in CSS ! The address of the image must be given in relation to the .css file and not the .html file. So, if your site has 2 folders, <q>css</q> and <q>images</q>, you need to write : <q>../images/image.jpg</q> to get the image. If you don&#8217;t give the correct path, your image won&#8217;t be shown.</p>
<p>I&#8217;ll give you a full example to show you :</p>
<p>In your web sites folder set up your folders like this :</p>
<p class="centred-image"><a href="http://blog.europcsolutions.com/wp-content/uploads/2011/02/folders1.png" rel="shadowbox[sbpost-136];player=img;"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/folders1-560x305.png" alt="folders1 560x305 CSS   Text Formatting In CSS (Part 2/2)" title="Folder Setup Inside Website" width="560" height="305" class="alignnone size-large wp-image-420" /></a></p>
<p>You can get my image, snow.png from <a href="http://www.europcsolutions.com/dls/snow.png" rel="shadowbox[sbpost-136];player=img;" title="get the image">here</a></p>
<p><strong>Code : HTML :</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;h1&gt;CSS Testing Site&lt;/h1&gt;

&lt;blockquote&gt;
     &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lobortis. Aliquam scelerisque. Nullam facilisis diam et sapien laoreet facilisis. Phasellus hendrerit massa sit amet ipsum ullamcorper laoreet. Proin rutrum enim eu libero. Nulla risus est, porta eu, tristique at, ultrices ac, eros. Donec eget justo. Nam at metus vel tortor eleifend ultricies. Pellentesque quis tortor vitae leo lacinia auctor. Ut nec lacus et diam tincidunt blandit. Mauris vehicula orci et velit. Vivamus auctor rutrum leo. Donec magna erat, vulputate non, ornare vitae, dignissim et, leo. Curabitur ac massa. Donec tempor metus eget felis.&lt;/p&gt;

     &lt;p&gt;Phasellus quis nulla eu sem porttitor eleifend. Morbi pharetra. Nulla condimentum est eu magna. Duis accumsan justo. Aliquam a dolor at dolor gravida pretium. Nunc varius quam quis nulla. Sed eu nulla. Phasellus quis magna eu wisi lacinia euismod. Nam augue ipsum, iaculis in, aliquet sit amet, bibendum a, massa. Suspendisse placerat dui eget erat. Nam mi. Nullam odio tortor, scelerisque eget, aliquet ut, volutpat vitae, dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed pellentesque felis vitae enim. Fusce leo. Vestibulum porttitor elementum augue. Integer semper tristique velit.&lt;/p&gt;

     &lt;p&gt;Nulla libero. Ut molestie, mauris id bibendum bibendum, libero neque venenatis sapien, sed aliquet augue ligula nec tellus. Sed urna nunc, aliquet quis, condimentum a, molestie non, risus. Cras ut ante in nulla blandit aliquam. Curabitur consectetuer quam sollicitudin nunc. Ut aliquet velit tempor erat. Vivamus iaculis, wisi tincidunt ullamcorper aliquet, nibh risus aliquam risus, at convallis tortor mauris eget mauris. Curabitur consequat. Maecenas auctor venenatis lacus. Donec pellentesque.&lt;/p&gt;

     &lt;p&gt;Morbi elit. Suspendisse sapien dolor, dapibus at, semper a, aliquam ac, neque. Sed eleifend mauris in elit. Aliquam blandit posuere purus. Vivamus sed dui. Maecenas ultricies, libero sed sagittis pellentesque, lectus nisl convallis lorem, vitae interdum velit ipsum vitae mauris. Nullam quis enim vitae urna fringilla lobortis. In accumsan, odio ut cursus molestie, nunc nibh accumsan velit, id dignissim nibh sem vitae turpis. Cras congue cursus orci. Proin laoreet egestas dolor. Vestibulum arcu sem, molestie sed, fermentum id, dapibus vitae, orci. Vivamus consectetuer ullamcorper enim. Curabitur varius massa ut lectus. Vivamus consectetuer aliquet tellus.&lt;/p&gt;

     &lt;p&gt;Suspendisse quis sapien at turpis luctus tincidunt. Pellentesque eleifend pede. Morbi fringilla, wisi in gravida pulvinar, ligula quam nonummy odio, vel interdum mi wisi sollicitudin erat. Ut elit dui, hendrerit at, laoreet sed, posuere commodo, dui. Nam lacus. Vivamus rutrum felis eu libero. Fusce ac augue non felis vestibulum sollicitudin. Ut varius, diam in aliquam iaculis, est nisl tincidunt magna, non commodo sapien felis mollis augue. Donec ut massa. Donec semper est nec nulla. Sed aliquet orci ac sapien. Proin ut wisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;&lt;/p&gt;

     &lt;p&gt;Aliquam porta enim eu sapien. Suspendisse ac lectus. Nulla sollicitudin nunc vitae mauris. Pellentesque molestie, nisl ac aliquam volutpat, massa sem luctus augue, id fringilla urna risus eu neque. Morbi pretium, felis a congue accumsan, tortor quam blandit mauris, vitae congue erat justo vitae mi. Aliquam nisl massa, facilisis ut, sagittis nec, tristique at, mauris. Suspendisse potenti. Suspendisse lorem pede, pretium ut, gravida ac, suscipit quis, augue. Etiam nonummy ligula eu nisl. Pellentesque id velit at mi ullamcorper adipiscing.&lt;/p&gt;

    &lt;p&gt;In suscipit lorem id nibh. Integer ligula tellus, porta sit amet, pretium ac, dignissim sed, nunc. Duis diam. Nulla tortor pede, porttitor quis, iaculis sed, tincidunt at, nibh. Vivamus nibh massa, rutrum vel, feugiat eu, suscipit nec, orci. Fusce accumsan arcu nec pede. Integer dui lacus, tempus ac, vestibulum eget, ultrices eget, elit. Pellentesque odio. Nunc et leo. Etiam consequat augue ac sem. Aliquam erat volutpat. Duis nec libero tincidunt justo lacinia feugiat. In hac habitasse platea dictumst. Quisque ornare laoreet magna.&lt;/p&gt;

     &lt;p&gt;Pellentesque dapibus, ligula ut vulputate pellentesque, dui magna lacinia mauris, aliquam tempus elit eros a diam. Nullam mi sem, tincidunt et, auctor et, ultrices et, augue. Vivamus blandit dapibus metus. Etiam lacinia sapien et urna. Sed molestie, eros vel imperdiet sodales, lorem velit consequat magna, ornare gravida ligula risus at nunc. Nulla lacus turpis, viverra a, tincidunt eu, tempor a, odio. Nam urna sapien, dignissim nec, sagittis id, tristique sed, est. Nam nisl elit, sagittis eget, pellentesque a, tristique vel, massa. Sed cursus sagittis pede. Aliquam erat volutpat.&lt;/p&gt;

     &lt;p&gt;IAliquam erat volutpat. Morbi vulputate sagittis nulla. Vivamus porta, nisl quis volutpat ornare, felis mauris pulvinar mauris, at congue dui neque nec elit. In in leo. Ut vitae erat. In hac habitasse platea dictumst. Maecenas consequat augue vitae erat. Mauris vehicula varius nulla. Aenean sit amet est. Nam purus ante, rutrum aliquet, facilisis sit amet, consequat ut, orci. Aliquam ac dui eu lectus blandit cursus. Pellentesque sapien wisi, pharetra ut, dictum ut, tincidunt suscipit, dolor. Praesent convallis turpis nec quam. Nullam orci magna, mollis non, rhoncus tempus, pretium eu, neque. Praesent non velit eget metus fermentum sodales. Donec mi ipsum, placerat et, suscipit id, facilisis ac, neque. Nullam semper enim non augue.&lt;/p&gt;

     &lt;p&gt;Donec non turpis eu sem accumsan mattis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam at nisl sit amet felis luctus luctus. Integer sollicitudin ullamcorper dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Mauris fermentum facilisis turpis. Pellentesque orci justo, rhoncus in, convallis at, consectetuer at, magna. Etiam ipsum odio, eleifend nec, iaculis quis, fringilla ac, lacus. Vivamus sit amet erat sed nisl convallis molestie. Nulla quam orci, vulputate at, vehicula sit amet, ullamcorper sed, lorem. Curabitur molestie varius tellus. Morbi arcu nibh, aliquam ut, facilisis molestie, scelerisque vel, enim. Maecenas sit amet nisl sed arcu molestie hendrerit. Etiam rutrum, neque sit amet volutpat lacinia, leo lacus cursus metus, vitae posuere nulla est et mauris. Curabitur tempus tempor felis. Cras interdum tristique dui. Curabitur pretium.&lt;/p&gt;

     &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam lobortis. Aliquam scelerisque. Nullam facilisis diam et sapien laoreet facilisis. Phasellus hendrerit massa sit amet ipsum ullamcorper laoreet. Proin rutrum enim eu libero. Nulla risus est, porta eu, tristique at, ultrices ac, eros. Donec eget justo. Nam at metus vel tortor eleifend ultricies. Pellentesque quis tortor vitae leo lacinia auctor. Ut nec lacus et diam tincidunt blandit. Mauris vehicula orci et velit. Vivamus auctor rutrum leo. Donec magna erat, vulputate non, ornare vitae, dignissim et, leo. Curabitur ac massa. Donec tempor metus eget felis.&lt;/p&gt;

     &lt;p&gt;Phasellus quis nulla eu sem porttitor eleifend. Morbi pharetra. Nulla condimentum est eu magna. Duis accumsan justo. Aliquam a dolor at dolor gravida pretium. Nunc varius quam quis nulla. Sed eu nulla. Phasellus quis magna eu wisi lacinia euismod. Nam augue ipsum, iaculis in, aliquet sit amet, bibendum a, massa. Suspendisse placerat dui eget erat. Nam mi. Nullam odio tortor, scelerisque eget, aliquet ut, volutpat vitae, dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed pellentesque felis vitae enim. Fusce leo. Vestibulum porttitor elementum augue. Integer semper tristique velit.&lt;/p&gt;

     &lt;p&gt;Nulla libero. Ut molestie, mauris id bibendum bibendum, libero neque venenatis sapien, sed aliquet augue ligula nec tellus. Sed urna nunc, aliquet quis, condimentum a, molestie non, risus. Cras ut ante in nulla blandit aliquam. Curabitur consectetuer quam sollicitudin nunc. Ut aliquet velit tempor erat. Vivamus iaculis, wisi tincidunt ullamcorper aliquet, nibh risus aliquam risus, at convallis tortor mauris eget mauris. Curabitur consequat. Maecenas auctor venenatis lacus. Donec pellentesque.&lt;/p&gt;

     &lt;p&gt;Morbi elit. Suspendisse sapien dolor, dapibus at, semper a, aliquam ac, neque. Sed eleifend mauris in elit. Aliquam blandit posuere purus. Vivamus sed dui. Maecenas ultricies, libero sed sagittis pellentesque, lectus nisl convallis lorem, vitae interdum velit ipsum vitae mauris. Nullam quis enim vitae urna fringilla lobortis. In accumsan, odio ut cursus molestie, nunc nibh accumsan velit, id dignissim nibh sem vitae turpis. Cras congue cursus orci. Proin laoreet egestas dolor. Vestibulum arcu sem, molestie sed, fermentum id, dapibus vitae, orci. Vivamus consectetuer ullamcorper enim. Curabitur varius massa ut lectus. Vivamus consectetuer aliquet tellus.&lt;/p&gt;

     &lt;p&gt;Suspendisse quis sapien at turpis luctus tincidunt. Pellentesque eleifend pede. Morbi fringilla, wisi in gravida pulvinar, ligula quam nonummy odio, vel interdum mi wisi sollicitudin erat. Ut elit dui, hendrerit at, laoreet sed, posuere commodo, dui. Nam lacus. Vivamus rutrum felis eu libero. Fusce ac augue non felis vestibulum sollicitudin. Ut varius, diam in aliquam iaculis, est nisl tincidunt magna, non commodo sapien felis mollis augue. Donec ut massa. Donec semper est nec nulla. Sed aliquet orci ac sapien. Proin ut wisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;&lt;/p&gt;

     &lt;p&gt;Aliquam porta enim eu sapien. Suspendisse ac lectus. Nulla sollicitudin nunc vitae mauris. Pellentesque molestie, nisl ac aliquam volutpat, massa sem luctus augue, id fringilla urna risus eu neque. Morbi pretium, felis a congue accumsan, tortor quam blandit mauris, vitae congue erat justo vitae mi. Aliquam nisl massa, facilisis ut, sagittis nec, tristique at, mauris. Suspendisse potenti. Suspendisse lorem pede, pretium ut, gravida ac, suscipit quis, augue. Etiam nonummy ligula eu nisl. Pellentesque id velit at mi ullamcorper adipiscing.&lt;/p&gt;
&lt;/blockquote&gt;
</pre>
<p>Don&#8217;t forget to put <q>css/test.css</q> in the link to your style sheet !<br />
If we want to put a background image on the whole page, we use the &lt;body&gt; tag (again) :</p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
body {
     background-image: url(&quot;../images/snow.png&quot;);
}

h1 {
     font-style: italic;
     font-family: &quot;Arial Black&quot;, Arial, Verdana, serif;
     text-align: center;
}

blockquote p {  /* All the paragraphs inside a blockquote */
     text-align: justify;
     text-indent: 25px;
}
</pre>
<p>Try it out; you&#8217;ll notice that the background image is repeated over the whole page. There is a property that allows us to <q>fix</q> the background, so that it doesn&#8217;t move with the text. The given effect is, I find, quite interesting. The property is called <em>background-attachment</em> and can take 2 values :</p>
<ul>
<li><span class="red-text">fixed</span> : the image won&#8217;t move</li>
<li><span class="red-text">scroll</span> : the image moves with the text (by default)</li>
</ul>
<p>Using the same CSS file as before, but with the addition of the <em>background-attachment</em> we get this :</p>
<pre class="brush: css; title: ; notranslate">
body {
     background-image: url(&quot;../images/snow.png&quot;);
     background-attachment: fixed; /* the background won't move */
}

h1 {
     font-style: italic;
     font-family: &quot;Arial Black&quot;, Arial, Verdana, serif;
     text-align: center;
}

blockquote p {  /* All the paragraphs inside a blockquote */
     text-align: justify;
     text-indent: 25px;
}
</pre>
<p>Try scrolling now. As you&#8217;ll see, the background doesn&#8217;t move anymore !</p>
<p>There are 2 more properties I would like to show you for the background image.<br />
The first one is to control the <strong>repetition</strong> of the background. This property is called <em>background-repeat</em> and takes the following values :</p>
<ul>
<li><span class="red-text">no-repeat</span> : the background isn&#8217;t repeated. There is only one copy of the image on the page.</li>
<li><span class="red-text">repeat-x</span> : the background is repeated on the first line, horizontally.</li>
<li><span class="red-text">repeat-y</span> : the background is repeated in the first column, vertically.</li>
<li><span class="red-text">repeat</span> : the background is repeated (by default).</li>
</ul>
<p>Let&#8217;s use the same HTML as before, but this time we&#8217;ll apply a gradient that repeats vertically.</p>
<p>Here&#8217;s a gradient I created in Photoshop. Right click->save as to copy it if you want :</p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/gradient.png" alt="gradient CSS   Text Formatting In CSS (Part 2/2)" title="Gradient" width="209" height="45" class="alignnone size-full wp-image-160" /></p>
<p>And here&#8217;s the CSS code to use it :</p>
<pre class="brush: css; title: ; notranslate">
body {
     background-image: url(&quot;../images/gradient.png&quot;);
     background-repeat: repeat-y;  /* The image will only repeat vertically */
}

h1 {
     font-style: italic;
     font-family: &lt;q&gt;Arial Black&lt;/q&gt;, Arial, Verdana, serif;
     text-align: center;
}

blockquote p {  /* All the paragraphs inside a blockquote */
     text-align: justify;
     text-indent: 25px;
}
</pre>
<p>As you can see the gradient repeats itself down the left side of the screen. The last property I want to show you (that way we&#8217;ll have seen them all for backgrounds) concerns the position of your background image.<br />
You can say where you want your image to be with <em>background-position</em>. This property is only of any use if you put &quot;background-repeat: no-repeat;&quot;</p>
<p>You need to give your background 2 values in pixels to indicate where you want it to be in relation to the top left corner of the screen. (or of the paragraph if it&#8217;s the background of a paragraph&#8230;). So, if you write :<br />
background-position : 30px, 50px;<br />
&#8230;your background will be placed 30 pixels from the left and 50 pixels from the top. There are also values that you can give in English :</p>
<ul>
<li><span class="red-text">top</span> : at the top</li>
<li><span class="red-text">bottom</span> : at the bottom</li>
<li><span class="red-text">left</span> : to the left</li>
<li><span class="red-text">center</span> : in the middle</li>
<li><span class="red-text">right</span> : to the right</li>
</ul>
<p>You can also combine these words. So, to put your picture in the top right, you put : <q>background-position: top right;</q></p>
<p>Right, in this last example I&#8217;ll use all the background properties we have learnt <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>Here&#8217;s the background image :</p>
<p class="centred-image"><img src="http://blog.europcsolutions.com/wp-content/uploads/2011/02/skier.gif" alt="skier CSS   Text Formatting In CSS (Part 2/2)" title="Skier" width="227" height="173" class="alignnone size-full wp-image-162" /></p>
<p><strong>Code : CSS</strong></p>
<pre class="brush: css; title: ; notranslate">
body {
     background-image: url(&quot;../images/skier.gif&quot;);  /* The background image is &lt;q&gt;skier.gif&lt;/q&gt; */
     background-repeat: no-repeat;  /* The image will not be repeated */
     background-position: top right;  /* The background is in the top right of the screen */
     background-attachment: fixed;  /* The background won't move */
}

h1 {
     font-style: italic;
     font-family: &quot;Arial Black&quot;, Arial, Verdana, serif;
     text-align: center;
}

blockquote p {  /* All the paragraphs inside a blockquote */
     text-align: justify;
     text-indent: 25px;
}
</pre>
<p>If you use a lot of properties on the background (like in this example), you can use a kind of <q>mega property</q> called <em>background</em> which takes several combined values of background-image, background-repeat, background-attachment &#038; background-position.<br />
This is the first <q>mega-property</q> that I&#8217;m showing you, there will be more. For all the <q>mega-properties</q> such as <em>background</em> you should know that :</p>
<ul>
<li>
<p>The order of the values doesn&#8217;t matter. You can combine the values in any order :<br />
background: url(&quot;../images/skier.gif&quot;) no-repeat top right fixed;<br />
background: no-repeat fixed top right url(&quot;../images/skier.gif&quot;);</p>
</li>
<li>
<p>You don&#8217;t have to put all the values. If you don&#8217;t want to put fixed, you can take it out without a problem :<br />
background: url(<q>../images/skier.gif</q>) no-repeat top right;</p>
</li>
</ul>
<p>Of course, mega properties don&#8217;t have any use if you you&#8217;re only using one value <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_wink.gif' alt="icon wink CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> <br />
The following example gives us the same result as before but it uses <em>background</em> to make the CSS shorter :</p>
<pre class="brush: css; title: ; notranslate">
body {
     background: url(&quot;../images/skier.gif&quot;) no-repeat top right fixed;
}

h1 {
     font-style: italic;
     font-family: &quot;Arial Black&quot;, Arial, Verdana, serif;
     text-align: center;
}

blockquote p {  /* All the paragraphs inside a blockquote */
     text-align: justify;
     text-indent: 25px;
}
</pre>
<p>One last thing, in all these examples I&#8217;ve been applying the background to the whole page (body). But don&#8217;t forget that you can add a background to anything (a title, a paragraph, certain words of a paragraph etc&#8230;)<br />
I suggest that you practice a bit just applying backgrounds to different parts of your web page. You should now be able to give you site quite a nice look <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_smile.gif' alt="icon smile CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>Well, as you can tell, the possibilities in CSS are quite impressive. Really, CSS is more or less limitless, and without wanting to discourage you, you haven&#8217;t seen everything <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>The only small difficulty in this chapter is trying to remember all the new properties I&#8217;ve shown you. By practicing you&#8217;ll remember them more easily and I&#8217;ll soon be bringing out a cheat sheet <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
<p>Why stop now? We haven&#8217;t seen the best of CSS yet <img src='http://blog.europcsolutions.com/wp-includes/images/smilies/icon_biggrin.gif' alt="icon biggrin CSS   Text Formatting In CSS (Part 2/2)" class='wp-smiley' title="CSS   Text Formatting In CSS (Part 2/2)" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.europcsolutions.com/css-text-formatting-in-css-part-22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

