在网页上包装的单词

时间:2009-02-13 18:44:12

标签: vb.net web

我目前正在使用.NET 2008创建一个网页。我们从数据库中获取信息,当显示它时,我无法将其包装在下面。例如:

 2231 Question 1
 2232 Mechanical Engineering Technologists and Technicians 
 2233 Industrial Engineering and Manufacturing Technologists 
 and Technicians 
 2234 Question 4 

在2233,我怎样才能让它在下面看起来像这样:

 2231 Question 1
 2232 Mechanical Engineering Technologists and Technicians 
 2233 Industrial Engineering and Manufacturing Technologists 
      and Technicians 
 2234 Question 4 

谢谢!

2 个答案:

答案 0 :(得分:3)

我会按以下方式构建您的HTML:

<div class="qNumber">2231</div>
<div class="qContent">Question 1</div>
<div class="clear"></div>

<div class="qNumber">2232</div>
<div class="qContent">Mechanical Engineering Technologists and Technicians</div>
<div class="clear"></div>

<div class="qNumber">2233</div>
<div class="qContent">Industrial Engineering and Manufacturing Technologists and Technicians </div>
<div class="clear"></div>

<div class="qNumber">2234</div>
<div class="qContent">Question 4</div>
<div class="clear"></div>

你的CSS将如下:

.qNumber { float: left; width: 40px; }
.qContent { width: 350px; padding-left: 40px; }
.clear { clear: both; }

显然根据自己的喜好调整数字:)

答案 1 :(得分:1)

嗯,这是一种更好的方法,但这可以通过桌子以低成本和快速的方式完成。

<table>
<tr><td>2231</td><td>Question 1</td></tr>
<tr><td>2232</td><td>Mechanical Engineering Technologists and Technicians</td></tr> 
<tr><td>2233</td><td>Industrial Engineering and Manufacturing Technologists and Technicians</td></tr> 
<tr><td>2234</td><td>Question 4</td></tr>
</table>

好吧,我试图在markdown中实现它,但它不喜欢它。

- 亚当