asp.net - 使用 css 定义样式的概率

标签 asp.net css

我在设计我的 asp.net 页面时遇到了一点问题:

在我的 aspx 页面的顶部,我声明:

<head>

    <meta charset="utf-8">
    <title>CSS3 Menu - Impressionist UI - by Valeriu Timbuc for Design Modo</title>
    <link rel="stylesheet" href="css/style.css" media="screen">
    <style type="text/css">
        html, body { margin: 0; padding: 0; }
        body { margin: 5px; background: #f2f2f2 no-repeat top center; }
        ul.menu { margin: 5px auto 0 auto; }
    </style>
    <meta name="robots" content="noindex,follow" />
</head>

在某些地方我有这段代码:

<div class="rounded-corners"; style=" margin-left:50px; margin-right:50px; ">  
    <asp:GridView id="MyGridView"        
     DataSourceID="MyDataSource1" 
     AutoGenerateColumns="False" 
     GridLines="Both"
     AllowSorting="True" 
     AllowPaging="True" 
     CssClass="mGrid"
     PagerStyle-CssClass="pgr"
     AlternatingRowStyle-CssClass="alt"

     Runat="Server" PageSize="35">         

       <columns>
          <asp:boundfield datafield="FICHIER"
            readonly="true"     
            headertext="Fichier"
            ItemStyle-CssClass="CellFile">                
          </asp:boundfield>

在后者中我尝试使用 ItemStyle-CssClass="CellFile"为了定义 padding-left 和颜色。所以在我的 css 文件中我有:

/* Reset */ .menu, .menu ul, .menu li, .menu a { margin: 0; padding: 0; border: none; outline: none; padding-bottom:10px; } /* Menu */ .menu { height: 40px; width: 468px; background: #4c4e5a; background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: #4c4e5a; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } .menu li { position: relative; list-style: none; float: left; display: block; height: 26px; text-align:center; top: 3px; left: -2px; } /* Links */ .menu li a { display: block; padding: 0 14px; margin: 6px 0; line-height: 28px; text-decoration: none; border-left: 1px solid #393942; border-right: 1px solid #4f5058; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 13px; color: #f3f3f3; text-shadow: 1px 1px 1px rgba(0,0,0,.6); -webkit-transition: color .2s ease-in-out; -moz-transition: color .2s ease-in-out; -o-transition: color .2s ease-in-out; -ms-transition: color .2s ease-in-out; transition: color .2s ease-in-out; } .menu li:first-child a { border-left: none; } .menu li:last-child a{ border-right: none; } .menu li:hover > a { color: #8fde62; } /* Sub Menu */ .menu ul { position: absolute; top: 40px; left: 0; opacity: 0; background: #1f2024; -webkit-border-radius: 0 0 5px 5px; -moz-border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px; -webkit-transition: opacity .25s ease .1s; -moz-transition: opacity .25s ease .1s; -o-transition: opacity .25s ease .1s; -ms-transition: opacity .25s ease .1s; transition: opacity .25s ease .1s; } .menu li:hover > ul { opacity: 1; } .menu ul li { height: 28px; overflow: hidden; padding: 0; -webkit-transition: height .25s ease .1s; -moz-transition: height .25s ease .1s; -o-transition: height .25s ease .1s; -ms-transition: height .25s ease .1s; transition: height .25s ease .1s; top: 0px; left: 0px; width: 205px; } .menu li:hover > ul li { height: 36px; overflow: visible; padding: 0; } .menu ul li a { width: 125px; padding: 4px 0 4px 40px; margin: 0; text-align:inherit; border: none; border-bottom: 1px solid #353539; } .menu ul li:last-child a { border: none; } /* Icons */ .menu a.documents { background: url(../img/docs.png) no-repeat 0px center; width: 125px;} .menu a.messages { background: url(../img/bubble.png) no-repeat 0px center; width: 125px;} .menu a.signout { background: url(../img/arrow.png) no-repeat 0px center; width: 125px;} .mGrid { width: 100%; background-color: #fff; margin: 5px 0 10px 0; border: solid 1px #525252; border-collapse:collapse; border-radius: 0 0 5px 5px; } .mGrid td { padding: 2px; border: solid 1px #c1c1c1; color: #717171; } .mGrid th { /*padding: 4px 2px; */ color: #fff; background: #4c4e5a; background: #424242 url(../img/grd_head.png) repeat-x top; background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: #4c4e5a; font-size: 1.2em; font-variant:small-caps; text-align : left; padding-left: 15px; font-family: Cambria; } .mGrid .alt { background: #fcfcfc url(../img/grd_alt.png) repeat-x top; } .mGrid .pgr { border: 1px solid #424242; background: #424242 url(../img/grd_pgr.png) repeat-x top; } .mGrid .pgr table { margin: 5px 0; } .mGrid .pgr td { border-width: 0; padding: 0 6px; border-left: solid 1px #666; font-weight: bold; color: #fff; line-height: 12px; } .mGrid .pgr a { color: #58ae1b; text-decoration: none; background: #4c4e5a; background: #424242 url(../img/grd_head.png) repeat-x top; background: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: #4c4e5a; } .mGrid .pgr a:hover { color: #000; text-decoration: none; } .rnd1 { background-color: #f0ff00; height: 1px; } .gv1 { width: 100%; border: 0px none; } .gv1 th { background-color: #C1C4D0; } .rounded-corners { border: 1px solid #424242; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; text-decoration: none; background: #424242; background: -webkit-linear-gradient(top, #424242 0%,#2c2d33 100%); background: -moz-linear-gradient(top, #424242 0%,#2c2d33 100%); background: -o-linear-gradient(top, #424242 0%,#2c2d33 100%); background: -ms-linear-gradient(top, #424242 0%,#2c2d33 100%); background: #424242; } .CellFile { padding-left:100px; color:Aqua; }

所以当我运行时,样式将不适用,但当我删除 <head></head> 时部分风格效果很好。我是 css 和 asp.net 的新手,我想问题出在样式声明中的某个地方。我怎样才能让它发挥作用?

谢谢。

最佳答案

如果将其设为自闭合标签,会有什么不同吗?

<asp:BoundField ItemStyle-CssClass="CellFile" />

如果没有,您可能必须将其设为模板字段。

关于asp.net - 使用 css 定义样式的概率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16235741/

相关文章:

asp.net - Azure Web App不构建 typescript 文件

asp.net - 我在 ASP.NET MVC 上使用 Scripts.Render() - 更新后 6 小时用户仍然获得旧的(捆绑的)脚本文件,这是什么原因?

CSS - 使用 <div> 排列 block 以获得 metro 风格主题

javascript - 如何在angularjs中创建搜索过滤器和文本突出显示

javascript - 如何获取 JavaScript 实际使用的 CSS 值?

javascript - 为图标填充颜色

Click asp.net 母版页上的 jQuery 问题

asp.net - ASP.NET 缓存的位置

c# - 覆盖 SharePoint :SaveButton in custom form template

html - 具有多个子项的 Flex-box 列