0
How to decrease the width of a table in html?
While working with tables in html, when i use too many <td> tags, the table's width gets too large to fit in my screen...how can i decrease this width?
11 Respuestas
+ 4
The width attribute specifies the width of a table.
If the width attribute is not set, a table takes up the space it needs to display the table data.
<table width="400">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
The width attribute of <table> is not supported in HTML5. Use CSS instead.
CSS syntax: <table style="width:400px">
+ 4
The reason is because your code is being interpreted as a HTML 4 doc and you are using HTML5 Tags which will not work...check for the default HTML5 template....add some bootstrap to make it flexible.
+ 4
yes I am sure you will
+ 3
Try and change table to this below code :
<table border="1" style="width:300px">
this was your own code
<table border="1" style="width=300px;">
+ 2
can you share your code so dat we could see if there could be an error because html is not a forgiving language..
+ 1
Thanks!
+ 1
Tried that too... Now i can increase the size of the table (if i put 900px) but still can't decrease it... Maybe that's how it will always be?
0
It didn't work 😶
The output was still the same
0
Thanks. I still didn't learn html5 so i guess i should learn that first and then try it again