【发布时间】:2015-05-29 20:03:37
【问题描述】:
我有一个<div>,其中包含两个span。一个带有(较长的)文本,一个带有图标。文本应换行(使用连字符),图标应垂直对齐。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
<style>
tr > th > span.text {
webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; -o-hyphens: auto; hyphens: auto;
}
tr > th > span.icon {
float: right; vertical-align: middle;
}
</style>
</head>
<body>
<table width="200px" style="table-layout:fixed">
<tr>
<th>
<span class="text" lang="de">Donaudampfschifffahrtsgesellschaftskapitän</span>
<span class="icon">
<img title="Icon" src="AufsteigendSortieren_d9d9d9.png">
</span>
</th>
<th>
<span class="text" lang="de">Donaudampfschifffahrtsgesellschaftskapitän</span>
<span class="icon">
<img title="Icon" src="AufsteigendSortieren_d9d9d9.png">
</span>
</th>
<tr>
</table>
</body>
</html>
生成的 html 应该看起来像
Donaudampfschiff-
fahrtsgesellschafts (icon here)
kapitän
【问题讨论】:
标签: html css internet-explorer-11