易截截图软件、单文件、免安装、纯绿色、仅160KB

内容页嵌套母版页时,内容页如何调用css和javascript

当在做项目时,通常我们会大量的使用母版页,使用母版页的好处显而易见,但通常在内容页中嵌套母版页时,我们还要在内容页中调用css样式和 javascript函数,好处有了,问题也来了。有两种解决方法,第一种就是在母版页的头部<head></head>标记中,嵌入所有css样式和javascript函数,这样做使得母版页的内容非常庞大,如果其中的一些内容页并不需要其中的css样式和js函数,在页面加载时,还是会去从母版页中加载,所以这种方案虽然可行,但并不完美。方案二:就是在母版页的头部<head></head>标记中放入<asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder>控件,在内容页中再添加一个< asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">控件,ID属性设为<asp:ContentPlaceHolder>的ID值。这样就可以在内容页中嵌入css样式和js函数了。下面是代码,我的开发环境是Microsoft Visual Studio 2008.
  母版页代码:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="indexPage.master.cs" 
Inherits="indexPage" %> <%@ Register Assembly="AjaxControlToolkit" 
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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"><head id="Head1" runat="server"> 
 <title>Home Page</title>  <%--此处放入ContentPlaceHolder控件 --%>  
 <asp:ContentPlaceHolder id="head" runat="server">  </asp:ContentPlaceHolder>  
 <meta http-equiv="content-type" content="text/html;charset=utf-8" /></head>
  内容页代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/indexPage.master" 
AutoEventWireup="true" CodeFile="companiesTest.aspx.cs"
 Inherits="companiesTest" %><asp:Content ID="Content1" 
ContentPlaceHolderID="head" Runat="Server">
<%-- Content控件内,放入要调用的css样式和js函数--%>  
 <link href="css/uses.css" rel="stylesheet" type="text/css" /


相关文档:

CSS和JS标签style属性对照表


盒子标签和属性对照
CSS语法(不区分大小写)
JavaScript语法(区分大小写)
border
border
border-bottom
borderBottom
border-bottom-color
borderBottomColor
border-bottom-style
borderBottomStyle
border-bottom-width
borderBottomWidth
border-color
borderColor
border-left
borderLeft
border ......

没想到的、不常用的三个css属性!

作者:tinyhill 来自:蓝色理想 对 《5 个简单实用的 CSS 属性》进行编辑
1、CSS Clip
剪辑 (clip) 属性就像一个面具。它允许你使用矩形掩盖页面元素的内容。要剪辑一个元素:你必须指定其 position 属性为 absolute,然后指定相对于元素的 top,right,bottom,left 值。
图片剪辑实例(演示)
以下示例演示了如 ......

有利于SEO的DIV+CSS的命名规则收集

一、CSS文件及样式命名
1、CSS文件命名规范
全局样式:global.css;
框架布局:layout.css;
字体样式:font.css;
链接样式:link.css;
打印样式:print.css;
2、CSS样式命名规范
本人建议:用字母、_号工、-号、数字组成,必须以字母开头,不能为纯数字。为了开发后样式名管理方便,大家请用有意义的单 ......

firefox与IE对javascript和CSS的区别

1. document.formName.item("itemName") 问题
说明:IE下,可以使用document.formName.item("itemName")或document.formName.elements["elementName"];
Firefox下,只能使用document.formName.elements["elementName"].
解决方法:统一使用document.formName.elements["elementName"].
2.集合类对象问题
说明:IE下,可 ......

用css设置的TABLE边框格式代码

TABLE{
BORDER-RIGHT: #888 1px solid;
BORDER-TOP: #888 1px solid;
MARGIN-TOP: 10px;
BORDER-LEFT: #888 1px solid;
WIDTH: 100%;
BORDER-BOTTOM: #888 1px solid;
FONT-FAMILY: Arial, Helvetica, sans-serif;
BORDER-COLLAPSE: collapse;
}
TABLE PRE {
BORDER-TOP-WIDTH: 0px;
PADDING-RIGHT: 0px;
PA ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号