Wednesday, September 3, 2014

CSS - an introduction

Introduction

What is CSS?  Cascading Style Sheets for the simplest of definitions.  According to Google: "CSS is a cornerstone specification of the web and almost all web pages use CSS style sheets to describe their presentation. CSS is designed primarily to enable the separation of document content from document presentation, including elements such as the layout, colors, and fonts.".

Why use CSS?  You can set the tone for your whole web page/web site.  Reusable code beyond that reasoning, one central location to where a few changes here and there can greatly change the way your web page/web site looks.  Nifty eh.

Let the coding begin!

First lets create a webpage.  Nothing too fancy, here's something i threw together in 10 minutes or less:



The result looks like this in a web browser:




Not too shabby, but we could make that look quite a bit nicer.  Lets go ahead and create a .css file to include into the code above.  With something as simple as the following code (named DnD.css):



Now lets css'ify it! With one line of code added to my code above like the following:

The web page in a web browser looks like the following:


Wowsers!  Full page with blue background, Orange centered text for the heading text, green right justified text for the text within the paragraph tags.  Powerful stuff for very little code behind!

Tune in next time to learn some more advanced css techniques!

Source:

http://www.w3schools.com/css/




No comments:

Post a Comment