Saturday, September 6, 2008

CSS Tutorial

CSS stands for Cascading Style Sheets. It is a way to divide the content from the layout on web pages.

How it works:

A style is a definition of fonts, colors, etc.

Each style has a unique name: a selector.

The selectors and their styles are defined in one place.

In your HTML contents you simply refer to the selectors whenever you want to activate a certain style.

For example:

Instead of defining fonts and colors each time you start a new table cell, you can define a style and then, simply refer to that style in your table cells.

Compare the following examples of a simple table:

Classic HTML



With CSS (assuming that a selector called subtext is defined)


While CSS lets you separate the layout from the content, it also lets you define the layout much more powerfully than you could with classic HTML.


With CSS, you will be able to:

- define the look of your pages in one place rather than repeating yourself over and over again throughout your site. (Ever get tired of defining colors and fonts each time you start a new cell in a table? Those days are over with CSS!)

- easily change the look of your pages even after they're created. Since the styles are defined in one place you can change the look of the entire site at once. (Ever get tired of replacing tags throughout your site when you want to change the look of a certain element? Those days are over with CSS!)

- define font sizes and similar attributes with the same accuracy as you have with a word processor - not being limited to just the seven different font sizes defined in HTML.

- position the content of your pages with pixel precision.

- redefine entire HTML tags. Say for example, if you wanted the bold tag to be red using a special font - this can be done easily with CSS.

- define customized styles for links - such as getting rid of the underline.

- define layers that can be positioned on top of each other (often used for menus that pop up).

Your pages will load faster, since they aren't filled with tags that define the look. The style definitions are kept in a single CSS document that is only loaded once when a visitor enters your site.


The one disadvantage is:

- these will only work on version 4 browsers or newer. However, more than 95% of all browsers live up to that.


Syntax:
The CSS syntax is made up of three parts: a selector, a property and a value:
selector {property: value}
The selector is normally the HTML element/tag you wish to define, the property is the attribute you wish to change, and each property can take a value. The property and value are separated by a colon and surrounded by curly braces:
body {color: black}
If the value is multiple words, put quotes around the value:
p {font-family: "sans serif"}
Note: If you wish to specify more than one property, you must separate each property with a semi-colon. The example below shows how to define a center aligned paragraph, with a red text color:
p {text-align:center;color:red}
To make the style definitions more readable, you can describe one property on each line, like this:
p
{
text-align: center;
color: black;
font-family: arial
}


Grouping:
You can group selectors. Separate each selector with a comma. In the example below we have grouped all the header elements. All header elements will be green:
h1,h2,h3,h4,h5,h6
{
color: green
}


Class Selector:
With the class selector you can define different styles for the same type of HTML element. Say that you would like to have two types of paragraphs in your document: one right-aligned paragraph, and one center-aligned paragraph. Here is how you can do it with styles:
p.right {text-align: right}
p.center {text-align: center}
You have to use the class attribute in your HTML document:


This paragraph will be right-aligned.

This paragraph will be center-aligned.

Note: Only one class attribute can be specified per HTML element! The example below is wrong:


This is a paragraph.


You can also omit the tag name in the selector to define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class="center" will be center-aligned:
.center {text-align: center}
In the code below both the h1 element and the p element have class="center". This means that both elements will follow the rules in the ".center" selector:

This heading will be center-aligned

This paragraph will also be center-aligned.

Do NOT start a class name with a number! It will not work in Mozilla/Firefox.


id Selector:
With the id selector you can define the same style for different HTML elements.
The style rule below will match any element that has an id attribute with a value of "green":
#green {color: green}
The rule above will match both the h1 and the p element:

Some text

Some text
The style rule below will match a p element that has an id with a value of "para1":
p#para1
{
text-align: center;
color: red
}
The style rule below will match any p element that has an id attribute with a value of "green":
p#green {color: green}
The rule above will not match an h1 element:

Some text


Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.

CSS Comments:
You can insert comments into CSS to explain your code, which can help you when you edit the source code at a later date. A comment will be ignored by the browser. 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
}


Selectors are the names that you give to your different styles.

In the style definition you define how each selector should work (font, color etc.).

Then, in the body of your pages, you refer to these selectors to activate the styles.

For example:



In this case B.headline is the selector.

The above example would result in this output:


There are three types of selectors:



The general syntax for an HTML selector is:

HTML selectors {Property:Value;}

For example:

HTML selectors are used when you want to redefine the general look for an entire HTML tag.


The general syntax for a Class selector is:

.ClassSelector {Property:Value;}

For example:

Class selectors are used when you want to define a style that does not redefine an HTML tag entirely.

