treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] help a noob out?

  • So I'm doing a database project for one of my classes, but ironically, I'm having some trouble getting my chart to work. It's been a while since I've touched CSS, so I'm forgetting the fundamentals and it would be much appreciated if I could get someone's help!

    This is the website, and there is an awkward gap and, not to mention, the columns are all kind of strange:A La Mode

    This the code for most of the CSS parts of the page:

    #font {
    font-family:"Courier New", Courier, monospace;
    font-size: 24px;
    }
    
    #font_nav {
    font-family:"Courier New", Courier, monospace;
    font-size: 16px;
    color: #FFFFFF; 
    background-color: black;
    }
    
    .restaurant, .neighborhood, .type, .meal, .price, .reservation, .group, .credit {
        padding: 1px; float:left; 
    
    }
    .restaurant {
      width:140px;
      padding: 0px 10px 0px 30px;
        margin: 0px;
      background-color: #000;
      color: #FFF;
    
    }
    .neighborhood {
      width:125px;
      padding: 0px 20px 0px 15px;
        margin: 0px;
      background-color:#000;
      color: #FFF;
    }
    .type {
        width:100px;
        padding: 0px 0px 0px 30px;
           margin: 0px;
        background-color:#000;
        color: #FFF;
    }
    .meal {
      width:100px;
      padding: 0px 0px 0px 10px;
        margin: 0px;
        background-color:#000;
        color: #FFF;
    }
    .price {
      width:50px;
        padding: 0px 15px 0px 10px;
       `   margin: 0px;
        background-color:#000;
        color: #FFF;
    }
    .reservation {
      width:200px;
        padding: 0px 10px 0px 20px;
        margin: 0px;
        background-color:#000;
        color: #FFF;
    }
    
    .group {
      width:170px;
        padding: 0px 10px 0px 30px;
        margin: 0px;
        background-color:#000;
        color: #FFF;
      }
    
    .credit {
      width:130px;
        padding: 0px 10px 0px 10px;
        margin: 0px;
        background-color:#000;
        color: #FFF;
    
    } 
    
    </style>
    
        <div id='font_nav'>
      <table border="0" cellpadding=0" cellspacing="5">
      <div class="restaurant">Restaurant</div>
      <div class="neighborhood">Neighborhood</div>
      <div class="type">Type</div>
      <div class="meal">Meal</div>
      <div class="price">Price</div>
      <div class="reservation">Takes reservations?</div>
      <div class="group">Good for groups?</div>
      <div class="credit">Takes credit?</div>
      <br style="clear:both">
    

    </div>
    
    
    <?php
      while($currentrow=mysql_fetch_array($results))
      
      {
      
      echo "<td> " .
      $currentrow['restaurant'];
      echo "  " .
      $currentrow['neighborhood'];
      echo "".
      $currentrow['type'];
      echo "".
      $currentrow['time'];
      echo "".
      $currentrow['price'];
      echo "".
      $currentrow['reservation'];
      echo "".
      $currentrow['group'];
      echo "".
      $currentrow['credit'];
      echo " 
    "; } echo ""; ?>

    Thanks so much!!!

  • I know little of PHP but it's injecting divs into tables cells...that doesn't feel right.

  • What should I use in place of divs then? Thank you for the input.

  • I'd use <span> tags inside the table cells if you really needed them, otherwise set the styles via the <td> tags (which for what you are doing, would work fine). Get rid of the <div tags and put those class attributes on the corresponding <td> tags instead. Your site has a bunch of <br> tags under your list of column headers. Remove those to get rid of the space between your data and headers.

  • I'll try that. Cool! Thanks for the help!