Log in

View Full Version : CSS: problem listing by number, please help..



dakedee
05-04-2007, 09:21 AM
Hi Guys,

I want to adjust my paragraph by using listing and nummer. Let's say I pull out 10 records from a database and show them as a list with number 1-10 repectively.

Now the problem is when there is a line that is too long, it continues the next line under the number. I would like it to start at the same position as the line above.

Such as:
..............................................

10 Most Viewed Papers

1. Status of R744 Development

2. Technological and theoretical opportunities for further improvement of efficiency and performance of the refrigerant candidates and thermostatic expansion valve for R744 with integrated safety features - Concept study & first experimental results

..............................................

There, the part "integrated safety features..." should start at the same line with "Technological and..."

How should I set the CSS for this case?


Right now my codes are:



$i=1;
while (($row = mysql_fetch_array($result))!=null)
{
echo "<ul class="box_a">";
echo "<span class='core_2'>$i.</span>&nbsp;";
echo "<a href='papers_detail.php?papers_id=$row[papers_id]' class='core_2'>$row[title]</a>";
echo "</ul>";
$i++;
}
CSS:

.box_a {
padding: 0;
margin: 0;
}
Should i keep using <ul> or should I use <li> instead? How?

Please kindly suggest me a bit on this. :confused:

Thanks alot! :)

boogyman
05-04-2007, 01:58 PM
ul = unordered list (eg bullets)
ol = ordered list (eg numbers)
li = list item (eg contents)

you can use ul and just set the style to decimal, but it is just as easy to use the ordered list. li is also the preferred format when writing inside a list. which also by default will "auto-margin" as you are attempting to do



$i=1;
while (($row = mysql_fetch_array($result))!=null)
{
echo "<ol class="box_a">";
echo "<li><a href='papers_detail.php?papers_id=$row[papers_id]' class='core_2'>$row[title]</a></li>";
echo "</ol>";
$i++;
}