i am pulling 10 of the latest entrys into my database, and i want them to display like so : new ktm50 date new ktm65 date but it doesnt display like that it shows like this (but the date is higher than the new ktm) new ktm50 date new ktm65 date this is the css #bodycontatiner { margin-top: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto; padding: 5px; width: 80%; overflow: auto; background-color: white; } #main { margin-top: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto; padding: -5px; width: 70%; min-height: 500px; background-color: white; float: left; } #latestcontent { width: 50%; max-height: 50px; } #newestpostleft { margin-top: 0px; margin-bottom: 0px; float: left; width: 70%; } #newestpostright { margin-top: 0px; margin-bottom: 0px; float: right; width: 30%; } #rightbar { margin-top: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto; padding: 0px; width: 30%; vertical-align:text-top; min-height: 200px; float: left; } #adv { border:2px solid #A9A9A9; } #follow { margin-top: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto; padding: 2px; padding-top: -2px; border:2px solid #A9A9A9; text-align:center; float: left; width: 335px; } Code (markup): and this is the html/php <html> <head> <title>Motor Bike Central</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <?php include 'header.php'; ?> <div id="bodycontatiner"> <div id="main"> <div id="latestcontent"> <?php require('connect.php'); $result = mysql_query("SELECT * FROM articles ORDER BY article_id DESC LIMIT 10") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<div>"; echo "<div id='newestpostleft'>"; echo '<p><a style="font-size: 10px" href="'. $row['url'] .'">'. $row['article_name'] .'</a>'; echo "</div><div id='newestpostright'>"; echo '<p style="font-size: 10px">'; echo $row['posted']; echo "</div>"; // author + date echo "</div>"; } ?> </div> </div> <?php include 'rightbar.php'; ?> <?php include 'footer.php'; ?> HTML:
add margin in echo '<p style="margin:0;"><a style="font-size: 10px" href="#">article name</a>'; echo "</div><div id='newestpostright'>"; echo '<p style="font-size: 10px;margin:0;">'; Code (markup): this line i have modify this code to work without db but result is same
<html> <head> <title>Motor Bike Central</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <?php include 'header.php'; ?> <div id="bodycontatiner"> <div id="main"> <div id="latestcontent"> <?php require('connect.php'); $result = mysql_query("SELECT * FROM articles ORDER BY article_id DESC LIMIT 10") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<div>"; echo "<div id='newestpostleft'>"; echo '<p><a style="font-size: 10px;margin:0" href="'. $row['url'] .'">'. $row['article_name'] .'</a>'; echo "</div><div id='newestpostright'>"; echo '<p style="font-size: 10px;margin:0">'; echo $row['posted']; echo "</div>"; // author + date echo "</div>"; } ?> </div> </div> <?php include 'rightbar.php'; ?> <?php include 'footer.php'; ?> Code (markup): Show me a live example i will check its working on Localhost for me Edit : add the ";" after margin