VS 2008 Web Designer and CSS Support

One of the big features that web developers will quickly discover with VS 2008 is its dramatically improved HTML designer, and the rich CSS support it brings. 

VS 2008 now uses the same web designer that ships with Microsoft's new Expression Web product.  In addition to providing lots of new functionality, you'll also find that this web designer is much faster than the VS 2005 version (which was based on a much older code base).

Below is a quick tour of some of the new web designer features that you'll be able to take advantage of with both VS 2008 as well as the free Visual Web Developer 2008 Express:

Split View Editing

In addition to supporting both source-view and design-view, VS 2008 adds support for a new "split-view" mode when working on pages.  This allows you to see both the HTML source and the Design View at the same-time, and easily have any changes you make in one view be updated in the other:

 

CSS Style Manager

VS 2008 supports a new tool window inside the IDE called "Manage Styles".  This shows all of the CSS stylesheets, and their corresponding rules, for the page you are currently editing.  It can be used both when you are in design-view, as well as when you are in source view on a page:

A circle around a CSS rule in the manage styles window indicates that particular rule is in use within the current document.  Using the mouse to hover over the rule allows you to quickly see the CSS rule values:

You can then either right-click on a CSS rule and select "Modify Style" to bring up a graphical CSS rules editor, or you can double click on the rule in the manage styles window to automatically open the stylesheet file and jump immediately to the CSS source definition to edit (with full intellisense):

For even more tips/tricks about how to best use the "Manage Styles" tool window please read this blog post.

CSS Properties Window

One of the other cool new CSS features that is also supported in both design and source view is the new CSS Properties Window:

When you select an HTML element or ASP.NET server control, the CSS property window will show you all of the CSS settings currently applied to it. You can also change any of the values using the CSS property grid. The "target rule" drop-down in the style toolbar allows you to determine under what rule the settings are applied (read this blog post to learn more about the style toolbar and target rule dropdown). 

If, like me, you sometimes struggle with large CSS stylesheets and find yourself shouting "why the $!#@ is it looking like that?", you'll find the "summary" view of the CSS Properties window really useful (just click the summary button at the top of the CSS properties pane).  When you press this button it enables a filtering mode that shows you the full inheritance set of CSS rules for the current HTML element or ASP.NET control you are working with:

In the properties grid above you'll notice that some values are duplicated multiple times - with red arrows striking out previous values.  This indicates that a parent CSS rule setting is being overridden by another CSS rule's value.  You can see both the original value as well as the overridden one in the summary view at the bottom. 

You can click on the individual values to see where in the CSS precedence hierarchy this value was inherited from or overridden.  In the example below you can see that the final color for the current element that my cursor is on is a dark brown color.  If I select this final color value, the CSS properties window will draw a blue box in the applied-rules list above indicating that this setting is set in the "singlecontent h3" rule:

If I click on the lighter brown color setting that this rule overrode (and which has the red strike-thru), you can see that it originated with the page's HTML body CSS rule (notice how the body rule below is selected in the applied rules list when I select the overridden value below):

Please read this dedicated CSS Properties Window blog post to learn even more how to use the CSS property window.

CSS Source View Intellisense

The HTML designer supports the ability to select an element or control in design-view, and graphically select a rule from the CSS list to apply to it. 

You'll also find when in source mode that you now have intellisense support for specifying CSS class rules:

This is true for both HTML element (like above), as well as with ASP.NET server controls:

This CSS intellisense is supported in both regular HTML / ASP.NET pages, as well as when working with pages based on master pages and nested master pages.

Nested Master Page Support

Earlier this month I wrote a dedicated blog post that covered the new VS 2008 Nested Master Page Support.  All of the above designer and CSS features obviously work with that as well:

Summary

The above post provides a quick look at some of the new HTML designer and CSS tool support in VS 2008 (all of the above features also ship with the free Visual Web Developer 2008 Express edition). 

