Wednesday, 12 April 2023

Introduction with CSS?

 

What is CSS?

CSS is short form of Cascading style sheet. Similar to HTML, CSS is not a programming language or a markup language. Instead, CSS is a style sheet language that is used to define that how a websote should look. It makes the HTML / XML code presentable in a customizable form. CSS enables users to apple styles to web pages. It defines that how a web page should look. With CSS, users can control colours, fonts, spacing and formatting of a HTML document. Additionally, CSS is easy to learn and provides users powerful control over the presentation of an HTML document.

What is difference between HTML and CSS?

Both languages are not programming languages. HTML is structural language which is used to define basic structure of a web page. It is used to define basic elements in a web page or web site. Whereas, CSS is style sheets language which is used to make a HTML document presentable. It is used to design the structure of a document written in HTML / XML. It can be used to define formatting of a document i.e colours, fonts, spacing, margins, padding, animations etc. An example of difference b/w HTML and CSS is as displayed below:-

Why we use CSS?

  • To Save Time: CSS can be used to save time as style sheet can be re-used. Moreover, single CSS code can be used on multiple classes of HTML. For example, user has defined a heading in H3, a single CSS style can be used to design all H3 heading in a website/webpage.
  • Easy Maintenance: CSS is a user-friendly style language; user can make global changes with simple editing / amendments. Changes will automatically update all elements where required instantly.
  • Search Engine Friendly: CSS is a clean coding technique, for which search engine won’t have to difficulties to read its content.
  • Separate Concept of Designing: CSS defines user separate concept of designing and structure. Its means that user can make changes in look without getting involved in HTML coding. This is very useful when user is working with large web pages, as it ensures maintenance of content easier.
  • Good grip over styling: CSS provides a good grip on styling options rather than HTML. With its use, user can control every element by formatting or by layout. This provides user flexibility and control over the appearance of website.
  • Offline Browsing: CSS can be used to store web application on local storage. Its mean that user can view and manage website offline before uploading / publishing it on live server.

Syntax of CSS

Syntax of CSS is very simple, easy to understand and clear. Sytle rule consist of selector and declaration block. Example is mentioned below:-

H1 (This is a selector) {

Color: Blue;

Font-size: 12px:

} (This is declaration block)

This CSS style code will make the look of H1 (Heading 1) as:-

Text Colour will be Blue.

Font Size will be 12 px.

The selector refers to the HTML element you want to style.

The declaration block contains one or more declarations separated by a semicolon.

Each declaration includes a CSS property name and a value, separated by a colon.

 

No comments:

Post a Comment