Code Monkey home page Code Monkey logo

css's Introduction

CSS Repository ๐Ÿ–ผ๏ธ๐Ÿ–Œ๏ธ๐Ÿ“ธ

CSS Selectors ๐Ÿ–‹๏ธ

Selectors ๐Ÿ”ต

selectorA {
   property1: value1;
   property2: value2;
}

selector:pseudo-class::pseudo-element {
    -vendor-property: value;
}

selector[attribute],
selector ~ relation {
    property: -vendor-value;
    -vendor-property: -vendor-value;
    -vendor-property: weirdsyntax;
}

Basic Selectors ๐Ÿ”ต

<ul>
   <li id="myID" class="myClass">item 1</li>
   <li class="myClass">item 2</li>
   <li>item 3</li>
</ul>

#myID ID

.myClass class

li tag name

Selectors in CSS ๐Ÿ–‹๏ธ

CSS Level 1 ๐Ÿ”ต

Type selector - E
Descendant selector - E F
Class selector - .class
ID selector - #elID
Link pseudo-class - :link
User action pseudo-class - :active

CSS Level 2 ๐Ÿ”ต

Universal selector - *
Lang pseudo-class - :lang(en)
User action pseudo-class - :hover, :focus
Structural pseudo-class - :first-child
Child combinator - E > F
Attribute Selectors - [attribute], [attribute='value'], [attribute~='value'], [attribute|='en']
Adjacent sibling combinator - E + F

CSS Level 3 ๐Ÿ”ต

Attribute selectors - [attribute^='val'], [attribute$='lue'], [attribute*='alu']
Target pseudo-class - :target
Negation pseudo-class - :not(s)
General sibling combinator - E ~ F
Enabled and Disabled pseudo-class - :enabled, :disabled
Selected-option - :checked
Structural pseudo-classes - :root, :empty, :last-child, 
:only-child, :first-of-type, :last-of-type, :only-of-type, 
:nth-child(n), :nth-last-child(n), :nth-of-type(n), :nth-last-of-type(n)

CSS Level 4 ๐Ÿ”ต

Case-insensitive attribute selector - [attribute='value' i]
Blank pseudo-class - :blank
Structural pseudo-class - :nth-match()
Dir pseudo-class - :dir(ltr)
Drop pseudo-class* - :drop
Hyperlink pseudo-class - :any-link
Lang pseudo-class - :lang(*-en)
Local link pseudo-class - :local-link
Matches-any pseudo-class - :matches(s1, s2)
Mutability* pseudo-class - :read-only, :read-write
Negation pseudo-class - :not(s1, s2)
Optionality pseudo-class - :required, :optional
Placeholder pseudo-class - :placeholder-shown
Indeterminate-value - :indeterminate
Validity pseudo-classes - :valid, :invalid
Relational pseudo-class - :has()
Scope pseudo-class - :scope
Range pseudo-classes - :in-range, :out-of-range
Grid pseudo-classes - :column(selector), :nth-column(n), :nth-last-column(n)
Time pseudo-class - :current
Default option pseudo-class * :default
Column combinator* - E || F
Descendant combinator - E >> F
Reference combinator - E /foo/ F
Parent combinator - E! > F

Specificity ๐Ÿ”ต

1-0-0: ID selector
0-1-0: Class selector (Also attribute selector & pseudoclass)
0-0-1: Element Selector

The * selector, or global selector, has no value.
* {} 0-0-0

Relational selectors & Combinators ๐Ÿ”ต

ul li,
ol li
descendant selector 
matches nested <li>s

ol > li
child selector 
matches <li>s in <ol> but not 
nested <ul>

li.hasaclass + li
adjacent sibling

Selectors API ๐Ÿ”ต

var chil = $('#bar .foo');

Natively
var el   = document.querySelector('#bar');
var chil = el.querySelectorAll('.foo');

or
chil = document.querySelectorAll('#bar .foo');

css's People

Contributors

diegomurillocorrea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.