开发者

Unable to get data in center of table column

开发者 https://www.devze.com 2022-12-09 12:56 出处:网络
I want to get the Name and Description in the center of the columns.. I tried a lot but no luck... I know this is silly doubt but I am stuck...

I want to get the Name and Description in the center of the columns.. I tried a lot but no luck... I know this is silly doubt but I am stuck...

Here is the .aspx code:

<!-- <table cellpadding="3" cellspacing="4" align="center" 
    style="width: 100%; height: 60%">
    <tr>
        <td bgcolor="#4F81BD" style="color: #FFFFFF" width="50%" align="center" >
            Name</td>
        <td bgcolor="开发者_StackOverflow社区#4F81BD" style="color: #FFFFFF" width="50%">
            Description</td>
    </tr>

as you can see I have also tried align.. it still does not work.


Try using the text-align CSS property:

<table cellpadding="3" cellspacing="4" align="center" style="width: 100%; height: 60%">
<tr>
    <td bgcolor="#4F81BD" style="color: #FFFFFF; width:50%; text-align:center">
        Name</td>
    <td bgcolor="#4F81BD" style="color: #FFFFFF; width:50%; text-align:50%">
        Description</td>
</tr>


In what way is it not working? What you have done should be displaying 'Name' centered, if not then it's possibly being affected by your css and the inline style approach SLaks has shown will fix it.

If your problem is that you want all text in those columns to be centered then try.

<table>
<col align="center" />
<col align="center" />
<tr>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号