Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我编写了这个 HTML 片段:
table{ table-layout: fixed; width: 300px; display:block; } th, td { border: 1px solid red; width: 150px; }
但它没有按我想要的方式显示。事实上,列的宽度不是固定的,而是取决于添加到单元格中的内容的大小。我怎样才能解决这个问题?
您是否尝试过添加此约束?
word-wrap
检查此链接:http ://www.w3schools.com/cssref/css3_pr_word-wrap.asp
希望能帮助到你 :)