Understand the CSS Syntax or Lexical Structure:

Understand the CSS Syntax or Lexical Structure

The lexical structure of CSS is the set of rules that explains how to write code or program in that language. This is also known as CSS syntax. You can use CSS to associate various rules to the elements which will appear on your website. These rules are responsible for the content of those elements which should be rendered. The CSS rule is basically composed of two parts:

Selector: It shows those element or elements on which declaration is applied. If this applies to more than one element then you can use coma to separate the list of elements. Or you can say that it is the name of HTML tag or element to be defined by user.

Declaration: By using declaration you can set how the elements should be styled which are mentioned in the selector.

Example:

td {width:25px;}

Here td is a selector and 25px is Declaration. The declaration has two parts which are usually separated by colon:

  1. Property
  2. Value

Selector {Property: Value}

Property:

It is the property of the selected elements which you want to declare. It is usually the attribute of the HTML tag.

Value:

It is the value of the property of the HTML element or tag.

Example:

H1 {color: maroon}

In the above example, “Title” is the HTML element name, “Color” is the attribute to be changed and “maroon” is the value of the attribute.

It is possible to modify one or two tags at the same time e.g.

H1, H2 {color: yellow}

In the above example, you can change the color of any headings of size H1 and H2 to yellow.

H1,H3 { color: green; font-family: Comic Sans M}

In this example, you can change more than one property for more than one elements. In the above example, the color and font of both H1 and H3 heading will be changed to green and Comic Sans M respectively.

It is also possible to modify one or two attributes of the same tag at the same time e.g.

H1 {color: maroon; font-family: Comic Sans M}

The way in which element or elements can carry the attributes and how the attributes control the property of the element is similar to HTML or XHTML.

To get a mobile app for your business visit www.codescamp.com

Book a free consultation today!

email

10 Responses to Understand the CSS Syntax or Lexical Structure:

  1. I just want to mention I am new to weblog and certainly liked your page. Probably I’m going to bookmark your website . You amazingly come with beneficial articles. With thanks for revealing your blog site.

  2. Digg

    While checking out DIGG yesterday I noticed this

  3. good post says:

    You ought to take part in a contest for one of the greatest websites online. I will recommend this website!

  4. Je souhaite avoir un blog comme ça :)

  5. Mon ami a partagé ce site avec moi et je suis heureux qu’il a fait. J’ai aimé la façon dont vous l’avez expliqué le sujet. Je vais s’abonner à votre flux rss et vais certainement partager sur mes réseaux sociaux acclamations :)

  6. Tad Grover says:

    Fantastic blog! Do you have any helpful hints for aspiring writers? I’m planning to start my own blog soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely overwhelmed .. Any recommendations? Many thanks!

    • admin says:

      I think that you should use a free platform it can give you same results as the paid one so why pay? Good Luck Tad :)

  7. Curt Biscoe says:

    How you can get well site in blogger When it counted as spam in blogger?

  8. I consider something really interesting about your weblog so I saved to fav.

Leave a Reply