KatsolAgency

Programming languages and web development including java , html, css ,java script,Tutorials Android phone tricks and Tech news around the world.

Monday, August 14, 2017

CSS

Cascading Style Sheets

Cascading Style Sheets

Introduction To CSS

What is CSS?

CSS, which  referred to as Cascading Style Sheets, is a simple design language intended
to simplify the process of making web pages presentable.
CSS handles the look and feel part of a web page. Using CSS, you can control the color
of the text, the style of fonts, the spacing between paragraphs, how columns are sized
and laid out, what background images or colors are used, as well as a variety of other
effects.
CSS is easy to learn and understand but it provides a powerful control over the
presentation of an HTML document. Most commonly, CSS is combined with the markup
languages HTML or XHTML.

     Benefits of CSS in Web development    

1: Global web standards 

 Now HTML attributes are being deprecated and it is
being recommended to use CSS. So it’s a good idea to start using CSS in all the
HTML pages to make them compatible with future browsers.

2: Superior styles to HTML 

 CSS has a much wider array of attributes than HTML,
so you can give a far better look to your HTML page in comparison to HTML
attributes.

3: Multiple Device Compatibility 

 Style sheets allow content to be optimized for
more than one type of device. By using the same HTML document, different
versions of a website can be presented for handheld devices such as PDAs and
cellphones or for printing.

4: Easy maintenance 

 To make a global change, simply change the style, and all
the elements in all the web pages will be updated automatically.

5: Pages load faster 

If you are using CSS, you do not need to write HTML tag
attributes every time. Just write one CSS rule of a tag and apply it to all the
occurrences of that tag. So, less code means faster download times.

6: CSS saves time 

 You can write CSS once and then reuse the same sheet in
multiple HTML pages. You can define a style for each HTML element and apply it
to as many web pages as you want.

People always ask Who Creates and Maintains CSS (Cascading Style Sheets)?

Cascading Style Sheets is created and maintained through a group of people within the W3C called the CSS
Working Group. The Cascading Style Sheets (CSS) Working Group creates documents called specifications.
When a specification has been discussed and officially ratified by the W3C members, it
becomes a recommendation.
These ratified specifications are called recommendations because the W3C has no control
over the actual implementation of the language. Independent companies and
organizations create that software.
NOTE: The World Wide Web Consortium or W3C is a group that makes
recommendations about how the Internet works and how it should evolve.

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:


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

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

1
2
3
4
5
p
{
color:red;
text-align:center;
}

Comments in CSS 

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.
see the example below

1
2
3
4
5
6
7
8
/*This is a comment*/
p
{
text-align:center;
/*This is a comment too*/
color:black;
font-family:arial;
}


    Choose :
  • OR
  • To comment
No comments:
Write comments