Skip to content

Instantly share code, notes, and snippets.

@sandikodev
Created July 3, 2023 04:59
Show Gist options
  • Save sandikodev/f0776ae8ef440ba76af0a1f26829aec2 to your computer and use it in GitHub Desktop.
Save sandikodev/f0776ae8ef440ba76af0a1f26829aec2 to your computer and use it in GitHub Desktop.

Revisions

  1. sandikodev created this gist Jul 3, 2023.
    32 changes: 32 additions & 0 deletions css.cheatsheet
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    ## SELECTOR
    ### CSS2
    /* Child Selector */
    div > p {
    color: red;
    }

    /* Adjacent Sibling Selector */
    h1 + p {
    margin-top: 20px;
    }

    /* Attribute Selector */
    input[type="text"] {
    width: 200px;
    }

    ### CSS3
    /* General Sibling Combinator */
    h1 ~ p {
    font-size: 1.2em;
    }

    /* :not() Pseudo-class */
    div:not(.highlighted) {
    opacity: 0.5;
    }

    /* Attribute Selectors */
    a[href*="google"] {
    background: url(/images/google-icon.png) no-repeat;
    }