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.

Source Distribution

cssdecl-0.1.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page