I want a static width for main div as 300px. But when any users copy and paste text from Word program, then change table width and overflow text from div. But width of my site must be max 300px. How can I solve this problem?
<html>
<head>
<style>
#main td{
max-width:300px;
}
#main table{
max-width:300px;
}
</style>
</head>
<body>
<div id="main">
<table width="700" border="1">
<tr>
<td width="800"><p width="900">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</td>
</tr>
<tr>
<td width="800"><p with="900">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p></td>
</tr>
</table>
</div>
</body>
</html>
Change
To
That way, the TD, img and others will still be sized. Also, you could use
overflow-x:hiddenon your#maindiv to hide the content that is too big to fit.