My Profile

Showing posts with label CSS Tutorials. Show all posts
Showing posts with label CSS Tutorials. Show all posts

Tuesday, February 1, 2011

CSS Comments



Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers.
A CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/

p

{

text-align:center;

/*This is another comment*/

color:black;

font-family:arial

}
<html>
 <head> <link rel="stylesheet" type="text/css" href="ex1.css" /> </head> <body> <h1>This header is 36 pt</h1> <h2>This header is blue</h2> <p>This paragraph has a left margin of 50 pixels</p> </body> </html>body
{
background-color:yellow;
}
h1
{
font-size:36pt;
}
<html>
    <head>
<link rel="stylesheet" type="text/css" href="ex2.css" />
    </head>
 <body>
 <h1>This is a header 1</h1>
<hr />
<p>You can see that the style sheet formats the text</p>
<p><a href="http://www.w3schools.com" target="_blank">This is a link</a></p> </body> </html>
h2
{
color:blue;
}
p
{
margin-left:50px;
}

 
This is the style sheet file (ex2.css):



body {background-color: tan}
h1 {color:maroon; font-size:20pt}
hr {color:navy}
p {font-size:11pt; margin-left: 15px}
a:link     {color:green}
a:visited  {color:yellow}
a:hover    {color:black}
a:active   {color:blue}

Friday, January 28, 2011

CSS Syntax



A CSS rule has two main parts: a selector, and one or more declarations:


The selector is normally the HTML element you want to style.

Each declaration consists of a property and a value.
The property is the style attribute you want to change. Each property has a value.


CSS Example

CSS declarations always ends with a semicolon, and declaration groups are surrounded by curly brackets:

         p {color:red;text-align:center}

To make the CSS more readable, you can put one declaration on each line, like this:

Example

p
{
color:red;
text-align:center;
}

------------------------------------------------------

** If you like this post please like our page in facebook "Dot Net Support" 



CSS Demo


An HTML document can be displayed with different styles:

Styles Solved a Big Problem

HTML was never intended to contain tags for formatting a document.
HTML was intended to define the content of a document, like:

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

When tags like <font>, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process.

To solve this problem, the World Wide Web Consortium (W3C) created CSS.

In HTML 4.0, all formatting could be removed from the HTML document, and stored in a separate CSS file.
All browsers support CSS today.

CSS Saves a Lot of Work!

CSS defines HOW HTML elements are to be displayed.
Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!


------------------------------------------------------

** If you like this post please like our page in facebook "Dot Net Support" 

Introduction to CSS


CSS Tutorial

Save a lot of work with CSS!
In our CSS tutorial you will learn how to use CSS to control the style and layout of multiple Web pages all at once.



CSS Example
body
{
background-color:#d0e4fe;
}
h1
{
color:orange;
text-align:center;
}
p
{
font-family:"Times New Roman";
font-size:20px;
}

<html>

<head>

<style type="text/css">

body

{

background-color:#d0e4fe;

}

h1

{

color:orange;

text-align:center;

}

p

{

font-family:"Times New Roman";

font-size:20px;

}

</style>

</head>

<body>

<h1>CSS example!</h1>

<p>This is a paragraph.</p>

</body>

</html>

What You Should Already Know
Before you continue you should have a basic understanding of the following:
  • HTML / XHTML
If you want to study these subjects first, find the tutorials on our .

What is CSS?
  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files

----------------------------------------------------------

** If you like this post please like our page in facebook "Dot Net Support" 

CSS Tutorial

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More