When referring to a Class selector you simply add the class to an HTML tag like in the above example (class="headline").




SPAN and DIV as carriers

Two tags are particularly useful in combination with class selectors: and
.

Both are "dummy" tags that don't do anything in themselves. Therefore, they are excellent for carrying CSS styles.


has a particular importance for layers. Since layers are separate blocks of information.
is an obvious choice when defining layers on your pages.


The general syntax for an ID selector is:

#IDSelector {Property:Value;}

For example:

ID selectors are used when you want to define a style relating to an object with a unique ID.

This selector is most widely used with layers (as in the above example), since layers are always defined with a unique ID.


Grouped Selector

Most often selectors will share some of the same styles, for example, being based on the same font.
In these cases, rather than defining the font for each and every selector, one by one, you can group them, and thus assign the font to all the selectors at once.

Look at this example, made without grouping:

As you can see, the only style that varies is the font-size.
In the next example we have grouped the selectors, and defined the common styles at once.


Less to type, easier to change and guaranteed to be the same for all styles.


CSS can be added to your pages at 3 different levels.

It is possible to create CSS styles that only work for the single tag it is defined for.

Single tag CSS is used when the style is used in a single place on the entire site.

Usually a certain style appears more than once on your pages, and thus you should use the second technique: adding styles that are defined once for the entire page.

If, however, that certain style is used on more than a single page, you should use the third - and most powerful - technique described: adding styles that are defined once for the entire site.

The following Sections will explain each of these techniques....

Single Tags / Inline Style Sheet

CSS can be defined for single tags by simply adding style="styledefinition:styleattribute;" to the tags.

Look at this example:


You should limit your use of single tag CSS.

If you define your styles for each and every tag they're used on, you will lose much of the power associated with CSS.

For example, you will have to define the style over and over again whenever it's used, rather than just defining it once and then referring to that one definition whenever it's used.

Furthermore, if you wanted to change a certain style, you'd have to change it all over in your document, rather than in one place.


Single Pages / Internal Style Sheet

CSS can be defined for entire pages by simply adding a style definition to the head section.

Look at this example:



In the above example, although we used the sublines style twice, we only had to define it once: in the section.

By defining styles for entire pages, you will gain the freedom to easily change the styles even after the entire page has been made.

This is an obvious advantage for you as a designer. But the advantage is on the visitors side as well.

Since the styles are only defined in one place, the page size will be smaller, and thus faster to load.

There is a way to emphasize these advantages even more: using external CSS styles that work for entire sites.


Entire Sites / External Style Sheet

CSS can be defined for entire sites by simply writing the CSS definitions in a plain text file that is referred to from each of the pages in the site.

Rather than writing the entire CSS definition on each page, as in the previous examples, you can write it to a text file that is only loaded on the first page that a visitor sees at your site.
When the visitor jumps to other pages, the CSS text file will be cached and thus doesn't have to be transferred via the internet for subsequent pages.

This means that your pages will load faster while at the same time you will have extreme flexibility to change the style for your entire site even after it has been made.

Look at this example:

File: example.html



The above example is the exact same as we used for CSS defined for entire pages, with one important exception:
There is no style definition on the page. Instead we added a reference to an external style sheet:



This means that the browser will look for a file called whatever.css and insert it at the place where the reference was found in the
html document.

So in order to complete our example we need to have a file called whatever.css that looks like this:

File: whatever.css



Now if you just add the line to the of all your pages, then the one style definition will be in effect for your entire site.

Imagine the power and flexibility this gives you to make changes to the layout even after the site is done.
But also realize how using an external style sheet will guarantee that all pages are following the same thread.
There won't be single pages that you forgot to update when you decided to change the style for your headers.




At this point of the tutorial you should know:



All we need now is a walkthrough of the various style attributes that can be assigned.

We will divide them into three categories:


CSS has several options for defining the styles of text.

These options can entirely replace the tag, but there's even more. CSS allows you to define these styles much more powerfully than you could ever do with plain HTML.


Analog Clock Tutorial

STEPS TO FOLLOW

  1. Create a background for your clock, You can either draw it in fireworks or photoshop and import it onto your stage or draw it in flash itself.

  2. Add 5 Layers in your Timeline window.
    Name them - interface, sec, min, hour and actions. Similar to the Timeline window shown below.

  3. Import your clock background design into your interface Layer if you had created it else where.

  4. Draw a line in your sec Layer. Select the line and press F8 to convert it to Symbol. Call this Symbol sec_mc, choose Movie clip behavior and select the bottom center square in registration. Similar to the Symbol window shown below.

