gpt4 book ai didi

javascript - 如何将 align 属性添加到这行代码(内联) - HTML、JavaScript 和 jQuery

转载 作者:太空宇宙 更新时间:2023-11-04 14:47:43 24 4
gpt4 key购买 nike

我希望插入用于居中列数据的对齐属性。我有几行在组成上与此相似:

tdHtml = tdHtml + "<td style=\"width:42px;\">" + PriorityFormat($(this).attr("ows_Priority_x0020_Number")); + "</td>";

这可行吗?

谢谢!

最佳答案

不要使用 inline css 通过父选择器添加类或目标 td

例子:

tdHtml = tdHtml + "<td class='td-center'>" + PriorityFormat($(this).attr("ows_Priority_x0020_Number")); + "</td>";

CSS

.td-center {width:42px; text-align:center}

关于javascript - 如何将 align 属性添加到这行代码(内联) - HTML、JavaScript 和 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17709658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com