Auto CSS Skeleton from #id's


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $('body').append('<div id="writehere"></div>');
  2. $('div,span,img').each(function (index, elem) {
  3. var thatstuff = $(this).attr("id");
  4. var thisstuff = $(this).attr("class");
  5. if(thatstuff!='writehere'){
  6. if(thatstuff!=''){$('#writehere').append('#'+thatstuff+' {\n\n}\n\n');}
  7. if(thisstuff!=''){$('#writehere').append('.'+thisstuff+' {\n\n}\n\n');}
  8. }
  9. });
  10.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.