ASP.NET Mobile StyleSheet Control[转]
Definition and Usage
定义和用法
The StyleSheet control defines styles to apply to other controls.
样式表控件的作用是:为控件定义样式。
The StyleSheet control can contain any number of <Style> elements. Each Style element must have a unique name. The name may be used to refer to each Style element from other controls on the same page.
样式表控件可能包含所有的<Style>元素。每个元素必须拥有一个独立的名称。该名称可用于来自同一页面上其它控件的样式元素。
A mobile page can also use an external style sheet. To create an external style sheet, you create a user control and a StyleSheet control in an .ascx file. To refer to this file, you add a StyleSheet control on a page and set its ReferencePath property to the URL of the .ascx file.
一个移动页面可以使用一张外部样式表。你可以在 .aspx 文件中创建用户控件和样式表控件,从而建立外部样式表。你可以在页面上添加样式表控件,并设置其ReferencePath属性的URL为 .ascx 的路径,从而导入外部样式表。
Properties
属性
| Property 属性 |
Value 值 |
Description 描述 |
|---|---|---|
| id | unique_name | Optional. A unique id for the control 可选参数。为控件指定一个独立的id |
| ReferencePath | URL | Optional. Specifies a relative path to an .ascx file that contains a set of style elements 可选参数。指定一个包含一组样式表元素的 .ascx 文件的相对路径 |
| runat | "server" | Required. Specifies that the control is a server control 必要参数。指定该控件为服务器控件 |
Example 1
案例1
The following example is an .aspx page with two labels in a form. Each label has a reference to an internal style. The text in the first label will be displayed in bold and the text in the second label will be displayed in red:
下面这个案例是一个在一张表单内包含两个标签的 .aspx 页面。每个标签都有一个连接到内部样式的参数。第一个标签的文本字体将以粗体形式显示,第二个标签的文本字体将以红色显示:
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"%> <Mobile:StyleSheet runat="server"> <Mobile:Form id="f1" runat="server"> |
浙公网安备 33010602011771号