스타일/테마를 지연시키는 ASP.NET 웹 사이트를 어떻게 설계 할 수 있습니까?

StackOverflow https://stackoverflow.com/questions/135412

문제

인트라넷 웹 사이트를위한 프로토 타입을 구축해야하며 유용성 (레이아웃, 항해 가능성 등)에 중점을두고 나중에 테마를 남겨두고 싶습니다.

ASP.NET의 테마를 즉시 전환 할 수있는 기능에 대해 알고 있지만 나중에 쉽게 웹 포름을 설계해야합니까?

  • 미래의 CSS에 존재할 무언가를 가리키는 클래스 속성으로 컨트롤을 만들어야합니까?
  • 아니면 이것에 대해 걱정하지 않고 단순히 컨트롤을 만들고 테마를 만들 때 쉽게 처리 될 수 있습니까?
도움이 되었습니까?

해결책

If you're planning on using ASP.NET Themes, then you can design all of the controls generically and add Skins later on. Depending on the complexity of the design (meaning how many different styles you have for textboxes or gridviews, etc), this might not save you a lot of work, but it's one way to use the built-in .Net support for theming.

Make sure you use a MasterPage so that all of your sub pages will have a common base, and give all of your elements good IDs, because you will still need to get your hands dirty with CSS to put it all together.

Here's a link to a decent Themes & Skins tutorial. Knowing what you'll have to do in the future to add this in will make it easier to design for it now.

다른 팁

I'd like to make the argument for ignoring themes altogether and using nothing but CSS. It's never been clear to me what value themes add; it's a very Microsoft-specific approach, and its output isn't always standards-compliant. By using CSS you will widen the pool of potential designers able to work on your project, and you will have a better chance of having a cross-browser and standards-compliant site.

If someone else is going to be styling this later, I'd just make sure that you provide enough "hooks" for them to be able to design this. This means adding CSS classes to pretty much everything you do that will be styled similarly, and wrapping things in divs or spans with CSS classes where appropriate, for example

     <div class="ButtonContainer">
       <asp:linkbutton runat="Server" cssclass="Button Cancel" command="Save" text="Save" />
       <asp:linkbutton runat="Server" cssclass="Button Save" command="Cancel" text="Cancel" />
     </div>

If you don't have a solid understanding of CSS and you don't have in-house naming conventions or standard style sheets, though, you won't really know how to structure your divs and classes. In our shop, the way we handle this is the programmer just writes standard ASP.NET markup, and the designer goes through and adds divs, spans, and class names that work with the style sheet they will develop.

Skins are probably the answer, but something about that irks me (maybe because I don't like being that vendor specific and I'd like my skills to be applicable to other web languages and platforms than .NET). I prefer to use CssClass attributes on all of my ASP.Net controls and carefully class everything else and to use as much semantic markup as possible. Then, when I get the controls set up and working, I use CSS to style everything (although I usually have to tweak the HTML and JavaScript stuff at this point).

Another developer I work with prefers to do everything the Microsoft way with Skins and page directives and so on. It's probably the best way to do it, but it feels to me like it's mixing too much of the presentation into the middle and back-end of the application.

just wrap your controls in divs. will make layout/style much easier in the end

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top