Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wide table inside div - div not stretching

Tags:

html

css

xhtml

I want a parent div to stretch when the child table width goes beyond page width.

what would be the best css solution for this?

like image 771
Armand P Avatar asked Oct 29 '10 15:10

Armand P


People also ask

How do I make my DIV not stretch?

Answer: Use the CSS display Property You can simply use the CSS display property with the value inline-block to make a <div> not larger than its contents (i.e. only expand to as wide as its contents).

How do I stretch a div horizontally?

The width property is used to fill a div remaining horizontal space using CSS. By setting the width to 100% it takes the whole width available of its parent. Example 1: This example use width property to fill the horizontal space. It set width to 100% to fill it completely.

What is table-layout fixed?

When table-layout: fixed is applied, the content no longer dictates the layout, but instead, the browser uses any defined widths from the table's first row to define column widths. If no widths are present on the first row, the column widths are divided equally across the table, regardless of content inside the cells.

What is table-layout in html?

The table-layout property defines the algorithm used to lay out table cells, rows, and columns. Tip: The main benefit of table-layout: fixed; is that the table renders much faster. On large tables, users will not see any part of the table until the browser has rendered the whole table.


1 Answers

Setting the div to display: inline-block appears to do the trick.

like image 102
Olly Hodgson Avatar answered Sep 24 '22 14:09

Olly Hodgson