Results 1 to 2 of 2

Thread: CSS: problem listing by number, please help..

  1. #1
    Join Date
    Jan 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy CSS: problem listing by number, please help..

    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:


    PHP Code:
    $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:
    Code:
    .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.

    Thanks alot!

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    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

    Code:
    $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++;
    }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •