Jump to content

Problem with table .. space with conent


anthelo

Recommended Posts

Hello,

 

im having problem with a simple table..

 

I want the title and the conent do not have space.. if you can see on the picture on some cases is doing it (if the text is big)

 

Any ideas?

      <div class="main mainRegular">
            <div class="boxBody" id="mainBody">

        <div id="mainNewsSoccer">
	<div id="HomeNewsSoccerIMG"><div id="HomeNewsSoccerTitle"><?php echo MenuTitlePodosfero; ?></div></div>
<?php
$query = "SELECT *, date_FORMAT(Date, '%H:%i') as Date_Time FROM tblnews WHERE Category = 1 ORDER BY `Id` DESC LIMIT 4";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {  
?>					

<div class="small_item">
        <table border="0" cellspacing="0">
           <tr>
             <td> </td>
             <td> </td>
           </tr>
           <tr>
             <td rowspan="2"><a href="<?php echo BASE_URL;?>index.php?pid=article&artidread=<?php echo $row['Id'];?>"><img src="<?php echo html_entity_decode($row['Thumb']);?>" border="0"  width="110" height="64" /></a></td>
             <td style="max-height: 45px;" ><a href="<?php echo BASE_URL;?>index.php?pid=article&artidread=<?php echo $row['Id'];?>"><strong><?php echo html_entity_decode(substr($row['Title'],0,437));?></strong></a> <?php echo html_entity_decode(substr($row['Article'],0,700));?></strong><a id="mainNewsMore" href="<?php echo BASE_URL;?>index.php?pid=article&artidread=<?php echo $row['Id'];?>">...<?php echo goToArticle; ?></a></td>
           </tr>
        </table>
</div>
<?php } ?>

	</div>
</div>
</div>
CSS 

.small_item

{

float: left;

width: 280px;

margin-left: 10px;

margin-right: 10px;

margin-top: 10px;

max-height:190px;

}

 


 

[attachment deleted by admin]

Link to comment
Share on other sites

yes don't use tables for this unless you know when to use them.

 

What i would suggest is to make a nice media box, in a div.

 

<div class="media-box">
<img src="image.jpg" alt=" " />
<h2>title</h2>
<p>some text</p>
<div>

 

Let php provide the content.

 

Than in css set a a standard width and height for the div and let it float left;

let the image float left and give it some margin-right so it doesn't touch the text

 

That's what i would do since it's much more clean. it uses pretty much the same technique as here. but it uses an extra float on the image.

 

Hope it helps.

Link to comment
Share on other sites

So if you would have read both articles above you could have made something like this:

 

    <body>
        <style type="text/css">
            div.media-box{
                float:left;
                margin-right:10px;
                overflow: hidden;
                background:#0055BB;
                padding:3px;
                border:1px solid #fff;
                color:#fff;
            }
            .media-box img{
                float:left;
                margin-right:5px;
            }
        </style>
      <?php
        for($i=0;$i<80;$i++){
                $num = $i+1;
                echo '<div class="media-box">
                            <img src="http://i55.tinypic.com/2d962ww.png" alt="" />
                            <strong>This is a title</s>
                            <p>this is some text, lalalala lalalala lalalala
                            lalalalala lalalala</p>
                      </div>'

                ;
            }
      
      ?>
    </body>

 

just run it it works out of the box

Link to comment
Share on other sites

what do you mean results are the same.

 

could you be a little more precise in what exactly is the same. Why are you even floating the paragraph?

have you make got it online somewhere, maybe the stuff inherits properties from you sytle sheet without even knowing it.

Look here for an example working

 

Explanation on it can be found here

 

Note though I use a reset.css for everything. You might want to do the same, since a paragraph has some default margin's at the top and bottom.

 

-edit:  is it solved?? ::)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.