Theme and stylesheettheme set ASP. NET styles and themes

Source: Internet
Author: User

ASP. NETCompared with static websites, the created dynamic website simply addsCodeDynamically generated content. The code running on the server includes the background code in the code page and controls on the foreground page.

Static webpage styles are also suitable for static content of dynamic webpages.

I,Style

1,
In-row style (inHtmlInternal element, usingStyleDefine style directly)

 
<Head runat = "server"> <title> Asp. net style </title>  

2,
Internal style (on the webpage<Head>Tag, useStyleLabel definition style)

 
<Head id = "head1" runat = "server"> <title> Asp. net style </title> <style type = "text/CSS"> P {background-color: # ff7f00 ;} </style>  

3,
External style (define the style in another style sheet file)

(1) External style table file:

(2) PassLinkLabel import style sheet

 
<HTML xmlns = "http://www.w3.org/1999/xhtml">  

 

Obviously, the priority of these three styles is: Intra-row styles> internal styles> external styles.

BecauseASP. NETCompared with controls compiled and run on multiple servers on static Web pages, style sheets often fail to control the style of controls.

Ii. Appearance

You can set the appearance of a widget directly or in an external appearance file.

The appearance file is usually stored in the topic folder together with the style and appearance file.ASP. NET. That is to say,ASP. NETThe topic mainly includes the style sheet, appearance file, and image.

The introduced topic is generally not used.LinkLabel, but usePagePageThemeOrStylesheetthemeAttribute.

Note that the labelHeadMust haveRunat = "ServerAttribute. Otherwise, an error occurs:

1,
Create appearance File

2. Use theme to set a topic

 
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default4.aspx. cs" inherits = "default4" theme = "mytheme" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">  

 

3. Use stylesheettheme to set a topic

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default4.aspx. cs" inherits = "default4" stylesheettheme = "mytheme" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">  

 

It is not hard to see,ThemeAndStylesheetthemeThe main difference is the priority. Compared with the appearance attribute in the row, the priority of the three is:Theme> In-row appearance>StylesheetthemeIn other words, useStylesheetthemeSet the topic. The displayed appearance is green in the line.ThemeIn-line appearance is rewritten, and the blue color in the appearance file is displayed.

For static webpage content, useThem,StylesheetthemeWhen setting a topic, the priority is:

Intra-row style>ThemeSet external styles> internal styles>StylesheetthemeSet external styles

4,Web. configSet the topic in the file

You canWeb. configFileSystem. WebThe topic of the entire website is set in the following format:

<Pages theme = "mytheme"/>

Or

<Pages stylesheettheme = "mytheme"/>

5A webpage does not use a topic.

If a webpage uses a separate subject, you can set it on the webpage separately.ThemeAttribute. If a webpage does not use a topic, you can use either of the following methods:

Theme = ""OrStylesheettheme = ""(Note that the quotation marks cannot contain spaces.);

Enabletheming = "false"

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.