CSS Syntax

The css syntax have two main parts one is selector and decleration.

css syntax

The selector declere which element in the HTML Document the CSS rule applies to.

The declarations within the block presented how the elements are formatted on a webDocument. Each declaration consists of a property and a value separated by a colon (:) and ending with a semicolon (;) and also the declaration groups are add by curly braces {}.


<!DOCTYPE html>
body {
background-color: lightpink;

h1 {
color: yellow;
text-align: center;

p {
font-family: roboto;
font-size: 27px;

<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>


Click on the "Run This Code" button to see how it works.


Welcome CSS Syntax CSS Selectors CSS ADD css CSS Borders CSS Backgrounds CSS Colors CSS Padding CSS Margin CSS Fonts CSS Text CSS Outline CSS Box-Model CSS Height&Width CSS Icons CSS Links CSS Lists CSS Display CSS Tables CSS Position CSS Overflow CSS Align CSS Float CSS Inline-block CSS Opacity CSS Image-Gallery CSS Navigation Bar CSS Dropdowns CSS Cursors CSS Forms CSS Pseudo-classes CSS Pseudo-elements


CSS Gradients CSS shadows CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Media Queries CSS Flexbox CSS important CSS Units