Giter VIP home page Giter VIP logo

css-optim's Introduction

CSS optim

CSS optimization inspired by Jens Oliver Meiert’s book https://github.com/j9t/css-optimization-basics/.

Declaration sorting

Sort declarations alphabetically.

Selector sorting

The following order is based on https://html.spec.whatwg.org/multipage/#toc-semantics (with the exception of the main element).

Universal

Document

  • html

Document metadata

  • head
  • title
  • base
  • link
  • meta
  • style

Sections

  • body
  • main
  • article
  • section
  • nav
  • aside
  • h1
  • h2
  • h3
  • h4
  • h5
  • h6
  • hgroup
  • header
  • footer
  • address

Grouping content

  • p
  • hr
  • pre
  • blockquote
  • ol
  • ul
  • menu
  • li
  • dl
  • dt
  • dd
  • figure
  • figcaption
  • div

Text-level semantics

  • a
  • em
  • strong
  • small
  • s
  • cite
  • q
  • dfn
  • abbr
  • ruby
  • rt
  • rp
  • data
  • time
  • code
  • var
  • samp
  • kbd
  • sub
  • sup
  • i
  • b
  • u
  • mark
  • bdi
  • bdo
  • span
  • br
  • wbr

Edits

  • ins
  • del

Embedded content

  • picture
  • source
  • img
  • iframe
  • embed
  • object
  • param
  • video
  • audio
  • track
  • map
  • area
  • math
  • svg

Tabular data

  • table
  • caption
  • colgroup
  • col
  • tbody
  • thead
  • tfoot
  • tr
  • td
  • th

Forms

  • form
  • label
  • input
  • button
  • select
  • datalist
  • optgroup
  • option
  • textarea
  • output
  • progress
  • meter
  • fieldset
  • legend

Interactive elements

  • details
  • summary
  • dialog

Scripting

  • script
  • noscript
  • template
  • slot
  • canvas

Attributes

  • .class
  • #id

ID and class naming

  • keep use of IDs and classes to a minimum
  • if needed, use functional ID and class names
  • otherwise use generic ID and class names
  • use names that are as short as possible but as long as necessary

Shorthands

Use shorthands when possible. An overview of CSS shorthands:

  • animation
  • background
  • border
  • border-bottom
  • border-color
  • border-left
  • border-radius
  • border-right
  • border-style
  • border-top
  • border-width
  • column-rule
  • columns
  • flex
  • flex-flow
  • font
  • grid
  • grid-area
  • grid-column
  • grid-row
  • grid-template
  • list-style
  • margin
  • offset
  • outline
  • overflow
  • padding
  • place-content
  • place-items
  • place-self
  • text-decoration
  • transition

css-optim's People

Contributors

iksi 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.