Using jquery:
Include in the head
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
If you want to get certain style on certain DOM element, use this:
The code below will return the value of color of divId element.
$('#' + divId).css('color');
If you want to get all inline and outline style, use this funtion:
<script>
function printDiv(divId) {
var style = $("#div2").getStyleObject();
$("#div1").css(style);
}
(function ($) {
$.fn.getStyleObject = function () {
var dom = this.get(0);
var style;
var returns = {};
if (window.getComputedStyle) {
var camelize = function (a, b) {
return b.toUpperCase();
}
style = window.getComputedStyle(dom, null);
for (var i = 0; i < style.length; i++) {
var prop = style[i];
var camel = prop.replace(/\-([a-z])/g, camelize);
var val = style.getPropertyValue(prop);
returns[camel] = val;
}
return returns;
}
if (dom.currentStyle) {
style = dom.currentStyle;
for (var prop in style) {
returns[prop] = style[prop];
}
return returns;
}
return this.css();
}
})(jQuery);
</script>
If you want to list all the style rules of an element, just loop through it!
Hope this help!