Because VS 2008 now has multi-targeting support you'll be able to use these feature immediately without having to install .NET 3.5 on your servers.  You can open existing ASP.NET 2.0 projects in VS 2008, have VS 2008 continue to target .NET 2.0 as the runtime target, and begin using these features immediately.

Over the next week I'll also be starting a new multi-part blog series that covers the new <asp:listview> control that ships as part of ASP.NET in .NET 3.5.  One of the big benefits of the <asp:listview> is that it enables developers to have total control over the HTML output emitted in data scenarios.  This works well with all of the new CSS tool features above, and enables you to more easily create great looking web sites and applications.

Hope this helps,

Scott

72 Comments

  • shafa,thanks
    waiting waiting waiting waiting for vs08 beta2..........

  • Hi Scott,

    Will VS 2008 support multi monitors for the code editors? Right now there is no way to 'tear' away one code editor to another monitor.

  • Scott,

    You've provided loads of great posts about whats in the next set of role outs for visual studio users. Obviously we've heard a lot about asp:LinqDataSource and the IIS7 pipeline asp.net can plug into. You mention the ListView control, but what else is in for us in asp.net 3.5? (is that the correct version name?) A an overview post on what we should be expected would be really nice.

    Some quality blog posts, keep up the good work

  • Awesome! Now I just need to become a CSS Jedi master. ;)

    Wasn't full control over html output provided by the DataRepeater as well? How does the new ListView control differ?

  • Thanks for the Updates in the CSS.
    You mentioned about the CSS Overriding( with red color strike). Will it show the reverse one, because it took a long time for me to find out once in my project.

    Here is the example.



    .tbl TD {background-color:red}
    .tbltd{background-color:green}




    TD
    TD





    Here Even though I have given a separate class for the TD. It will not take the styling because of the ".tbl TD". Here the inheritance is reversed. It will take the style of the Table not the TD.

    Will VS 2008 show this reverse inheritance problems as well?

  • Great features, will VS2008 be released this week? I'd like to be the first one to use it:)

  • Hi Scott!
    Thx for all your posts. I have a question,
    Is VS 2008 Beta2 suitable for starting a new web project for production environments?
    I mean how stable Beta2 is and when new release will be shipped will be a lot of changes to do in code in order to work with release?
    Thank you.

  • This is a really good thing. In major companies this difference will not be felt, because the designers do the hard work but in small companies, this will improve the user experience, allowing the developer to produce more and better in less time.

  • Good One.

    You mentioned about inheritance and Overriding(Red Strike). Is there reverse will work.
    .tbl TD {background-color:red} - Class for the Table
    .tbltd{background-color:green} - Class for the TD

    Here it is taking the CSS for the table not for the TD.

  • very good it's better now.
    but i want to ask which day of VS2008 beta2 ship in this week.....

  • VS2008 is really going to be a leap for web development. Must have the day it comes out :)

    One question though: with all these CSS enhancements, will there be a better way to assign stylesheets to content pages? Unless I've been missing something so far (which is very possible!), it has always been a little awkward if you wanted a common master page, but with distinct style sheets on the content pages.

  • This is like a dream come true for ASP.Net devlopers. Waiting for Beta 2 to drop makes me feel like a little kid waiting for Christmas morning again! =P

  • Hi. I've been using Visual Web Developer 2005 Express and this is a really cool one. I want to try it out.

  • Hi Scott,
    VS2008 is so cool! I'm wating for the beta 2. I have a question about WebPart. What's new in WebPart of VS2008? Will it support templates (like WebPart Components of Fredrik Normén)?

  • Scott,
    I don't use the visual webforms designer a whole lot, I'm the bare markup type of guy, but when I do use the designer, one of the things that get in the way of the final polishing of the design are the extra padding, handles, labels, etc that are there to facilitate insertion. If there was a key combination that could make them disappear temporarily, that would help the final trimming of the layout. Maybe that does exist and I haven't found yet.

  • Interesting. One of the first things I usually do with a new VS install was to default it to "Code" mode instead of "Designer". I might be changing my habits with this one, since I do this sort of split view on the rare occasions I pull up Dreamweaver.

    Speaking of which, is the a multi-line find-replace in VS 2008? That's one of the few things I use DW for.

  • This seems very very similar to the feature in Sharepoint Designer. Is there any differences in the feature set of the css support in them?

  • Great stuff, it's about time that vs had the same type of functionality as dreamweaver(not that i ever liked dreamweaver!). I think that vs could be in the lead in terms of html and css development. I especially like the CSS Source View Intellisense.

  • another excellent post Scott! you're a machine! so, when will beta 2 be set free?

  • Thanks MS. I can now visually explain to my colleagues css inheritance!

  • Do you know if VS 2008 beta 2 will have a go live license?

  • In VS2008, is there a way to apply an attribute to a style sheet? I'm specificly interested in MediaType but there may be other attributes other people would be interested in. It would be nice if you could include multiple style sheets in your Theme, one marked Screen, one marked Print, Mobile, etc.

  • Feature request: Can we have an option on user controls and master pages so that the content of a control or page is indented to the right level in the output. e.g. if I have a nicely-formatted piece of HTML in my master page, then the aspx that uses the master page will always lack the indenting in the final HTML output - so the code is ugly and hard to read when you're viewing the output source.

    Cheers,
    Zombie.
    p.s. You've skipped answering my last 2 comment questions now. Tsk :)

  • You mentioned that this works for HTML & ASP.NET pages, may I assume that it also works for ascx controls? When designing controls, is there any way to indicate that a certain CSS class is expected to be applied by the loading page, so that we can see the final result of the controls design? Or would we just have to manually add and remove those styles to get the full effect? Thanks.

  • Thank you so much for this features! They have been long running pin point of my development. I have trained myself to never leave the Source view since ASP 3.0 and now I can finally stop abusing my IIS server and Alt-Tab keys to see my changes. It's been great to know the code in and out by now ;] but now I can be so much more productive!

    + I can finally tell my designer friends that I got something up my sleeves too and they can start using MS tools for my projects either Expression Web [or Express as the least denominator] to style my pages.

    Nikita

  • Another question:
    Will 2008 support all the current CSS properties and will this be extensible as the browsers add more and more CSS3 support?

    For instance, VS2005 dislikes my "border-collapse" CSS rules, despite this being a valid CSS value.

  • I like the idea of css intellisense!

  • Looks great! I'm looking forward to it!

    Can you tell us how this works with App Themes? I assume it will work fine if the Theme is defined at the page level, but what if the Theme is selected in web.config?

  • Simply...wow! You can't beat the intellisense for css classes. A dream come true!

  • Good, I see a few elements from SharePoint designer moving over here.
    Why don't we integrate SPD and VS200(*) ?

    SM

  • Intellisense, I can't program in any IDE that doesn't have intellisense, thanks for making our lives easier. I'm a little confused, when to use WPF/E and when to use CSS, I'm working on new apps, and I'm thinking to use WPF/E for the show, but now I have intellisense on CSS.

    Caleb

  • Are you going to rip off DreamWeaver's search and replace also... it would be nice

  • Hi Scott,
    I have a question - does the CSS intellisense show simply all available CSS classes?
    Or does it filter it to show only those that can be applied to a specific tag?
    (e.g. if I would define css class only for , then it wouldn't be visible for element)

    thanks,
    Paul

  • good one. Just cant wait any more for beta 2

  • CSS Source View Intellisense! YAY!

    Is there plans for ASP.NET Themes on the page designer support? That would be neat :)

    Anyways... this is REALLY good stuff. It will definatly help the ASP.NET comminity.

  • It has already been mentioned in these comments, but I wanted to add my voice. Please have the option to support multi monitors.

  • What about intellisense and design support for skins as well?

  • Hi Scott,
    Is Silverlight integrated with Visual Studio 2008 beta2?

  • It's a (much appreciated) step in the right direction, but having played with Expression Web - it's still a long way from Dreamweaver CS3.

  • Is it unnatural to love development software. I hope not, 'cause I'm falling in love with beta 2...and I don't even have it yet! Hurry!!!

  • Awesome updates and additions. Can't wait to load it.


  • xxxxxxxxxx---------waiting for vs.net 2008 beta 2---------xxxxxxxxx

  • It's nice to see that VS 2008 is finally catching up to the other leading web authoring tools -- such as Dreamweaver.

    Multi-monitor support is a must, though.

    Great job!

  • On monitors at least 30" in size does the split view, change to split left to right instead of top to bottom as shown in the screen shot?

  • Cool for VS 2008. I alway see the mess layout in design mode when i use VS 2005.

  • So, did the Frontpage team develop a design view that follows the standards of HTML and CSS 2.1/3?

  • Scott, have you any statistics on how big a percentage of Visual Studio users that actually use the designer? I understand that users of Visual Web Developer Express does, but isn't there a lot more developers in Visual Studio who only use the code view?

  • Can't wait for the Beta2 to come out

  • This will help a lot. Will it follow css standards? Will it interpret the css in a browser specific mode?

  • I would like to second Scott's question, I was wondering the exact same thing:


    Wednesday, July 25, 2007 10:32 AM by Scott Roberts

    Looks great! I'm looking forward to it!

    Can you tell us how this works with App Themes? I assume it will work fine if the Theme is defined at the page level, but what if the Theme is selected in web.config?

  • the ASP.NET teams at MS are always trying harder to get things more standards compliant - and man I am SO excited for this new product... screw Parry Hotter, bring on VS 2008!

  • VS2008 is shaping up to be rather good for the web developer. I'm using Expression Web a little and it's so much easier to use as an editor.

    One thing, and I think I'm speaking for a lot of people who haven't made the jump totally to asp.net yet, is there going to be intellisense for class asp, and more importantly, classic ADODB. There's still a lot of code out there that uses this and web hosts (particularly in the uk) don't seem in a rush to provide asp.net servers as standard.

    If it's not going to be in VS2008, is there any way it can be added in? Is there a way of doing it in VS2005???

    Ian T, Nottingham, UK.

  • Hi Scott - looks great. :) Does this mean that VS2008 will at last produce standards compliant HTML or do we still need to use extensions?
    Thanks again..

  • This looks good from the outside, but I note that we are still stuck with server controls that do not really render CSS compatible HTML anyway. I have tried the CSS Friendly adapters, but quite frankly these do not do much more than present a basis from which you can create your own adapters instead.

    As mentioned above by Dave Murdock, a number of the controls render in-line CSS. Worse than this, controls such as the GridView, Image and Table actually render inline styles within the markup that override anything being set by CSS!

    When will we see an update to the base server controls, or alternatively a new set of officially supported adapters, that will enable us to render the controls in a more controlled manner and in a format this is totally adaptable with CSS?

    PS: Sorry to be so negative; love the whole ASP.NET thing, just frustrates me so ...

  • Hi Martin,

    >>>>>> When will we see an update to the base server controls, or alternatively a new set of officially supported adapters, that will enable us to render the controls in a more controlled manner and in a format this is totally adaptable with CSS?

    This is something we are looking to enable for existing controls in the future. One of the new controls in the .NET 3.5 timeframe that you'll want to check out (and which I'll blog a lot more about soon) is the ListView control - which provides total control over the markup rendered, and works very well with CSS scenarios.

    Hope this helps,

    Scott

  • Scott,

    Downloaded B2. It is greatness. One question though, is the new CSS tools designed to work with Themes? I have simply declared a Theme at the page level and the VS does not appear to pickup the styles I have set from this theme. Thanks!

  • simly superb features which will definitely help the developer to develop the application with great spead and access

  • To answer the questions about app themes, I've been fiddling with this for a few hours. As long as you use the styleSheetTheme attribute (not 'theme'!) the CSS windows work as Scott describes. For some reason, though, CSS intellisense does not seem to pick up theme-defined classes. Unless I'm doing something wrong...

  • Scott,

    We have a scenario where we dynamically attach CSS stylesheets to our web pages during execution. The stylesheets themselves are served as a WebResource from an external assembly. Is there any way to give the designer some hints to enable CSS intellisense by telling it to include some external CSS files, similar to how the JavaScript intellisense works?

  • Hi Jeremy,

    >>>>>> We have a scenario where we dynamically attach CSS stylesheets to our web pages during execution. The stylesheets themselves are served as a WebResource from an external assembly. Is there any way to give the designer some hints to enable CSS intellisense by telling it to include some external CSS files, similar to how the JavaScript intellisense works?

    I checked with the team, and unfortunately there is no obvious way to-do this today. :-(

    Sorry!

    Scott

  • It is true. Expression Web has really been integrated into VS2008, cool!
    Nice article, good job :)

  • Looks like it may be able to step up to Dreamweaver for CSS development. Simple things that are missing from VS2005 regarding CSS means many of us designers stuck with Dreamweaver while working on .NET projects.

  • >>>Good, I see a few elements from SharePoint designer moving over here.

    >>>Why don't we integrate SPD and VS200(*) ?

    >>>SM

    Would be nice if Sharepoint Designer(*cough Frontpage) was more friendly to work with.... then again would make sense also if each site in site collection in sharepoint didn't have it's own masterpage too unless specified as an option. If the workflows created in sharepoint designer could be reused in future applications, then that would make more sense, but why even enable the support for workflows in SPD if I can't reuse them?

    I vote to get rid of all the different designers and integrate them to one. I would still agree to keep InfoPath though b/c of what it does, but would be nice if the same features could be reused in a single designer(granted I don't know the complexities behind the scenes). Please?

    Thx to MS for adding in the web designer support in VS. Keep up the good work.

    Joseph

  • When will the vwd08 express would be available and can we migrate it into vwd05

  • If VS 2008 has all the functionality of Expression Web Design, why do we need Expression at all?

  • I downloaded vwd express and noticed it doesn't support dwt's. Will that be supported later?

  • Hi Mike,

    >>>>> When will the vwd08 express would be available and can we migrate it into vwd05

    VWD2008 Beta2 is actually available now. I linked to the download on my blog post here: http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx

    Hope this helps,

    Scott

  • Hi Vaughn,

    >>>>> I downloaded vwd express and noticed it doesn't support dwt's. Will that be supported later?

    Unfortunately I don't think dwt's will be supported in this release.

    Sorry!

    Scott

  • No .DWTs? No big loss. Someone just needs to make an Add-In that converts .DWTs into Master Pages. Oh, and while we’re at it, converts Dreamweaver’s horrible ASP.NET 1.x data access code (DreamweaverCtrls.dll MM_DataSets and DataGrids) into proper ASP.NET 2.0/3.5 DataSources and GridViews and the like.

    Imagine: a full DW ASP.NET 1.x Template-based site &rArr; VSWD2008 ASP.NET 3.5 migration utility! It should be quite feasible to do, and the first developer to do it will make a justly-deserved fortune!

  • Hi Scott,

    I noticed in B2 if my CSS files are in a Theme which is applied through the web.config when the Manage Styles tool window is open it does not indicate any stylesheets are attached to the page. During runtime however, this page would have the stylesheet attached.

    It would be helpful if the Styles Editor scanned the web.config, them folder, and local elements to determine all the styles that would be attached to a particular page.

    This is also true of the Design view which does not show the styles that would be applied from the theme.

    Thanks,
    Chris

  • finally... the previous HTML designer was a serious problem for develop good looking ASP.NET applications...

  • Hi Scott,
    Great features and user friendly.

    Thanks for you update.
    Pradeep

Comments have been disabled for this content.