Skip to main content

Python CSS declaration computer

Project description

# cssdecl Python CSS declaration computer

This package provides basic computation of CSS declarations in order to:

  • handle overwriting of properties
  • expand shorthands like border-width: 0 5px into border-top-width: 0, border-right-width: 5px, border-bottom-width: 0, border-left-width: 5px
  • (TODO!) expand shorthands like font: 5px sans-serif bold into font-family: sans-serif, font-size: 5px, font-weight: bold
  • resolve sizes to a common unit (i.e. pt)
  • resolve inherit given some inherited declarations

It does not process CSS selectors and their applicability to elements, including specificity.

Some properties that are not shorthands in CSS 2.2 become shorthands in CSS 3, such as text-decoration. We therefore hope to provide CSS22Resolver and CSS3Resolver.

This was first developed for use in [Pandas](pandas.pydata.org) ([#15530](https://github.com/pandas-dev/pandas/pull/15530)). Issues will continue to be prioritised to improve CSS support there, in the absence of other clear use-cases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cssdecl, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size cssdecl-0.1.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page