VS2008中普通网页引入母版页后,如何再引用CSS文件?

html-css010

VS2008中普通网页引入母版页后,如何再引用CSS文件?,第1张

母版页中的设置:

<head runat="server">

<meta name="keywords" content="" />

<meta http-equiv="charset" content="gb2312" />

<link href="~/MyCss.css" rel="stylesheet" type="text/css"/>

<asp:ContentPlaceHolder ID="head" runat="server">

</asp:ContentPlaceHolder>

</head>

在母版中的<head>标签中留下一个位置,这样在其它引用母版页的网页中的这个位置上就可以加入单独的代码了

aspx网页上:

<%@ Page Title="" Language="C#" MasterPageFile="~/xxx.Master" AutoEventWireup="true" CodeBehind="abc.aspx.cs" Inherits="xxx.abc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<title>用户评论</title>

<link href="~/AnotherCss.css" rel="stylesheet" type="text/css"/>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

这样~ 在xxx.aspx页面上就可以单独写<head>标签中的代码了,包括引入css的代码

用css设置textarea代码如下:

<textarea style="width:200pxheight:100pxborder:solid 1px #f00border-radius:20pxresize:none"></textarea>

border-radius:20px;

resize:none

1.overflow内容溢出时的设置(设定被设定对象是否显示滚动条)

overflow-x水平方向内容溢出时的设置

overflow-y垂直方向内容溢出时的设置

以上三个属性设置的值为visible(默认值)、scroll、hidden、auto。

2.scrollbar-3d-light-color立体滚动条亮边的颜色(设置滚动条的颜色)

scrollbar-arrow-color上下按钮上三角箭头的颜色

scrollbar-base-color滚动条的基本颜色

scrollbar-dark-shadow-color立体滚动条强阴影的颜色

scrollbar-face-color立体滚动条凸出部分的颜色

scrollbar-highlight-color滚动条空白部分的颜色

scrollbar-shadow-color立体滚动条阴影的颜色

我们通过几个实例来讲解上述的样式属性:

1.让浏览器窗口永远都不出现滚动条

没有水平滚动条

<body style= "overflow-x:hidden ">

没有垂直滚动条

<body style= "overflow-y:hidden ">

没有滚动条

<body style= "overflow-x:hiddenoverflow-y:hidden ">或 <body

style= "overflow:hidden ">

2.设定多行文本框的滚动条

没有水平滚动条

<textarea style= "overflow-x:hidden "></textarea>

没有垂直滚动条

<textarea style= "overflow-y:hidden "></textarea>

没有滚动条

<textarea style= "overflow-x:hiddenoverflow-y:hidden "></textarea>

或 <textarea style= "overflow:hidden "></textarea>

3.设定窗口滚动条的颜色

设置窗口滚动条的颜色为红色 <body style= "scrollbar-base-color:red ">

scrollbar-base-color设定的是基本色,一般情况下只需要设置这一个属性就可以达到改变滚动条颜色的目的。

加上一点特别的效果:

<body style= "scrollbar-arrow-color:yellowscrollbar-base-color:lightsalmon ">

4.在样式表文件中定义好一个类,调用样式表。

<style>

.coolscrollbar{scrollbar-arrow-color:yellowscrollbar-base-color:lightsalmon}

</style>

这样调用:

<textarea class= "coolscrollbar "></textarea>

因为你使用了母板页,所以每个页都是应用母板页的基础上加载的,所以如果你想要再样式,那么,你可以这样做:

<link href="CSS/css.css" rel="stylesheet" type="text/css" />

<div class="conmiddle">

<asp:Repeater ID="rptCourse" runat="server">

<ItemTemplate>

<%# Eval("AtContent") %>

</ItemTemplate>

</asp:Repeater>

</div>

把布局和样式写在一起也是可以的,但要注意,此时母板页的样式还是加载到的,你需要做的是处理好二个样式表不要冲突,有什么问题可以和我联系