0

我对我的 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"in irder 来定义 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 的新手,我猜这个问题在样式声明中的某个地方。我怎样才能让它工作?

谢谢你。

4

1 回答 1

1

如果您将其设为自动关闭标签,是否会有所不同?

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

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

于 2013-04-26T12:16:07.353 回答