Posts

Showing posts with the label css

Chrome Dev Tools 中的 element.style 是什麼

Image
 Chrome Dev Tools 中的 element.style,指的是下圖紅框中的東西 就我目前查到的資料,element.style 中的設定,來自兩個地方: 在 html 中設定 style 在 javascript 中設定 style element.style 中的設定,會覆蓋掉原本在 css 中做的設定。如果在做 css 設定時加上 ! important,就不會被覆蓋掉。但是強烈建議避免使用 ! important,因為會蓋過原本「當兩個 style 互相衝突的時候,哪個 style 會優先被套用」的權重計算,增加 debug 的難度。 可以觀察底下這個簡單的 範例 : See the Pen element.style example by Flora ( @rossignol ) on CodePen . 在 html 中設定 style="color: blue;" 在 javascript 中設定 style.backgroundColor = "yellow" 在 css 中設定: .hi {   border: 3px solid pink;   color: red;   background-color: red; } 參考資料: What is element.style and why is it overriding my css settings?  - stackoverflow How do I find the origin source of an element.style? i.e. Which JS or jQ file is injecting it. I want to fix, not override - stackoverflow  When Using !important is The Right Choice 用 JavaScript 把 element.style 全部覆寫或清空

CSS 起手式

Reset CSS /* http://meyerweb.com/eric/tools/css/reset/     v2.0 | 20110126     License: none (public domain) */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {   margin: 0;   padding: 0;   border: 0;   font-size: 100%;   font: inherit;   vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {   display: block; } body {   line-height: 1; } ol, ul {   ...

JavaScript/ HTML/ CSS 工具資源

JavaScript 語法觀念 寫 JavaScript 的推薦習慣 Operator precedence and associativity, grouping and short-circuiting  - MDN coding style: JavaScript Standard Style Guide  中,比較重要的規範: 2 格縮排 字串使用單引號 沒有未使用的變數 沒有分號 關鍵字後加空白 函式名稱後加空白 永遠使用 === Airbnb JavaScript Style Guide Google JavaScript Style Guide Idiomatic JavaScript Style Guide JavaScript: The Good Parts JavaScript 的 Reference 遊戲 深入探討 JavaScript 中的參數傳遞:call by value 還是 reference? 小心地雷 重新認識 JavaScript 系列 JavaScript 全攻略:克服 JS 的奇怪部分 JavaScript 常見大坑與細節 JavaScript: typeof operator 浮點數計算 型別強制轉換(coercion),範例: 3 < 2 < 1  // true  (3 < 2 是false,為了計算 false < 1 的值,false 轉換成 0) 1 + '2'  // '12'  (數字 1 轉換成字串 1) JavaScript Type Conversion - W3S JavaScript-Equality-Table  (==, ===, if() ) Equality comparisons and sameness  (==, ===, Object.is, SameValueZero) - MDN 繪製流程圖 Draw.io Google Drawing 程式碼編輯器(text editor) Visual Studio Code: 我的 Visual Studio Code 設定 Sublime Text Atom Vim Emacs Brackets WebStorm...