<p>My HTML is all marked up, ready to make it rain CSS.  The problem is that I have to go back and find out what all my id and class names are so I can get started.  What I need is a tool that parses my HTML and spits out a stylesheet with all the possible elements ready to be styled (maybe even with some defaults).  Does such a tool exist?</p>

[{'answer_id': 16989, 'author': 'danb', 'author_id': 2031, 'author_profile': 'https://Stackoverflow.com/users/2031', 'pm_score': 3, 'selected': False, 'text': '<p>I have a poor man\'s version of this I have used in the past... this requires jquery and firebug...</p>\n\n<pre><code>&lt;script type="text/javascript"&gt;\n    $(document).ready(function() {\n\n        $(\'*[@id]\').each(function() {\n            console.log(\'#\' + this.id + \' {}\');\n        });\n        $(\'*[@class]\').each(function() {\n            $.each($(this).attr(\'class\').split(" "), function() {\n                console.log(\'.\' + this + \' {}\');\n            });\n        });\n     });\n&lt;/script&gt;\n</code></pre>\n\n<p>it gives you something like this:</p>\n\n<pre><code>#spinner {}\n#log {}\n#area {}\n.cards {}\n.dialog {}\n.controller {}\n</code></pre>\n\n<p>if you want them in "natural" page order instead...</p>\n\n<pre><code>&lt;script type="text/javascript"&gt;\n    $(document).ready(function() {\n         $(\'*\').each(function() {\n             if($(this).is(\'[@id]\')) {\n                 console.log(\'#\' + this.id + \' {}\');\n             }\n             if($(this).is(\'[@class]\')) {\n                 $.each($(this).attr(\'class\').split(" "), function() {\n                     console.log(\'.\' + this + \' {}\');\n                 });\n             }\n         });\n     });\n&lt;/script&gt;\n</code></pre>\n\n<p>I just load the page with that script in there, then cut and paste the results out of firebug... then obviously, remove the script :)</p>\n\n<p>you\'ll need to remove the dups manually or just toss in some simple dup checking logic with a map or array or something.. one for IDs and one for classes.</p>\n'}, {'answer_id': 17015, 'author': 'Pascal', 'author_id': 1311, 'author_profile': 'https://Stackoverflow.com/users/1311', 'pm_score': 1, 'selected': False, 'text': '<p>This blog entry references to something similar to what you need <a href="http://blog.corunet.com/english/automatic-css-the-stylizator" rel="nofollow noreferrer">here</a>.</p>\n\n<p>It contains a link to a Perl script called \'<a href="http://blog.corunet.com/uploads/stylizator/stylizator.zip" rel="nofollow noreferrer">stylizator.pl</a>\'. This script parses the html to look for possible CSS elements and outputs them to a file.</p>\n'}, {'answer_id': 17087, 'author': 'Jon Galloway', 'author_id': 5, 'author_profile': 'https://Stackoverflow.com/users/5', 'pm_score': 3, 'selected': False, 'text': '<p>When I first saw this, I thought "Great question! Neat answer, danb!"</p>\n\n<p>After a little thought, I\'m not so sure this is a good idea. It\'s a little like generating event handlers for all controls in an ASP.NET page, or generating CRUD procedures for all tables in a database. I think it\'s better to create them as needed for two reasons:</p>\n\n<ol>\n<li>Less clutter from empty style declarations</li>\n<li>Less temptation to misuse (or underuse) CSS by writing everything at the class level rather than using descendant selectors like (#navigation ul li a).</li>\n</ol>\n'}, {'answer_id': 17648, 'author': 'Ian Oxley', 'author_id': 1904, 'author_profile': 'https://Stackoverflow.com/users/1904', 'pm_score': 1, 'selected': False, 'text': '<p>Another way to approach this is to standardise the id and class names you use in your HTML according to <a href="http://www.stuffandnonsense.co.uk/archives/whats_in_a_name_pt2.html" rel="nofollow noreferrer">some sort of naming convention</a>.</p>\n'}, {'answer_id': 18228, 'author': 'y0mbo', 'author_id': 417, 'author_profile': 'https://Stackoverflow.com/users/417', 'pm_score': 1, 'selected': False, 'text': "<p>I disagree with Jon. While this solution can be used poorly in the way he describes, it does not necessarily mean it will. Any wise developer or designer is going to take the script generated css classes and pull only what is really needed into the css file.</p>\n\n<p>The solution still solves the OP's question.</p>\n"}, {'answer_id': 18279, 'author': 'Jordan H.', 'author_id': 1540, 'author_profile': 'https://Stackoverflow.com/users/1540', 'pm_score': 2, 'selected': False, 'text': '<p>I agree with Jon, but I don\'t see a problem* with doing what the OP wants. Using the script provided, you\'d know all of your classes and ids. While working on your CSS, you should be deciding if you <em>need</em> to use each of them. At the end, or at the point that you feel like you have a good handle on what you\'re doing, run it through an optimizer / compressor so it removes unused ids and classes.</p>\n\n<p>*Operating assumption: You either didn\'t write the original HTML or you wrote it and later decided that "gosh CSS would be really nice here now, I wish I would have started with it." :-)</p>\n'}, {'answer_id': 330236, 'author': 'Andy Ford', 'author_id': 17252, 'author_profile': 'https://Stackoverflow.com/users/17252', 'pm_score': 3, 'selected': True, 'text': '<p><a href="http://lab.xms.pl/css-generator/" rel="nofollow noreferrer">http://lab.xms.pl/css-generator/</a> seems to fit the description.</p>\n'}, {'answer_id': 330652, 'author': 'AmbroseChapel', 'author_id': 242241, 'author_profile': 'https://Stackoverflow.com/users/242241', 'pm_score': 2, 'selected': False, 'text': '<p>Not that it isn\'t a sensible question with a sensible answer, but it implied to me the kind of unnecessarily marked-up HTML that people create when they don\'t understand positional selectors: the kind of code where everything has a class and an id.</p>\n\n<pre><code>&lt;div id="nav"&gt;\n  &lt;ul id="nav_list"&gt;\n    &lt;li class="nav_list_item"&gt;\n        &lt;a class="navlist_item_link" href="foo"&gt;foo&lt;/a&gt;\n    &lt;/li&gt;\n    &lt;li class="nav_list_item"&gt;\n        &lt;a class="navlist_item_link" href="bar"&gt;bar&lt;/a&gt;\n    &lt;/li&gt;\n    &lt;li class="nav_list_item"&gt;\n        &lt;a class="navlist_item_link" href="baz"&gt;baz&lt;/a&gt;\n    &lt;/li&gt;\n  &lt;/ul&gt;\n&lt;/div&gt;\n</code></pre>\n\n<p>you can remove everything except the id on the div and still be able to style everything there by its position; and obviously, the script won\'t show you all <em>those</em> possible selectors, will it?</p>\n\n<p>In other words, a narrow focus on CSS as something done to classes and ids is a concern.</p>\n'}, {'answer_id': 67179231, 'author': 'Andrew Howard', 'author_id': 1402073, 'author_profile': 'https://Stackoverflow.com/users/1402073', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ve made a generator which makes the html and css for you = <a href="https://www.andy-howard.com/css-skeleton-screen-generator/" rel="nofollow noreferrer">https://www.andy-howard.com/css-skeleton-screen-generator/</a></p>\n<p>Not much else to say really, it utilises the :empty selector in css.</p>\n'}]
['https://Stackoverflow.com/questions/16926', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/744/']