实现table表单td内容两端对齐的方法

如何实现table表单td标签中的内容两端对齐?td的align属性设置为justify不好用,新手站长网分享td文字两端对齐的方法:

td两端对齐的方法

td标签有个align属性,将align设置为justify不怎么好用,建议使用以下方法:
在td中加入以下style样式即可实现两端对齐:

<style> td{ border:1px solid red; text-align:center; text-align:justify; text-justify:distribute-all-lines; text-align-last:justify } </style>

1 2 3 4 5 6 7 8 9 <style>      td {          border : 1px solid red ;          text-align : center ;          text-align : justify ;          text-justify : distribute-all-lines ;          text-align-last : justify      } </style>

示例代码:

<table border=”1″> <tr> <th>两端对齐</th> </tr> <tr> <td style=”text-align:justify;text-justify:distribute-all-lines;text-align-last:justify” >我是两端对齐</td> </tr> </table>

1 2 3 4 5 6 7 8 < table border = “1” >    < tr >      < th >两端对齐 < / th >    < / tr >    < tr >      < td style = “text-align:justify;text-justify:distribute-all-lines;text-align-last:justify” >我是两端对齐 < / td >    < / tr > < / table >

效果如下:

td两端对齐

2021云服务器价格出炉,便宜有好货!
① 阿里云:阿里云2核2G服务器5M带宽60元一年起(有高配)
② 代金券:阿里云代金券限量发放中…(有账号就能领)
③ 腾讯云:腾讯云2核4G服务器8M带宽74元一年(更多配置报价查看)
④ 免费提供技术支持:在线客服