我希望多行文本像单个文本 block 一样环绕,例如下面的“Source”和“DEC”字段,而不使用表格。
我想我应该能够使用 inline-block 来让它工作,但我没有成功。
下面是我正在使用的简单 html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="head">
<title></title>
<style type="text/css">
.tt { color: #7777cc; width:85px; }
.cc { display: inline-block; }
</style>
</head>
<body>
<div class="g1">
<div class="expandable">
<span class="tt">Source </span><span class="cc">Neutron energy was varied by changing the
emission angle to the deuteron beam. The activities of the "2"3"7U and "2"3"1Th
residual nuclei were measured by a Ge(Li) and a HP Ge gamma-spectrometer, respectively.</span>
</div>
</div>
</body>
</html>
最佳答案
你应该只使用 float 。
.expandable { overflow:hidden; } /* Clears floats */
.tt { float:left; width:85px; }
.cc { float:left; }
关于html - 内嵌 block css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5857124/