1
<table>  
<tr>
<td></td>
<td></td>
</tr>
</table>

How do i replicate this kind of a structure using <div> or <span>'ed CSS

7
  • 3
    Why would you want to? If you're displaying tabular data, use a table. Commented Nov 16, 2010 at 10:34
  • I believe, that you cannot. The only thing you can is to put 2 divs near. <div style="float:left"</div><div></div> Commented Nov 16, 2010 at 10:35
  • 2
    Without knowing more about what type of information you want to display, it is difficult to recommend anything. Please provide more context. Commented Nov 16, 2010 at 10:35
  • I've had really turbulent times with tables, hence. Commented Nov 16, 2010 at 10:36
  • @Sussagittikasusa - that's not an response that helps us give you a good answer. Commented Nov 16, 2010 at 10:39

2 Answers 2

2

Depends on what you're trying to replicate.

With the simple example you've given, it's not easy to tell exactly what you're trying to achieve, but if what you're tring to do is put two blocks side by side (ie as columns in a page layout), you just need to create a couple of <div> elements and style them using CSS to appear next to each other. Depending on exactly what you want, there are a number of ways you could do the stylesheets.

One option would be to set them both as float:left;. Use width:... to set how wide you want them in pixels or percent.

If float is too complex for you (and it is quite a big jump in concept from a table-based layout), you may want to consider using display:inline-block; instead. This will also allow the <div>s to be positioned next to each other, but gives you more control over how they position themselves.

Finally, if the contents of the <table> is actually a table of data, don't be afraid of keeping it in a table - the <table> tag and its friends are still valid HTML, and putting tabular data into a table is still a good thing.

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

Comments

0

If you mean that you want to display two DIVs next to eachother, try using the css styles float:left or float:right. use another div with clear:left, clear:right or clear:both to reset following divs to normal behavior.

Here is a link explaining more about that:

http://www.w3schools.com/css/css_float.asp (click the 'try it' links for very good examples)

I don't know if that's what you're looking for... but I hope so!

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.