5

in HTML if I write <td></td> it is an empty column. how can I specify how much space it will take? I want an empty column like that to take more space than its default..the goal is I want to have two text boxes in the same row of my page like this: TextBox1 somespace TextBox2 and for "somespace" I thought maybe I can use that <td></td> but it does not have enough spacing...so if you also have a better idea for how I can reach my main goal that would be cool. thanks.

1
  • You don't realy need an extra table cell to do that. You can solve it quick and dirty by adding some spaces between your textboxes like so: &nbsp;&nbsp;&nbsp;&nbsp;. Or if you want to keep it cleaner. You could add some margin to your first textbox by adding this attribute to your input element: style="margin:0 20px 0 0;" Commented Jun 20, 2011 at 15:33

4 Answers 4

5

Use a CSS style:

td { width:42px; height:42px; }

Though, on reading your question it seems I would have to encourage you not to implement this to achieve what you desire. Instead, style the textbox controls to use a margin:

input[type="text"] { margin:12px; }

There is the possibility of separating space-wise using non-breaking white-space (&nbsp;), but I would discourage this, too, as it would be being used in the mark-up structure as a means of layout and design, when this should be dictated by abstracted styling.

Sign up to request clarification or add additional context in comments.

1 Comment

But it has one very serious flaw: the margin also applies to the FIRST column, rendering its left side no longer in alignment. Trying to fix this could make the code quite complicated and difficult to read.
2

put a margin on your textboxes that is the space you want to be between them

have a look here, you can play with the margin to decide how much space you need

http://jsfiddle.net/tzUph/

Comments

1

Place a div inside the td and set the width on the div style. I found that simply setting width on td doesnt work

Comments

0

You can use CSS to target the <td> and specify a width parameter.

td { 
   width:20px; 
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.