Jump to content

Recommended Posts

currently I have

 

echo"<table width='1000' border='0' cellspacing='0' cellpadding='0' height='100%'>";

 

echo" <tr>

      <td width='840' valign='top'>";

        include('main.php');

echo"  </td> 

      <td width='160' valign='top' height='100%'>";

        include('sponsors.php');

echo"  </td>

      </tr>";

 

echo"</table>";

 

and i want to replace it with <div> can nebody help please?

Link to comment
https://forums.phpfreaks.com/topic/41446-help-replacing-table-with-a-div/
Share on other sites

  • 2 weeks later...

You are right, everybody now says to have div tags instead of pure tables for their website designs. But I'll tell you, it doesn't matter. As long as it looks like you want it to look like, you are good. That's what I'm sticking to, at least for a while!

I'm not sure exactly how you want this aligned, but this will start your page at an absolute 0,0 position in the upper left corner.

 

echo "<div id="Main" style="position:absolute; left:0; top:0; width:840px;">";
  include('main.php');
echo "</div><div id="Sponsors" style="position:absolute; left:840px; top:0; width:124px; z-index:1">";
  include('sponsors.php');
echo "</div>";

 

I am php noob, so as far as the php involved in that code, I just used what you wanted. The DIV tags will get you done though.

 

-Fred

Ugh, I just realized I typo'd on the width of one of the DIVs

 

echo "</div><div id="Sponsors" style="position:absolute; left:840px; top:0; width:124px; z-index:1">";

 

Should be:

 

echo "</div><div id="Sponsors" style="position:absolute; left:840px; top:0; width:160px; z-index:1">";

 

To reflect the correct width you specified above.

You are right, everybody now says to have div tags instead of pure tables for their website designs. But I'll tell you, it doesn't matter. As long as it looks like you want it to look like, you are good. That's what I'm sticking to, at least for a while!

 

For shame!!!!

 

The extraneous markup required to achieve your layout with a table can VASTLY increase the download time for your page.  Site maintainence is also MUCH more complicated with a table based layout (especially if you have lots of nested tables).

 

I guarantee spending a few days spent switching one of your sites from tables to table-less will be the most rewarding and beneficial few days you will ever spend in the world of site construction.

 

I think many are put off thinking it will be hard and stick with what they know - but once you realise that not only is it actually easier to construct pages faster and more efficiently but you will find better ways to segregate content and manage your site much more easily.

 

Rant over....

I guarantee spending a few days spent switching one of your sites from tables to table-less will be the most rewarding and beneficial few days you will ever spend in the world of site construction.

 

Not to mention that Search engines navigate a site much better when it is marked up semantically.  There are almost to many benefits to list.

 

Plus you can participate in <a href="http://naked.dustindiaz.com/">Naked day</a> and look good doing it.

My boss has agreed to join the naked day (really should do my own site sometime soon).

 

Anyway I am about to add a count me in message at the bottom of your naked day page....

 

You got the wrong Dustin but that's OK.  I have forwarded your request to participate on to <a href="http://www.dustindiaz.com">Dustin Diaz</a>, the mastermind behind naked day.

You are right, everybody now says to have div tags instead of pure tables for their website designs. But I'll tell you, it doesn't matter. As long as it looks like you want it to look like, you are good. That's what I'm sticking to, at least for a while!

 

For shame!!!!

 

The extraneous markup required to achieve your layout with a table can VASTLY increase the download time for your page.  Site maintainence is also MUCH more complicated with a table based layout (especially if you have lots of nested tables).

 

 

I completely disagree. Using a table doesn't "vastly"' increase download time. A few kb won't harm the visitor. I don't know what host you are using.

 

About site maintainence, that really depends. If you are using php include pretty much every where changing the whole layout would be mad easy. But for someone who sticks with static html then div tags are the way to go!

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.