Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maintain table width fixed

I have a table with dynamic data.

Depending on data, it expands or collapses.

I don't want it. I want a fixed width that never expand or collapse.

How can I do that?

I've already tried <table width="300px"></table>, but it doesn't work.

like image 793
ozsenegal Avatar asked Aug 04 '10 21:08

ozsenegal


People also ask

How do you fix a fixed width table?

By using CSS, the styling of HTML elements is easy to modify. To fix the width of td tag the nth-child CSS is used to set the property of specific columns(determined by the value of n) in each row of the table.

How do you stop a table from resizing?

Click on the “Table” tab. Click the “Options” button. On the “Table Options” dialog box, in the “Options” section, click the “Automatically resize to fit contents” check box so there is NO check mark in the box.

How do you manage table width?

To set the table width in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <table> tag, with the CSS property width.


1 Answers

The following should work:

<table style="width:300px;table-layout:fixed"></table>
like image 148
ironsam Avatar answered Sep 19 '22 03:09

ironsam