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 ...

<div style="width:800px;">

<table><tbody><tr><td border="0" valign="top" width="596">
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.

Governments usually respond to recessions by adopting expansionary macroeconomic policies, such as increasing money supply, increasing government spending and decreasing taxation.

</td></tr></tbody></table>
</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..:S


Thanks in advance
Vidhi

Member Avatar for ingeva

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 ...

<div style="width:800px;">

<table><tbody><tr><td border="0" valign="top" width="596">
...
</td></tr></tbody></table>
</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..:S

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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.