launchoverit launchoverit - 1 year ago 71
CSS Question

Overriding a table's inline css width

I have a table that has a static width set with inline css.

<table style="width:700px;"></table>

I cannot control the markup, and I'd like to use CSS to give that table a width of 100%. One solution is to use "display:block" to prevent the table from overflowing, but then the table cells collapse to the size of their contents, which is not what I want. Is this possible?

Here's a JSFiddle to illustrate the problem.

I've encountered many questions like this, but not this particular question. Here are some similar SO questions in case they're helpful to others:

CSS width and max-width combined

CSS: table {width:100%; display:block;} not working in Firefox

Answer Source

Use CSS's !important declaration

    width:100% !important;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download