Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet Explorer ignores width when use CSS table

I created a js fiddle to illustrate the problem:

http://jsfiddle.net/pLn7qgp7/

Actually this doesn't work in Internet Explorer - I set the width to 500px but the browser ignores this.

I know I can simply add a width to the images but I search for another solution so that the image number can vary.

like image 385
Nepo Znat Avatar asked Dec 02 '22 15:12

Nepo Znat


1 Answers

IE is actually correct here. Chrome is wrong.

In keeping with HTML's history of backward compatibility, width on a table (or its cells) actually means min-width. Tables are free to width columns to make the content fit.

Add table-layout:fixed to the table element (in this case, your #wrap element) to force "strict" behaviour with regard to width.

like image 168
Niet the Dark Absol Avatar answered Dec 07 '22 22:12

Niet the Dark Absol