Press OK.

  1. In your sec Layer, place sec_mc right at the center of your clock background design. Name it "sec" in instance text box of your property window. This is going to be your seconds needle.

  2. Drag sec_mc into your min Layer from your library. If your library window is not open, press (Ctrl+L) to open it. Reduce sec_mc's height, may be by 3pix. Place it right at the center of your clock background design. Name it "min" in instance text box of your property window. This is going to be your minutes needle.

  3. Drag sec_mc into your hour Layer from your library. Reduce its height, may be by 5 to 6pix. Place it right at the center of your clock background design. Name it "hour" in instance text box of your property window. This is going to be your Hours needle.

  4. Copy and Paste the code given below in your actions window of actions Layer.



Top of Form



Bottom of Form

  1. Now go to second frame of each layer and press F5 to insert new frame.

Your clock is ready. Press Ctrl+Enter to view your clock.

Tutorial 1


1) How do you view the basic system information of a computer? What is the system information that you found? Name 5 of the items. How can you save the system information as text file for future reference?


2) What are the keyboard buttons to press, in order for you to switch between multiple windows?


3) Where can you change the size and color of text and backgrounds for applications?


4) Which Windows display property can you use to configure the energy saving features of the PC?


5) What are the characteristics of asynchronous data transmission?


6) Which Windows display properties will enable you to select a large font size with out affecting the screen resolution?


7) Which Windows feature will enable you to locate a file or folder in your hard disk?


8) What are the advantages of using networked PC as compare to a mainframe?


9) What are the ways to restart a PC?


10) When you clean computer components, which alcohol can contaminate electrical connection?


11) When installing memory (RAM), what should you do to prevent ESD?


12) I’ve just deleted a very important file. How can I recover it?

Friday, September 5, 2008

Accessing THE WINDOWS SYSTEM ACCOUNT

The windows SYSTEM Account is like the god of gods in a windows environment meaning that under
it, you can access stuff that even an administrator can’t access.
What you will need:
Windows XP/Vista (Probably)
Step 1:
Open Command Prompt (Start|Run|cmd)
Step 2:
Type at
There are no entries in the list is the result you are looking for. If you get a result similar to access
denied or no access … this is the point you get off the train… (stop reading)
Page | 1
Written by Matthew Effting
Step 3:
Type at HH:MM /interactive “cmd.exe” (where HH is Hours and MM is Minutes in 24 hour time)
Eg. At 13:30 /interactive “cmd.exe”
**Make sure you set HH:MM to a few minutes after your current system time
Step 4:
Wait …
Step 5:
You will notice that a new Command Prompt window pops up with the title
“C:\WINDOWS\SYSTEM32\svchost.exe”
Step 6:
Open Task Manager (Ctrl + Shift + Esc) and kill explorer.exe
Step 7:
In the new Command Prompt window (refer to step 5) type explorer.exe
Step 8:
Click Start and check the name up the top of the menu.. it should say SYSTEM.

Gaining access to the command prompt when it has been disabled

What you will need:
Windows XP
Skill Level:
Beginner
Your system administrator may have blocked the command prompt for a number of reasons, all of
which are irrelevant to this guide.
If you are one of those people who like to stick it in their system administrator’s nose, then this is
the guide for you, if you are any kind of goody two shoes, then stop reading now!!!....
To start, think of reasons why you would want to access the command prompt. Do you want to hide
a file in a jpeg (one of my other guides) or even take control over the SYSTEM account (another one
of my guides)? Do you simply want to learn, or do you want to show your system administrator that
you are smarter than him/her? All these are valid reasons for wanting to access the command
prompt.
Step One: Preparation
Find yourself a nice computer (particularly one that has the command prompt disabled) and get
comfortable. Try to access the command prompt the old fashioned way (by running cmd.exe). You
will get something similar to the following message:
In short, this means that there is some bloke/woman (or even a bit of both) that doesn’t want you
accessing the command prompt and they have gone to great lengths (about 2 seconds enabling a
group policy) to stop you from accessing it.

Written by Matthew Effting Page | 1Step Two: Writing the tool that will get the job done
Open up notepad (Start | Run type notepad and hit enter) OR (if the run menu is disabled), Start |
All Programs | Accessories | Notepad.
Type the following into notepad:
@echo off
Start command.com

Step Three: Putting the icing on the cake
Save the file you just created in step two as a batch file. To do this type in quotes (“ ”) the following
into the save dialog box:
Commandprompt.bat
Run the newly created batch file and you will have access to the command prompt and all its glory.
NOTE: This will work unless your system administrator has blocked the usage of batch files or
blocked command.com itself. If you want to access the command prompt when those two things
are blocked, you’ll have to wait for another tutorial.

Search

My Blog List