ASP.NET Web表单:母版页和CSS文件 [英] ASP.NET Web Forms: Master Page & CSS File

查看:288
本文介绍了ASP.NET Web表单:母版页和CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要使用Web窗体实现的项目(Web应用程序).我已经为网站准备了设计,并且将使用已经开发的CSS模板之一.在这种情况下:

I have a project (Web Application) that I need to implement with Web Forms. I have already prepared the design for the website and I will use one of the CSS templates that I already developed. In this case:

  1. 我应该使用母版页吗?
  2. 母版页和CSS文件之间是否存在任何关系?如果是,我应该如何使用CSS文件定义母版页?

顺便说一下,CSS文件是一个现成的模板.

By the way, the CSS file is a ready template.

推荐答案

  1. 我会高度推荐使用母版页.它使您能够在所有页面上保持一致的外观.另外,如果您决定更改布局,则只需更改一个文件即可!

  1. I would highly recommend using a master page. It gives you the ability to have one consistent look across all your pages. Also if you decide to change the layout your only changing one file!

仅在母版页中引用CSS文件,它将应用于使用母版页的每个页面.类似于<link href="~/styles/Style.css" rel="stylesheet" type="text/css" />

Simply reference the CSS file in your master page and it will be applied to every page the master page is used on. Something like <link href="~/styles/Style.css" rel="stylesheet" type="text/css" />

应注意,您也可以拥有一个以上的母版页. Visual Studio还允许您创建页面并选择母版页,这是添加项目时的其他选项之一.

It should be noted that you can also have more then one master page. Visual studio also allows you to create pages and select the master page, it's one of the other options when adding an item.

这篇关于ASP.NET Web表单:母版页和CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