Upgrade to Pro — share decks privately, control downloads, hide ads and more …

5分ぐらいでざっくり紹介するCSS4

 5分ぐらいでざっくり紹介するCSS4

Avatar for deepblue-will

deepblue-will

April 13, 2016
Tweet

More Decks by deepblue-will

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ Goodpatch, Inc. ਿݪปࢤ(͓͋͠) @deepblue_will • ProttͷϑϩϯτΤϯυ୲౰ • Java(SWT) →

    
 Ruby(Ruby on Rails) → JavaScript(AngularJS) • LTਓੜ̎ճ໨Ͱ͢ɻ
  2. :root { --main-color: #06c; --accent-color: #006; } #foo h1 {

    color: var(--main-color); } • ʮ--ʯͰม਺Λએݴ • ʮvar()ʯͰม਺Λ࢖༻
  3. :any-link nav :any-link { background-color: yellow; } nav :link, nav

    :visited { background-color: yellow; } • :linkͱ:visitedΛ1౓ʹࢦఆͰ͖Δ
  4. So, given the links: 1. <a href="http://www.example.com">Home</a> 2. <a href="http://www.example.com/2011">2011</a>

    3. <a href="http://www.example.com/2011/03">March</a> 4. <a href="http://www.example.com/2011/03/">March</a> 5. <a href="http://www.example.com/2011/03/21">21 March</a> 6. <a href="https://www.example.com/2011/03/">March</a> 7. <a href="http://example.com/2011/03">March</a> and the styles: A. a:local-link {...} B. a:local-link(0) {...} C. a:local-link(1) {...} D. a:local-link(2) {...} E. a:local-link(3) {...} If the document's URL is http://www.example.com/2011/03/: Link 1 would receive Style B Link 2 would receive Styles B and C Link 3 would receive Styles B, C, and D Link 4 would also receive Styles A, B, C, and D Link 5 would receive Styles B, C, and D Link 6 would receive Styles B, C, and D Link 7 would remain unstyled Style E would not be applied to anything
  5. E:read-only E:read-write • :read-only • readonly͕͍ͭͯΔinput, textarea, selectʹϚ ον •

    :read-write • readonly͕͍͍ͭͯͳ͍input, textarea, select ʹϚον
  6. E:nth-match(n of selector) E:nth-last-match(n of selector) • E:nth-match(3 of .hoge)

    • E.hogeͷ্͔Β3൪໨ʹϚον • E:nth-last-match(3 of .hoge) • E.hogeͷԼ͔Β3൪໨ʹϚον • E.hoge:nth-child(3)ͱҙຯ͕ҧ͏ • E.hoge͕3൪໨ʹ͋Δ৔߹Ϛον
  7. #grid { display: grid; grid-template-columns: auto minmax(min-content, 1fr); grid-template-rows: auto

    minmax(min-content, 1fr) auto } #title { grid-column: 1; grid-row: 1 } #score { grid-column: 1; grid-row: 3 } #stats { grid-column: 1; grid-row: 2; align-self: start } #board { grid-column: 2; grid-row: 1 / span 2; } #controls { grid-column: 2; grid-row: 3; justify-self: center } <div id="grid"> <div id="title">Game Title</div> <div id="score">Score</div> <div id="stats">Stats</div> <div id="board">Board</div> <div id="controls">Controls</div> </div>
  8. Media queries ranges @media (500px <= width <= 1200px) {

    /* your styles */ } @media (min-width: 500px) and (max-width: 1200px) { /* your styles */ } • min-width, max-widthΛ>=, <=Ͱॻ͚Δ