CSS Basics

CSS stands for Cascading Style Sheets. It's used to style the visual presentation of HTML elements.

To apply CSS, you can use the <style> tag in the <head> section of an HTML document, or you can link an external CSS file using the <link> tag.

Selectors

CSS selectors are used to target HTML elements on which to apply styles. Here are some commonly used selectors:

                    /* Selects all <p> elements */
                    p {
                        /* Styles here */
                    }

                    /* Selects elements with class "example" */
                    .example {
                        /* Styles here */
                    }

                    /* Selects elements with id "main-header" */
                    #main-header {
                        /* Styles here */
                    }
                

Properties

CSS properties define the style of HTML elements. Here are some commonly used properties:

                    /* Sets the font size to 16 pixels */
                    font-size: 16px;

                    /* Sets the text color to blue */
                    color: blue;

                    /* Sets the background color to light gray */
                    background-color: lightgray;