is StyleSheetTheme overruled by CSS styles?

B

Bob

Hi,

i'm testing the order of application when it comes to styling with skin and
CSS files and i come to contradiction between what i get and what i read
about theme and CSS.
I wrote that StylesheetTheme will be overruled by everything else (CSS,
element styles and theme), but it's not the case in my example..

the red.css contains this:

..red
{
color:Red;
}

1) the aspx file:
--------------
<head runat="server">
<link href="App_Themes/mytheme/red.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" CssClass="red"
Text="Label"></asp:Label>
</form>
</body>

This works: 'label' is red.



2) Now with StyleSheetTheme:

In directory 'mytheme' there is a file green.skin which contains:
<asp:Label SkinID="lightgreen" runat="server" Text="label"
ForeColor="lightgreen" ></asp:Label>
<asp:Label runat="server" Text="label" ForeColor="green" ></asp:Label>

The aspx file:
------------
<%@ Page Language="VB" StylesheetTheme="mytheme" AutoEventWireup="false"
CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<head runat="server"></head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" CssClass="red"
Text="Label"></asp:Label>
</form>
</body>

Now i expect that 'label' is red, but no: 'label' is green

Do i do sometyhing wrong or is the StyleSheetTheme not overruled by CSS?

Thanks
Bob
 
G

Guest

Hi,

Style-related control properties, theme and stylesheet theme settings are
rendered as inline styles using the style attribute of HTML elements. And the
CssClass property is rendered using the class attibute. Between class and
style, style takes priority.

Given this, the skin setting with green label color (the one without skin
ID) takes precedence over the CSS class "red" because the green skin is
applied using style attribute.

The order of precedence is: (1) Theme (2) Inline control settings (3)
Stylesheet Theme

Hope this clarifies?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top