Question

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="#4F81BD" style="color: #FFFFFF" width="50%">
            Description</td>
    </tr>

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

Was it helpful?

Solution

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>

OTHER TIPS

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top