What is CSS in HTML

What is CSS

Cascading Style Sheets (CSS) is the style sheet language used to describe the presentation of a document published in a markup language such as HTML. CSS is the key technology of the World Wide Web, alongside HTML and JavaScript.

The CSS is designed to allow the separation of presentation and content, including layout, colors, and fonts. CSS file and reduce the complexity and repetition of structural content.

This segregation can improve content accessibility, provide more flexibility and control in the configuration of presentation features, allow multiple web pages to share formatting by specifying the relevant CSS in a separate.

Separation of formatting and content also makes it possible to display the same markup page in different styles for distinct rendering techniques, such as on-screen, print, voice (via speech-based browser or screen reader) and Braille-based tactile devices.

CSS also has guidelines for alternative formatting if the content is accessed on a mobile device.

The name cascading is derived from the defined priority system to determine which style rule applies if more than one rule matches a specific component. This cascade priority system is predictable.

The World Wide Web Consortium (W3C) maintains the CSS requirements. The text/css form of Internet media type (MIME type) is recorded for use with CSS by RFC 2318 (March 1998). W3C operates a free CSS validation service for CSS pages. In addition to HTML, other markup languages support the use of CSS, including XHTML, XML, SVG, and XUL.

History of CSS

Håkon Wium Lie, Chief Technical Officer of Opera Software Company and co-creator of CSS web standards CSS, was first suggested by Håkon Wium Lie on 10 October 1994. At the moment, Lie was working at CERN with Tim Berners-Lee.

Several other web-based style sheet languages were suggested at the same moment, and debates on government mailing lists and the World Wide Web Consortium resulted in the release of the first W3C CSS Recommendation (CSS1) in 1996.

In specific, Bert Bos's suggestion was influential; he became a co-author of the CSS1 and is considered co-creator of the CSS.

Style sheets have existed in one form or another since the beginning of the Standard Generalized Markup Language (SGML) in the 1980s, and CSS was developed to provide web style sheets.

One requirement for a web style sheet language was that the style sheets should come from different sources on the internet. Existing style sheet languages such as DSSSL and FOSI were therefore not appropriate.

CSS, on the other side, let the style of a document be affected by various style sheets by "cascading" styles.

Syntax of CSS

CSS has a simple syntax and uses some English keywords to indicate the names of different style characteristics. The style sheet is made up of a list of guidelines. Each rule or rule set comprises of one or more selectors and a statement block.

Selector in CSS

In CSS, by matching tags and attributes within the markup itself, selectors declare which part of the markup a style applies to.

The following may apply to selectors:

  • All elements of a particular type, e.g. headers of the second level h2.
  • Attribute-specific elements, in particular:
  1. class: an identifier that can annotate multiple elements in a document.
  2. id: an identifier unique within the document.
  • Elements depending on how they are placed in a document tree relative to others.

Classe and ID are case-sensitive, starting with letters and may contain alphanumeric characters, hyphens, and underscores.

Syntax of CSS

For any amount of cases of any component, a class may apply. Only a single element can be used with an ID.

Declaration block in CSS

A declaration block comprises of a list of brace statements. Each statement itself is a property, a colon (:), and a value. If there are numerous statements in a block, to separate each statement, a semi-colon (;) must be placed.

In the CSS standard, properties are defined. Each property has a set of feasible values. Some characteristics may influence any sort of element, while others may only apply to specific groups of components.

Uses of CSS

Before CSS, the HTML markup contained almost all presentational characteristics of HTML papers.

It was necessary to describe explicitly, often continuously, all font colors, background styles, element alignments, boundaries and dimensions within the HTML.

CSS allows writers to transfer much of that data to another file, the style sheet, making HTML much simpler.

For example, HTML is used to structurally define headings (h1 elements), subheadings (h2), sub-sub headings (h3), etc. Choosing font, size, color, and emphasis for these components is presentational in print and on-screen.

CSS also describes non-visual styles for aural text readers, such as reading velocity and emphasis. All presentational HTML markup has now been deprecated by the W3C.

For instance, a heading element identified with red text would be written under pre-CSS HTML as:

<h1><font color="red"> BLOGWAPING 1. </font></h1>

The same element can be encoded using CSS instead of HTML presentation attributes using style properties:

<h1 style="color: red;"> BLOGWAPING 1. </h1>

The advantages of this may not be immediately clear, but when the style properties are placed in an internal style element or, even better, an external CSS file, the power of CSS becomes more apparent.

Suppose, for instance, the document includes the component of style:

<style>
h1 {
    color: red;
   }
</style>

All h1 elements in the document then automatically got red color without the need for explicit code.

Source code of CSS

CSS data can be given from a variety of sources. These sources may be the web browser, the user, and the author. The author's data can be further categorized as inline, media type, relevance, selector specificity, rule order, inheritance, and ownership definition.

CSS style data can be stored in a distinct document or can be integrated into an HTML document. You can import multiple style sheets.

Depending on the output device used, different styles can be used; for example, the screen version can be quite different from the printed version, so that the authors can tailor the presentation to suit each medium.

The Style sheet with the greatest priority regulates the display of material.

Declarations not specified in the largest priority source are forwarded to a reduced priority source, such as the style of the user agent. The method is called a cascade.

One of the objectives of the CSS is to allow consumers to have higher control over the presentation. A distinct style sheet may apply to someone who finds italic red headings hard to read.

Depending on the browser and the website, the user can choose from the different style sheets supplied by the developers, or they can remove all the styles added and display the page using the default style of the browser, or they can override the red italic style without changing any other characteristics.

What can CSS do?

Perhaps a better question is: "What can not the CSS do?”.

CSS on PC

The CSS can be used to convert an HTML document into a professional, polished design. Here are some of the things you can do with the wish of the CSS:

  • Create a flexible grid for the design of fully responsive websites that are beautifully rendered on any device.
  • Style everything from typography, tables, shapes, and more.
  • Positioning components on a web page relative to each other using characteristics such as float, place, overflow, flex, and box size.
  • Add background pictures to any of the elements.
  • Create patterns, relationships, and animations.
These ideas and methods go beyond the scope of this introductory guide, but the following resources will assist you to address these more sophisticated subjects.

Run CSS Online

Run CSS on PC

You can create css with HTML with this software and then open that file in any Web browser.

Books for CSS

I am sure these books are help you to learn CSS quickly.


I am sure this article will help you to understand about the CSS.

1 comment:

Powered by Blogger.