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.
我希望“内边界”围绕整个单元格,如果集中的话。现在它只是在这个词的长度左右。我希望边框围绕整个单元格。我应该添加哪些代码?
td:focus{ border: 2px inset white; border-width:2px; content: ''; width: auto; height: auto; position: absolute; background: white; }
它突出显示“单词的长度”,因为您正在重置单元格的高度和宽度(最终将其重置为其内容的长度)。要解决此问题,只需删除width: autoand height: auto:
width: auto
height: auto
td:focus{ border: 2px inset white; border-width:2px; content: ''; position: absolute; background: white; }
JSFiddle 演示。