Basic Concept of CSS syntax

Hello everyone!!!

Here we will learn more about understanding CSS syntax and its uses and rules.  It consists of a few rules that are applied to the elements of the content and these are interpreted by the web browser. The rules are consisting of two parts.

  1. Selector- It points out the elements in the HTML page to which the CSS rule will be applied.
  2. Declarations- It determines how the elements are formatted on a webpage. It consists of a property and a value that is assigned around braces.

CSS is also known as Style-sheet language which is used to format the texts in a presentable font, color, background in the HTML language

Let us look up an example that will give a brief about the CSS styling:

<head>
  <title> CSS </title>
  <style>  
    h1 {
        color: black;
        text-align: center;
    }
  </style>
</head>
<body>
  <h1> Codespeedy</h1>
</body>

Here the text Codespeedy will be displayed in black font color and center-aligned.

Adding comments in CSS

Comments are used to make code more understandable and in CSS we use the comments in a pair of /*. Here look at an example:

<head>
  <title>CSS</title>
  <style>
    /* CODESPEEDY */
    h1 {
        color: black;
    }
  </style>
</head>
<body>
  <h1>Coding is fun</h1>
</body>

CSS includes selectors and some components that are case sensitive but the values are are not case-sensitive. The basic rule before applying CSS are they should be initialized within the  {…} block that will target the elements provided by the name. CSS rules should be specified inside the style element or in an external CSS file.  This was a brief about the CSS styling that should be known before the use.

Also, read: Change default browser scrollbar color and style in CSS

 

Leave a Reply

Your email address will not be published. Required fields are marked *