Professional Documents
Culture Documents
“Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts,
Size, Colors, Spacing, Bordering etc) to Web documents.
If you want to build modern web sites, you need to know about Cascading Style
Sheets (CSS). CSS gives you the power to style and lay out web sites so they are
usable, compact, good looking, well structured, attractive and easy to maintain.
Cascading Style Sheets (CSS) is a style sheet language used to describe the
presentation semantics (the look and formatting) of a document written in a markup
language for example HTML. Its most common application is to style web pages written
in HTML but the language can also be applied to other kind of document as well.
Use.
Prior to CSS, nearly all of the presentational attributes of HTML documents were
contained within the HTML markup; all font colors, background styles, element
alignments, borders and sizes had to be explicitly described, often repeatedly, within the
HTML. CSS allows developers to move much of that information to a separate style
sheet resulting in considerably simpler HTML markup.
Syntax.
CSS has a simple syntax and uses a number of English keywords to specify the
names of various style properties.
A style sheet consists of a list of rules. Each rule or rule-set consists of one or
more selectors and a declaration block { }. A declaration-block consists of a list of
declarations in braces. Each declaration itself consists of a property, a colon (:), and a
value. If there are multiple declarations in a block, a semi-colon (;) must be inserted to
separate each declaration.
P {font-family:@Batang; background-color:Black}
h1 {font-family:@Batang; background-color:Black}
Type.
There are three types of CSS styles:
Inline styles
Inline styles are styles that are written directly in the tag on the document.
Inline styles affect only the tag they are applied to.
<style type="text/css">
p{font-family:@Batang; background-color:Black}
h1{font-family:@Batang; background-color:Black}
.btn{font-family:@Batang; background-color:Black}
</style>
External styles
External styles are styles that are written in a separate document and then
attached to various Web documents. External style sheets can affect any document
they are attached to.
Sources.
CSS information can be provided by various sources. CSS style information can
be either attached as a separate document or embedded in the HTML document.
Multiple style sheets can be imported.
Priority scheme for CSS sources (from highest priority to the lowest priority):
Advantages.
Uniform look and feel:
When working with large-scale, complex sites, having high styles such as news
and informational sites, advantage of using CSS weighs heavily on the feasibility and
maintenance of the project.
External CSS facilitates separation of page contents from the presentation that is
from the markup and style. This helps in a more easily manageable and readable
design view of the project.
Site-wide Consistency:
When CSS is used effectively, a global or external style sheet can be used to
affect and style elements site-wide. If the situation arises that the styling of the elements
should need to be changed or adjusted; now these changes can be made by editing
rules in the global or external style sheet. But Before CSS, this sort of maintenance was
more difficult, expensive and time-consuming.
Bandwidth:
A style sheet, whether internal to the source document or separate, will specify
the style once for a range of HTML elements selected by class, type or relationship to
others. This is much more efficient than repeating style information in line for each
occurrence of the element. An external style sheet can be used on multiple pages
without being reloaded, further reducing data transfer over a network.
Page Reformatting:
With a simple change of one line, a different style sheet can be used for the
same page. This advantage provides the ability to tailor a page to different target
devices.
How to Design External Style Sheet.
Create Sample .CSS File named "MyCSS.CSS" you can choose suitable name for
.CSS File
Optional Note: Learn additional different CSS chapters in detail using the link below.
http://www.w3schools.com/css/default.asp