Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the basic rules of CSS grammar

Shulou Source: shulou.com Published: 2022-06-01 04:08:55 09月17日 Update

This article mainly shows you "what are the basic rules of CSS grammar". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the basic rules of CSS grammar?"

CSS Syntax 1. Basic rules

The CSS rule mainly consists of two parts: the selector and the declarations.

A selector is a HTML element that developers want to change their style.

A declarations is an element rule that developers want HTML to change. It can be one or more.

Each declaration (declarations) consists of an attribute (property) and a value (value).

The property is the style attribute that the developer wants to set.

The value is the specific content of the attribute.

Properties and values are separated by colons, and declarations are directly separated by semicolons.

Comments in CSS begin with / * and end with * /.

/ * selector {property: value} * / H2 {color:red; font-size:14px;}

The above line of code defines the text color within the H2 element as red and sets the font size to 14 pixels.

These are all the contents of the article "what are the basic rules of CSS Grammar". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Rules attributes syntax content elements developers articles development styles learning help selection between code functions pixels colons semicolons and multiple at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia MariaDB Shulou Tech Info macOS