을 감안할 때 가상의 마크 업 : 그것은 비록 분명히 매우 고통스러운, 확실히 가능
<span id="test">Some content of 'test'</span>
<pre id="css"></pre>
:
$('#test').css({'background-color':'red','color':'white','display':'block'});
var $elem = $('#test');
var styles = document.getElementById('test').style;
var prop;
for(var i=0;i<styles.length;i++){
prop = $elem[0].style[styles[i]];
console.log(styles[i] + ': ' + prop);
}
JS Fiddle demo.
개정 위의 (다소) 정제 된 버전 :
$('#test').css({'background-color':'red','color':'white','display':'block'});
var elem = document.getElementById('test');
var styles = document.getElementById('test').style;
var prop;
if (styles.length){
$('#css').append('<ul></ul>');
for(var i=0;i<styles.length;i++){
prop = elem.style[styles[i]];
$('<li />').text(styles[i] + ': ' + prop + ';').appendTo('#css ul');
}
}
JS Fiddle demo. (전체 및 JavaScript)를 JQuery와 그 효과가 알려져 있습니다 어디 그 이후
위의 본질적 요소의 인라인 스타일을 분석합니다. window.getComputedStyle()
에 액세스 할 수 있지만, 지금까지 내가 말할 수있는 당신이 당신의 페이지에 도구에 의해 생성 된 CSS를 보여주고 싶은 때문에 즉, 당신이 필요로하는 것보다 조금 더 많은 것 같다.
그것은 당신이 아직 답변 중 하나를 시도했다 확실히 가능? –