How to convert this from table tag to div tag

I have a very simple table that I would like to convert to a div for an example. I had no luck with that.

Here is my page: http://jsbin.com/equfo

Basically, I want to convert it to a div because I'm tired of having tables like this where I want the button to appear in the middle of the table. but since I am using tags. the middle is never in the middle of a TABLE, but instead is the middle of a TD tag.

+1


a source to share


3 answers


You just need a <TD colspan="2">

button and it will be in the center of the table. If you have more columns in your table, increase the number of columns accordingly.

To display this with DIVs;



<div class="searchTable">
  <span>Enter SSN</span>
  <div class="odd">
     <span class="label">Enter Social Security <u>N</u>umber</b></span>
     <input type="text" id="SearchFormerTenant_ssn1"/>-
     <input type="text" id="SearchFormerTenant_ssn1"/>-
     <input type="text" id="SearchFormerTenant_ssn1"/>
  </div>
  <div class="even" style="width: 100%; text-align:center;">
    <input type="submit" id="SearchFormerTenant_0" value="Get Information"/>
  </div>
</div>

      

+2


a source


Are you looking to fix this particular issue or learn CSS positioning?

If you just need a quick fix, Dave hit a nail on the head. If you want to learn more, you can do worse than start with these tutorials:

http://www.barelyfitz.com/screencast/html-training/css/positioning/

http://www.brainjar.com/css/positioning/

On the interpipes, they look more like them. And there are those specifically for creating layouts:



http://www.webcredible.co.uk/user-friendly-resources/css/css-forms.shtml

http://designshack.co.uk/articles/10-css-form-examples

It's not that hard, but there's more to it than can be easily described here.

Hope it helps.

+2


a source


While this is more suitable for divs, a simple alternative would be to move the button out of the table and just align with the text: center on it in its own div.

+1


a source







All Articles