Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 让span元素在td中包裹_Html_Css - Fatal编程技术网

Html 让span元素在td中包裹

Html 让span元素在td中包裹,html,css,Html,Css,我有一个定义如下的表格单元格: td{padding left:300px}/*在测试时更易于演示*/ 付款类型: 计算机支付 可以简单地加上- 通过使用display:block设置宽度,它将强制文本换行 示例-首先,表格用于表格数据-尽管您的内容可能是表格,但您没有正确使用表格,您应该删除表格,或者正确使用表格: 下面将列标题和列详细信息分开 th{ 文本对齐:左对齐; 垂直对齐:顶部; 右侧填充:1em; } 付款类型: 计算机支付 内容是动态的,这需要一个CSS解决方案尝试添加显示:

我有一个定义如下的表格单元格:

td{padding left:300px}/*在测试时更易于演示*/ 付款类型: 计算机支付 可以简单地加上-

通过使用display:block设置宽度,它将强制文本换行


示例-

首先,表格用于表格数据-尽管您的内容可能是表格,但您没有正确使用表格,您应该删除表格,或者正确使用表格:

下面将列标题和列详细信息分开

th{ 文本对齐:左对齐; 垂直对齐:顶部; 右侧填充:1em; } 付款类型: 计算机支付
内容是动态的,这需要一个CSS解决方案尝试添加显示:内联网格;或您可以将跨度设置为显示:块;
<td class="payment-type-label">Payment Type: 
<span class="payment-type" >Computer <br /> Payment</span>
</td>
.payment-type {display:block;width:80px;}