Перенос слов на веб-странице - PullRequest
0 голосов
/ 13 февраля 2009

В настоящее время я работаю над созданием веб-страницы с использованием .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 ]

3 голосов
/ 13 февраля 2009

Я бы структурировал ваш 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 голос
/ 13 февраля 2009

Ну, есть лучший способ, но это можно сделать дешево и быстро с помощью таблиц.

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

Ну, я пытался реализовать это в уценке, но это не понравилось.

-Adam

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...