2023 CSS Cheat Sheet for Beginners and Professionals - IQCode

Introduction to CSS

CSS (Cascading Style Sheets) is used to specify the style and formatting of elements that make up an HTML document, such as fonts, layout, colors, and backgrounds. While HTML is used to structure the content of a web page, CSS is used to bring style and design to the page.

There are three types of CSS:

  • External CSS: This type of CSS is applied by linking an external style sheet in the header section of the HTML document. This method allows you to use the same CSS file for multiple web pages, making your HTML files cleaner and more manageable.
  • Internal CSS: This type of CSS is applied by writing style rules in the header section of a specific HTML page. This method is useful for styling a single page.
  • Inline CSS: This type of CSS is applied directly to an HTML element, using the style attribute. This method is useful for making small, case-by-case changes to the styling of an element.

Learn CSS: Basics to Advanced Concepts

One of the fundamental concepts of CSS is selectors. CSS selectors are used to select and style specific elements on a web page. Selectors are followed by one or more declarative CSS rules, which define the style of the selected element(s).

To apply a CSS style, you must write a declaration consisting of a property and a value separated by a colon. Multiple declarations are separated by semicolons. Here is an example of CSS syntax:

selector {
  property1: value1;
  property2: value2;
  property3: value3;

Selectors can be based on the tag name, class name, or ID of an HTML element, or on its attributes. By using different selectors, you can apply different styles to different parts of your web page.

To learn more about CSS and how to use it to create beautiful and responsive web pages, you can take online courses or use free resources available online.

Pseudo-Classes and Pseudo-Elements

In CSS, pseudo-classes and pseudo-elements are used to add special effects to certain elements. Pseudo-classes are used to define a special state of an element such as :hover, which will affect the element when the user hovers over it. Pseudo-elements, on the other hand, create a virtual element within the element, allowing for styling of a specific part of the element, such as the first letter or line.

Examples of pseudo-classes include:

    a:hover {
        color: red;
    input:focus {
        background-color: yellow;

Examples of pseudo-elements include:

    p::first-line {
        font-weight: bold;
    h1::after {
        content: "";
        display: block;
        border-bottom: 1px solid black;

CSS Content (Dynamic)



Description: This title is unclear and does not provide any information. Please provide more details or context regarding what you would like to accomplish.

Technical Interview Guides

Here are guides for technical interviews, categorized from introductory to advanced levels.

View All

Best MCQ

As part of their written examination, numerous tech companies necessitate candidates to complete multiple-choice questions (MCQs) assessing their technical aptitude.

View MCQ's
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Pleased to see you again

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.