Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用css旋转GridView标题_Css_Asp.net_Gridview - Fatal编程技术网

使用css旋转GridView标题

使用css旋转GridView标题,css,asp.net,gridview,Css,Asp.net,Gridview,我需要在GridView中旋转标题。我搜索了网站,找到了一些信息。然而,我没有弄清楚如何正确地展示它。我可以旋转标题文本,但它显示在项目行上。有人能告诉我怎么修吗 我的输出: CSS代码如下: th.test, .test th { font-size: 11px; font-weight: bold; background-color: greenyellow; padding: 5px; text-transform: none; text

我需要在GridView中旋转标题。我搜索了网站,找到了一些信息。然而,我没有弄清楚如何正确地展示它。我可以旋转标题文本,但它显示在项目行上。有人能告诉我怎么修吗

我的输出:

CSS代码如下:

 th.test, .test th {
    font-size: 11px;
    font-weight: bold;
    background-color: greenyellow;
    padding: 5px;
    text-transform: none;
    text-align: left;
    transform: 
    translate(25px, 51px)
    rotate(315deg);
    width: 30px;
}

您可以尝试使用此示例代码旋转标题

HTML

<table>
 <thead>
  <tr>
   <th>Name</th>
   <th>John</th>
   <th>Alex</th>
   <th>Rose</th>
   <th>Tim</th>
  </tr>
</thead>
<tbody>
 <tr>
  <td>values</td>
  <td>xxx</td>
  <td>yyy</td>
  <td>zzz</td>
  <td>xxx</td>
</tr>

.垂直文本
{
写入方式:tb-rl;
过滤器:flipv-fliph;
}

如果您喜欢rotate(),您可以尝试编写模式示例来测试和使用,然后有一个技巧:variante
table {
 margin-top: 100px;
      }
th {
background-color: green;
transform: rotate(-45deg);
transform-origin: 0 0 0;
text-align: left;
text-indent: 10px;
   }
td {
border: 1px solid black;
   }
<style>
        .verticaltext
        {
            writing-mode: tb-rl;
            filter: flipv fliph;
        }
    </style>

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
         GridLines="Both" DataKeyNames="ProductID">
        <Columns>
       <asp:BoundField DataField="ProductID" HeaderText="Product ID" SortExpression="ProductID">
       </asp:BoundField>
       <asp:BoundField DataField="ProductName" HeaderText="Product Name" SortExpression="ProductName" HeaderStyle-CssClass="verticaltext">
       </asp:BoundField>
       <asp:BoundField DataField="SupplierID" HeaderText="Supplier ID" SortExpression="SupplierID" HeaderStyle-CssClass="verticaltext">
       </asp:BoundField>
    </Columns>
    </asp:GridView>