Skip to main content

A way of writing CSS with a Python library.

Project description

CSS.py

A simple way of making CSS code in Python.

Your CSS.py installation

Installing CSS.py

pip install cssdotpy

Updating CSS.py

pip install --upgrade cssdotpy

Links

Using it

NOTICE: CSS.PY IS IN ALPHA DEVELOPMENT STAGES AND DOES NOT HAVE MANY FEATURES YET

Creating a CSS instance

import cssdotpy

MyCSS = cssdotpy.CSS()

Adding HTML elements to the CSS and styling them

import cssdotpy

MyCSS = cssdotpy.CSS()

MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])

Adding HTML classes to the CSS and styling them

import cssdotpy

MyCSS = cssdotpy.CSS()

MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])

Adding Events to elements and/or classes and styling those

import cssdotpy

MyCSS = cssdotpy.CSS()

MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])
MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])

MyCSS.addEventToElement(element="p", event="hover", style=["color:blue", "transform: scale(1.1)"])
MyCSS.addEventToClass(name="MyClassName", event="hover", style=["color:blue", "transform: scale(1.1)"])

Getting your CSS

import cssdotpy

MyCSS = cssdotpy.CSS()

MyCSS.addElement(element="p", style=["color:red", "font-family:roboto"])
MyCSS.addClass(name="MyClassName", style=["color:red", "font-family:roboto"])

MyCSS.addEventToElement(element="p", event="hover", style=["color:blue", "transform: scale(1.1)"])
MyCSS.addEventToClass(name="MyClassName", event="hover", style=["color:blue", "transform: scale(1.1)"])

# Print CSS
print(MyCSS.returnCSS())

# Output to file
open("output.css", "w").write(MyCSS.returnCSS())

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

CSSdotPy-0.1-py3-none-any.whl (16.2 kB view hashes)

Uploaded Python 3

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