Skip to content

Instantly share code, notes, and snippets.

@yogain123
Created October 5, 2019 13:33
Show Gist options
  • Save yogain123/9e30a0be7b7c7520e0866000e11db5be to your computer and use it in GitHub Desktop.
Save yogain123/9e30a0be7b7c7520e0866000e11db5be to your computer and use it in GitHub Desktop.
Web Bootcamp
@yogain123
Copy link
Author

importing bootstrap

Importing in js file

import "bootstrap/dist/css/bootstrap.min.css"

importing in css/scss file to override default

body-bf:#12332
@import "~bootstrap/dist/css/bootstrap.min.css"

@yogain123
Copy link
Author

    <style>
      ul > li:nth-child(3n + 1) {
        background-color: red; /* 1,4,7,10 */
      }
      ul > li:nth-child(3n + 2) {
        background-color: green; /* 2,5,8,11 */
      }
      ul > li:nth-child(3n + 3) {
        background-color: blue; /* 3,6,9 */
      }
    </style>

@yogain123
Copy link
Author

yogain123 commented Sep 26, 2022

@yogain123
Copy link
Author

DOM Elements

Screenshot 2022-09-26 at 7 10 35 PM

Screenshot 2022-09-26 at 7 12 23 PM

@yogain123
Copy link
Author

Node VS Elements

Screenshot 2022-09-26 at 7 13 19 PM

Screenshot 2022-09-26 at 7 15 19 PM


Screenshot 2022-09-26 at 7 16 08 PM


Screenshot 2022-09-26 at 7 18 01 PM


Screenshot 2022-09-26 at 7 18 43 PM


Screenshot 2022-09-26 at 7 19 37 PM


Screenshot 2022-09-26 at 7 20 34 PM

@yogain123
Copy link
Author

Insert Adjacent Elem

Screen Shot 2022-10-09 at 1 19 16 AM

Screen Shot 2022-10-09 at 1 19 23 AM

@yogain123
Copy link
Author

flexbox props

Screen Shot 2022-10-16 at 4 22 09 PM

Screen Shot 2022-10-16 at 4 21 45 PM

@yogain123
Copy link
Author

handle image content

object-fit: "cover"

@yogain123
Copy link
Author

yogain123 commented Nov 22, 2022

CSS layers

by default user agent define some css rule to eaach html elem, we override it by owr own style

Screen Shot 2022-11-22 at 3 07 08 PM

similary we can also define layers to css style to tell what is more important to handle specificity

the way our stack wrks is that broswr stylesheet at bottom is least speicifc, then we have layer called utilities is more specific and then we have all the code not in layer which is going to be the next most specific after utilities

Screen Shot 2022-11-22 at 3 08 14 PM


Screen Shot 2022-11-22 at 3 11 19 PM

specificity increases frm left to right

we can change speicifcty of vendr css imports

Screen Shot 2022-11-22 at 3 12 22 PM

imports in css is not a good practise because first it downloads the entire styles.css and then looks for all the css import and then it downloads them, so thigs are not parelley
so its good to put @imports in html file

Screen Shot 2022-11-22 at 3 15 19 PM


Note::
Unlike normal CSS with the layer, everything dealing with important goes in backward order (right to left)

Screen Shot 2022-11-22 at 3 17 25 PM

======

whne we gicve id to element, it gets attached to windw objetct so we can use direct , window.hola , or hola to get it
<div id="hola">Hellooooo</div>

@yogain123
Copy link
Author

@yogain123
Copy link
Author

yogain123 commented Nov 22, 2022

picture Elem

Screen Shot 2022-11-22 at 4 34 10 PM

@yogain123
Copy link
Author

yogain123 commented Feb 20, 2024

From Chatgpt

html attribute data-something -> https://chat.openai.com/share/9c200155-bdf4-47df-b62e-09114726115d

z-index -> For z-index to work, the element (or pseudo-element) must be positioned—meaning it should have position: relative, position: absolute, position: fixed, or position: sticky. By default, ::before and ::after are inline, so you will need to set their position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment