Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML prevent line break (between two table tags)

I have following code:

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

<table>
    <tr>
        <td>Table 2</td>
    </tr>
</table>

Very unfortunately, a line break is inserted between these two tables. I have tried putting them both in a single span and setting the whitespace to nowrap, but at no avail. Please, could you tell me how I can simply put these elements in a single row, without setting the float attribute in CSS and without surrounding each table with a <td> {table} </td> and then putting this in a table row.

Thanks a lot in advance. I have asked Google, but it just wouldn't say anything ^^ StackOverflow remained silent so far, too

like image 862
arik Avatar asked Jun 03 '10 20:06

arik


People also ask

How do I stop a line break in HTML?

There are several ways to prevent line breaks in content. Using &nbsp; is one way, and works fine between words, but using it between an empty element and some text does not have a well-defined effect. The same would apply to the more logical and more accessible approach where you use an image for an icon.

How do you stop a line from breaking?

If you want to prevent the text from wrapping, you can apply white-space: nowrap; Notice in HTML code example at the top of this article, there are actually two line breaks, one before the line of text and one after, which allow the text to be on its own line (in the code).

Does tag will create a line break?

You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard.

What can I use instead of br?

Instead of using the <br> tag, you should use a semantic HTML element and the CSS margin or padding properties if necessary.


1 Answers

I found it!

One has to use the following settings for both tables:

display: inline-table;

Thanks for the inline, guys, thanks a lot, but at least, inline-table works ^^

Hope I helped...

like image 172
arik Avatar answered Oct 15 '22 01:10

arik