[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

How do i horizontally center my Listbox

Sometimes this new asp.net interface baffles me.
My listbox seems to refuse being centered horizontally.
Tried setting the Table1.align to Center but to no avail.
Whats going on?

Ted
0
tcalbaz
Asked:
tcalbaz
1 Solution
 
vadivhereCommented:
Hi tcalbaz,

do like this

  <div id="temp" style="valign:center;">
        ...your list box
  </div>

Cheers!
0
 
hismightinessCommented:
There are various ways to do this...  one is above.  If your control is contained within a table, it is most like part of a cell.  Therefore another way to do it is to set the attribute of the TD tag:

<table>
     <tr>
          <td align="center">...YOUR CONTROL HERE...</td>
     </tr>
</table>

Also, if you are using stylesheets and want to have this as a "global" default or use it in a style class:

TD{
     text-align: center;
}

.tdCenter{
     text-align: center;
}

In the example having a class, it would be used like so:

<table>
     <tr>
          <td class="tdCenter">...YOUR CONTROL HERE...</td>
     </tr>
</table>
0
 
tcalbazAuthor Commented:
vadivhere

Bingo!
That did it!
Thank you so much.

Ted
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now