c# - 使用主页时在网页上设置背景图片

标签 c# asp.net html master-pages

当网页基于母版页时,是否可以在网页上设置背景图片。请注意,我要更改的不是母版页的背景,而是使用母版页的页面的背景。

最佳答案

您可以只为 body{} 或实际 ASPX 页面上的任何内容添加样式规则。它将覆盖在母版页级别设置的任何样式。

编辑:示例:

<%@ Page Title="Example" Language="C#" MasterPageFile="~/MasterPages/Main.master" 
    AutoEventWireup="true" CodeBehind="TroubleShootScanning.aspx.cs" 
    Inherits="SpectrumTechnologies.TroubleShootingScanning" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" runat="server">
    <style type='text/css'>
        body { background-image: url(images/bgimage.jpg); }
    </style>
    <!-- the rest of the page here -->
</asp:Content>

这将覆盖样式表中设置的任何值。

关于c# - 使用主页时在网页上设置背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1343143/

相关文章:

c# - ASP.NET MVC 中的动态 LINQ 分组查询

c# - Visual Studio 没有生成代码来实例化自定义控件的实例

c# - 通过 INotifyPropertyChanged 写入 TextBox 无效

C# - StringDictionary - 如何使用单个循环获取键和值?

c# - 通过自连接更新 List<T>?

javascript - 我应该在删除 DOM 元素后调用 jQuery.off 吗?

asp.net - 如何取消上传

c# - 在 ASP 中使用 foreach 与 ASP.NET View 引擎 : Repeater is not working

html - CSS 选择器 "(A or B) and C"?

php - Wordpress Customizer 隐藏自定义部分?