0

我目前正在使用 .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 

谢谢!

4

2 回答 2

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; }

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

于 2009-02-13T18:59:12.460 回答
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中实现它,但它不喜欢它。

-亚当

于 2009-02-13T18:46:22.943 回答