网页上的自动换行

发布于 2024-07-13 19:37:22 字数 597 浏览 4 评论 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 

谢谢!

I am currently working on creating a web page using .NET 2008. We are getting information from a database and when displaying it I cannot get it to wrap underneath. For example:

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

In 2233 how can I get it to go underneath to look like this:

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

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幸福不弃 2024-07-20 19:37:22

我将按以下方式构建您的 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; }

显然,根据您的喜好调整数字:)

I would structure your HTML in the following manner:

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

And your CSS would be the following:

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

Obviously tweak the number to your liking :)

九公里浅绿 2024-07-20 19:37:22

嗯,有一个更好的方法,但是这可以通过表格廉价且快速地完成。

<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 中实现它,但它不喜欢它。

-亚当

Well, there's a better way, but this can be done cheaply and quickly with tables.

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

Well, I tried to implement it in markdown, but it didn't like it.

-Adam

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文