<p>I know Microsoft has made efforts in the direction of semantic and cross-browser compliant XHTML and CSS, but it still seems like a PitA to pull off elegant markup. I've downloaded and tweaked the CSS Friendly Adapters and all that. But I still find myself frustrated with bloated and unattractive code.</p>

<p>Is elegant, semantic CSS with ASP.Net still a pipe dream? Or is it finally possible, I just need more practice?</p>

[{'answer_id': 33231, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 0, 'selected': False, 'text': "<p>As long as you use the Visual Studio designer, it's probably a pipe dream. I write all of my ASP.NET code (all markup, and CSS) by hand, simply to avoid the designer. Later versions of Visual Studio have gotten much better at not mangling your .aspx/.ascx files, but they're still far from perfect.</p>\n"}, {'answer_id': 33240, 'author': 'Jason Bunting', 'author_id': 1790, 'author_profile': 'https://Stackoverflow.com/users/1790', 'pm_score': 0, 'selected': False, 'text': '<p>A better question is: is it really worth it? I write web applications and rarely does the elegance of the resulting HTML/CSS/JavaScript add anything to the end goal. If your end goal is to have people do a "view source" on your stuff and admire it, then maybe this is important and worth all of the effort, but I doubt it.</p>\n\n<p>If you need the semantics, use XML for your data. I do believe in the idea of <strong><a href="http://en.wikipedia.org/wiki/Semantic_Web" rel="nofollow noreferrer">the semantic web</a></strong>, but my applications don\'t need to have anything to do with it.</p>\n'}, {'answer_id': 33241, 'author': 'NotMe', 'author_id': 2424, 'author_profile': 'https://Stackoverflow.com/users/2424', 'pm_score': 0, 'selected': False, 'text': '<p>As DannySmurf said, hand building is the way to go.</p>\n\n<p>That said, you might look at Expression Web.  At least it is pretty accurate in how it renders the pages.</p>\n'}, {'answer_id': 33243, 'author': 'Kevin Dente', 'author_id': 9, 'author_profile': 'https://Stackoverflow.com/users/9', 'pm_score': 5, 'selected': True, 'text': '<p>The easiest way to generate elegant HTML and CSS is to use MVC framework, where you have much more control over HTML generation than with Web Forms.</p>\n'}, {'answer_id': 33260, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 0, 'selected': False, 'text': "<p>@JasonBunting - Yes, it's absolutely worth it.  Semantic and cross-browser markup means that search engines have an easier (and thus higher rankings) time with your content, that browsers have an easier (and thus less error-prone) time parsing your content for display, and that future developers have an easier time maintaining your code.</p>\n"}, {'answer_id': 33382, 'author': 'Jon Galloway', 'author_id': 5, 'author_profile': 'https://Stackoverflow.com/users/5', 'pm_score': 2, 'selected': False, 'text': '<p>See <a href="https://stackoverflow.com/questions/12768/how-is-the-html-on-this-site-so-clean">this question</a> for more discussion, including use of MVC. This site uses ASP.NET and the markup is pretty clean. Check out the HTML/CSS on MicrosoftPDC.com (a site I\'m working on) - it uses ASP.NET webforms, but we\'re designing with clean markup as a priority.</p>\n'}, {'answer_id': 33430, 'author': 'dfasdljkhfaskldjhfasklhf', 'author_id': 2763, 'author_profile': 'https://Stackoverflow.com/users/2763', 'pm_score': 0, 'selected': False, 'text': "<p>Yes - it's a pipe dream.  Since working with a professional web designer on a joint project who HATED the output of ASP.net server side controls I stopped using them.  I essentially had to write ASP.net apps like you would write a modern PHP app.  If you have a heavy business layer then your page or UI code can be minimal.</p>\n\n<p>I've never looked back since.  The extra time spent writing everything custom has saved me a great deal of time trying to make Visual Studio / ASP.net play nice with CSS/XHTML.</p>\n"}, {'answer_id': 90597, 'author': 'cowgod', 'author_id': 6406, 'author_profile': 'https://Stackoverflow.com/users/6406', 'pm_score': 0, 'selected': False, 'text': '<p>i can\'t believe nobody has mentioned css adapters.  many of the common controls used in asp.net (gridview and treeview for example) can be processed through an adapter to change the resulting html that is outputted to the browser.</p>\n\n<p>if going the mvc route isn\'t a viable option, it is possible to write your own adapters for any of the built in asp.net controls.</p>\n\n<p><a href="http://www.asp.net/CssAdapters/" rel="nofollow noreferrer">http://www.asp.net/CssAdapters/</a></p>\n'}]
['https://Stackoverflow.com/questions/33223', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2640/']