How to create a button in HTML with the same properties as the last row of the table?
P粉3948122772023-09-16 22:19:11
0
1
590
Consider I have a table in HTML:
首页
服务
联系人
Now I just want to add a button at the end of this table, the width of this button must be the same as the width of the last row of the table (i.e. "Contacts") (indicated by its background color). Now, what do I do? When I create a button it only has the width it creates:
Now I need a JavaScript code that sets the width of the buttonmyBtnelement to the width of the "Contact" row?
Adding
display: block
andwidth: 100%
to the button (using CSS or JS) will make it expand to fill the width of its column:If you want to use JS, you can do this: