Julian M. Julian M. - 5 months ago 28
CSS Question

Change HTML table width

I am declaring a table this way:

<div class="row">
<div class="module span12">
<section class="module">
<table class="table table-striped table-bordered table-condensed">

echo "<tr><td style='color: white; background-color: black;'><strong>Overall inventory breakdown</strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong></strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong>Ist</strong></td>";
echo "<td style='text-align: center; color: white; background-color: black;'><strong>Soll</strong></td></tr>";

</table>
</section>
</div>
</div>


This way my table is as wide as the entire page. I want it to be smaller.

I already tried with several CSS variations and "width" paremeter on each TD and in the declaration but nothing works for me.

Any help?

Answer

This appears to be a Bootstrap question.

.table {
    /* width: 100%; */
    width: auto;
}

Get to know your browser's document inspection tool. It makes discovering the source of things like this trivial.