HTML Help (I know right?)

Status
Not open for further replies.

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
So, I've been having a LOT of trouble trying to get a div in line.
I've tried everything from float, margin-left and even position and I still can't get this to move.

So I want the post by "mittac" to be in line with the post by "Joshwelford".
Can you help me, please?

I'd post my code but there is a LOT!

hlp.png
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Here's the blog.php code:

PHP:
<?php
 
function connect(){
$con = mysql_connect("","","");
$db = mysql_select_db("", $con);
 
$r = mysql_query("SELECT * FROM blog_posts");
 
if(mysql_num_rows($r)>0){
while($row = mysql_fetch_assoc($r)){
$id = $row['anchor'];
?>
<?php if($id <= 4){
?>
<div id="post">
    <td height="163" colspan="2" valign="top"><div>
        <h3 style="font-family:Curantyle;"><?php echo $row['title']; ?><a name="<?php echo $row['anchor']; ?>" /></h3>
        <div><?php echo nl2br($row['text']); ?></div>
    </div><br />
      <div>Posted by: <?php echo $row['username']; ?></div>
      <div>Posted at: <?php echo $row['time']; ?></div>
</td>
  </tr>
</div>
<?php
}elseif($id >= 5){
?>
<td width="8%" rowspan="5" align="left" valign="top"></td>
<div id="post1">
<td align="left" height="163" colspan="2" valign="top"><div>
        <h3 style="font-family:Curantyle;"><?php echo $row['title']; ?><a name="<?php echo $row['anchor']; ?>" /></h3>
        <div><?php echo nl2br($row['text']); ?></div>
    </div><br />
      <div>Posted by: <?php echo $row['username']; ?></div>
      <div>Posted at: <?php echo $row['time']; ?></div>
 
</td>
</tr>
</div>
<?php
 
}
}
}else{
echo "No blog posts!";
}
}
connect();
?>
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Well, I had to add a class to every post after the 5th because at first they were all in line, but when I post anymore than 5, the 5th+ goes out of the line.
So I tried if it's less than or equal to 4 output with no class else output with "move_right" class.
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
Seriously.. The best approach for this is to delete tables from your memory and never use them again (unless vital) and set-up a container, for a fixed layout, and re-code it all that way.
That's my opinion anyways.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Fixed it.

I used margins with !important
Also, I used display:block
Worked a treat.
 
Status
Not open for further replies.

Users who are viewing this thread

Top