468,133 Members | 1,187 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Styles - general question

What's the generally accepted approach for using Styles and Stylesheets in a
web application based on .aspx files, Web Controls, User Controls, and
code-behind modules (c# in my case)? Most style and stylesheet guides on the
internet seem to be based on web sites (rather than applications) based on
relatively static textual information.

I have read that external stylesheet files are the way to go, but it seems
to me that these only lend themselves to defining "generic" styles shared by
all your pages, whereas page-specific settings (such as the position of each
item on the page) are most easily embedded directly into your .aspx pages as
in-line styles - but then you lose all the benefits of true separation
right? (maintainability, scalability, accessibility, etc).

It seems to me too cumbersome to separate such positioning of individual
items into page-specific stylesheet files - I'd have to define one class per
page control and then link the control to the class, correct?

Are there any guidelines available on this ? Could anyone point me in the
right direction ?


Nov 18 '05 #1
3 1275
This is just a general guideline (style separation) but in this particular
case, you won't loose that much IMO as changing the position of a control
would be anyway a change for just a single control (even if the style is an
external style sheet) opposed to a change of style that could apply to most
of the pages. AFAIK ASP.NET stores the position at the control level in
gridlayout mode.

What count IMO is the *usage* you'll have for the style. For example if a
position is used in a single page for a single control, its likely best tied
to this control. If a position is shared by multiple controls on various
pages, it could go into an external style sheet.

As a side note my personal preference is not to use absolute positionning
unless stricly needed...

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
What's the generally accepted approach for using Styles and Stylesheets in a web application based on .aspx files, Web Controls, User Controls, and
code-behind modules (c# in my case)? Most style and stylesheet guides on the internet seem to be based on web sites (rather than applications) based on
relatively static textual information.

I have read that external stylesheet files are the way to go, but it seems
to me that these only lend themselves to defining "generic" styles shared by all your pages, whereas page-specific settings (such as the position of each item on the page) are most easily embedded directly into your .aspx pages as in-line styles - but then you lose all the benefits of true separation
right? (maintainability, scalability, accessibility, etc).

It seems to me too cumbersome to separate such positioning of individual
items into page-specific stylesheet files - I'd have to define one class per page control and then link the control to the class, correct?

Are there any guidelines available on this ? Could anyone point me in the
right direction ?

Nov 18 '05 #2
I can only tell what approach do I use.

I have a general default.css on my app root. This file defines:
- general styles for HTML elements (like BODY, TD, A, etc. tags)
- style classes for controls that use the same layout (like .generalForm,
..textTitle, .subTitle etc.) with child tag/class definitions for automatic
style formatting within those controls

all styles that are like Web User Control specific are written within
controls ascx file. Maintainability in this case is not a problem, while
only that control uses some special style.

But if you really make a very well defined UI design layout you will
probably rarely find a usercontrol that should use specific styles.

On general html tag classes define just the general things like font, color,
etc. and then override or "add" other styles with style classes with child
dependence... So far I've never heard about any complaint regarding
maintainability of any of my colleges in development department.

--
RobertK
{ Clever? No just smart. }
"JezB" <je**@somewhere.com> wrote in message
news:#Q**************@tk2msftngp13.phx.gbl...
What's the generally accepted approach for using Styles and Stylesheets in a web application based on .aspx files, Web Controls, User Controls, and
code-behind modules (c# in my case)? Most style and stylesheet guides on the internet seem to be based on web sites (rather than applications) based on
relatively static textual information.

I have read that external stylesheet files are the way to go, but it seems
to me that these only lend themselves to defining "generic" styles shared by all your pages, whereas page-specific settings (such as the position of each item on the page) are most easily embedded directly into your .aspx pages as in-line styles - but then you lose all the benefits of true separation
right? (maintainability, scalability, accessibility, etc).

It seems to me too cumbersome to separate such positioning of individual
items into page-specific stylesheet files - I'd have to define one class per page control and then link the control to the class, correct?

Are there any guidelines available on this ? Could anyone point me in the
right direction ?

Nov 18 '05 #3
Thanks group, this was what I was after. Although I understood the
possibilities it was difficult for me to see what would work best in
practice, not having ever built a real-world ASP.NET application.

"JezB" <je**@somewhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
What's the generally accepted approach for using Styles and Stylesheets in a web application based on .aspx files, Web Controls, User Controls, and
code-behind modules (c# in my case)? Most style and stylesheet guides on the internet seem to be based on web sites (rather than applications) based on
relatively static textual information.

I have read that external stylesheet files are the way to go, but it seems
to me that these only lend themselves to defining "generic" styles shared by all your pages, whereas page-specific settings (such as the position of each item on the page) are most easily embedded directly into your .aspx pages as in-line styles - but then you lose all the benefits of true separation
right? (maintainability, scalability, accessibility, etc).

It seems to me too cumbersome to separate such positioning of individual
items into page-specific stylesheet files - I'd have to define one class per page control and then link the control to the class, correct?

Are there any guidelines available on this ? Could anyone point me in the
right direction ?

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Christopher Benson-Manica | last post: by
17 posts views Thread by TheKeith | last post: by
8 posts views Thread by Ryan Stewart | last post: by
12 posts views Thread by dan.vendel | last post: by
1 post views Thread by Eric Lindsay | last post: by
5 posts views Thread by Viken Karaguesian | last post: by
16 posts views Thread by Giggle Girl | last post: by
6 posts views Thread by Goofy | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.