943,846 Members | Top Members by Rank

Ad:
Aug 13th, 2009
0

table width in pixel overlaps div

Expand Post »
Hi,

I have to display content on a page.I want the content to be displayed in 800px space.So I have used a div tag.The following code explains it ...

html Syntax (Toggle Plain Text)
  1. <div style="width:800px;">
  2.  
  3. <table><tbody><tr><td border="0" valign="top" width="596">
  4. In economics, a recession is a general slowdown in economic activity over a sustained period of time, or a business cycle contraction.During recessions, many macroeconomic indicators vary in a similar way. Production as measured by Gross Domestic Product (GDP), employment, investment spending, capacity utilization, household incomes and business profits all fall during recessions.
  5.  
  6. Governments usually respond to recessions by adopting expansionary macroeconomic policies, such as increasing money supply, increasing government spending and decreasing taxation.
  7.  
  8. </td></tr></tbody></table>
  9. </div>

Because of the width attribute of the td tag ,content is displayed in 596px space.But i want it to be displayed in 800px space so that it covers the entire screen.
Could you please help me solve this problem..


Thanks in advance
Vidhi
Last edited by peter_budo; Aug 13th, 2009 at 12:33 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vidhi.s is offline Offline
1 posts
since Apr 2009
Aug 14th, 2009
0

Re: table width in pixel overlaps div

Click to Expand / Collapse  Quote originally posted by vidhi.s ...
Hi,

I have to display content on a page.I want the content to be displayed in 800px space.So I have used a div tag.The following code explains it ...

html Syntax (Toggle Plain Text)
  1. <div style="width:800px;">
  2.  
  3. <table><tbody><tr><td border="0" valign="top" width="596">
  4. ...
  5. </td></tr></tbody></table>
  6. </div>

Because of the width attribute of the td tag ,content is displayed in 596px space.But i want it to be displayed in 800px space so that it covers the entire screen.
Could you please help me solve this problem..
Should be done by just omitting the width attribute. AAMOF you could drop the other attributes also, unless they've been set to another default.
Reputation Points: 16
Solved Threads: 9
Junior Poster
ingeva is offline Offline
106 posts
since Jul 2008
Aug 23rd, 2009
0

Re: table width in pixel overlaps div

If you want the table to be the width of the screen, use:

width: 100%;

Remember that different computers have different screen widths in pixels.
Last edited by MidiMagic; Aug 23rd, 2009 at 8:40 pm.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Aug 25th, 2009
0

Re: table width in pixel overlaps div

If that is all you have in your table, I would remove the table in its entirety, and just have the content in the div. Makes for better CSS & faster read for browsers.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
LessZoa is offline Offline
2 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Overhanging background
Next Thread in HTML and CSS Forum Timeline: help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC