简体   繁体   English

向GridView添加圆角?

[英]Adding rounded corners to GridView?

I want to make the corners of my GridView curvy. 我想让我的GridView角落弯曲。 I tried THIS but it it gave a border extending towards the right handside. 我尝试了这个,但它给了一个向右侧滑动的边界。 Also it would be just great if i can make each and every cell of the GridView curvy, if its not too hard to achieve. 如果我可以制作GridView曲线的每个单元格,如果它不太难实现,那将是非常好的。 This is my GridView: 这是我的GridView:

<asp:GridView  ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        onrowdatabound="GridView1_RowDataBound" BackColor="White" 
                        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" >
....something... </asp:GridView>

Here are three approaches all involving stylesheets. 以下是涉及样式表的三种方法。

.GridView1 {
-moz-border-radius: 15px;
border-radius: 15px;
}

for css 为css

or on your object 或在你的对象上

style= "-moz-border-radius: 15px;border-radius: 15px;"

or in JQuery 或者在JQuery中

$("#GridView1").css("border-radius","15px").css("-moz-border-radius","15px");

Put a CssClass="round" in GridView1 GridView1放置一个CssClass="round"

.round
{
 border: 1px solid black;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}

Hi you can try by using CSS 嗨,你可以尝试使用CSS

<div class="corners">
<asp:GridView> </asp:GridView>
</div> 

and the css 和css

.corners { border: 1px solid green; -moz-border-radius: 8px; border-radius: 8px;overflow: hidden;-webkit-border-radius: 8px;}

This is how you can add the rounded corners to the ASP.NET GridView: 这是您可以将圆角添加到ASP.NET GridView的方法:

<style>
    :root{--gv-border-radius: 7px;}
    .rcgv
    {
        border-radius: var(--gv-border-radius);
        border-width: 0 !important;
    }
    .rcgv th:first-child
    {
        border-top-left-radius: var(--gv-border-radius);
    }
    .rcgv th:last-child
    {
        border-top-right-radius: var(--gv-border-radius);
    }
    .rcgv tr:last-child td:first-child
    {
        border-bottom-left-radius: var(--gv-border-radius);
    }
    .rcgv tr:last-child td:last-child
    {
        border-bottom-right-radius: var(--gv-border-radius);
    }
</style>
<asp:GridView ID="GridView1" CssClass="rcgv" runat="server" ShowFooter="true" ></asp:GridView>

Hope this will help you adding stylish border radius to GridView. 希望这可以帮助您为GridView添加时尚的边框半径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM