How to convert an element css to JSON? [duplicate]

Tags: javascript,jquery,html,css,json

Problem :

This question already has an answer here:

I let my users to change any attribute(location, color, and ...) of every element in a page before printing.

I'm looking for a way which user can store the new style sheet and restore it anytime later?

I've tried to parse, but it doesn't return an array! Also $(element).css() doesn't work without any argument!

Solution :

If you are okay with using a plugin for your task, try this plugin :


Example: CSS:

body {background: #eee;color: #888;}


    "type": "stylesheet",
        "stylesheet": {
        "rules": [{
            "type": "rule",
                "selectors": [
                "declarations": [{
                "type": "declaration",
                    "property": "background",
                    "value": "#eee"
            }, {
                "type": "declaration",
                    "property": "color",
                    "value": "#888"

    CSS Howto..

    How do I get a div to fill the width regardless if the brower window is shrunk?

    how to activate the functions of a div in css after focusing in a textbox in

    How do i hook media queries to screen resolution?

    How to add external CSS to HTML 'style'

    How to target tablet devices with CSS queries

    How to make JS and CSS cacheable until changes? [closed]

    How to insert javascript function in css link tag

    How to use image tag in body of html instead of loading image from css?

    How can I make the width of my
    match the width of the inside its

    How do I stop the FLOAT (without extra markup)?

    How to add css to 1 element when hiding another?.. Jquery

    How to select div with id nested in another div with class in css

    How to add local css file to a page in WebView?

    How do I style a specific select option in HTML

    How to do aligning image next to textbox with CSS? [closed]

    How to make a border which wraps around text

    Dompdf - how to display table and graph sidebyside?

    How to get use the functionality same as “-webkit-appearance” in firefox?

    how to get particular words with dotted lines in HTML and CSS?

    How can I make a button change its position after being clicked?

    How to create a underline with small break in middle with css?

    CSS: How to get a button to always be to the left of another button that's in a corner?

    How to select by CSS styles in jQuery?

    How-to mix fixed and percentage heights/width using css without javascript

    CSS how can i turn the scrolling off during the animation?

    How to get the image height of an image to set another div height

    How do I make XAMPP use the paths from my Wordpress themes folder?

    How to make text appear at the top left corner?

    How to include child div into parent div automatically?

    How to center a IMG tag horizontaly and vertically using html and css in ie7?