Migrate
11-17-2004, 08:46 AM
Good afternoon!
I'm trying to create a table inside a div that so it occupies all div width and scrolls vertically when it's height is greater than the div's height. This work fine in Mozilla Firefox but in IE6 a horizontal scroll appears and the table width is larger than the div's width.
I saw that if I change the doc type from strict mode to loose (transitional) mode the problem is solved, but I need to maintain the doctype in strict mode because because other parts of the page need it.
Can anyone help me?
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Table</title>
<style>
* {
margin: 0px;
padding: 0px;
}
html,body {
width: 100%;
height: 100%;
}
#left {
width: 200px;
height: 300px;
float: left;
border: 1px dashed Black;
}
#center {
width: 500px;
height: 300px;
float: left;
overflow: auto;
}
#center table {
width: 100%;
}
</style>
</head>
<body>
<div id="left">
<br>
<br>
<h3>Navigation</h3>
<br>
<br>
<br>
</div>
<div id="center">
<table>
<thead><th>H1</th><th>H2</th><th>H3</th><th>H4</th><th>H5</th><th>H6</th><th>H7</th></thead>
<tbody>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
</tbody>
</table>
</div>
</body>
</html>
Thanks in advance,
Migrate
I'm trying to create a table inside a div that so it occupies all div width and scrolls vertically when it's height is greater than the div's height. This work fine in Mozilla Firefox but in IE6 a horizontal scroll appears and the table width is larger than the div's width.
I saw that if I change the doc type from strict mode to loose (transitional) mode the problem is solved, but I need to maintain the doctype in strict mode because because other parts of the page need it.
Can anyone help me?
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Table</title>
<style>
* {
margin: 0px;
padding: 0px;
}
html,body {
width: 100%;
height: 100%;
}
#left {
width: 200px;
height: 300px;
float: left;
border: 1px dashed Black;
}
#center {
width: 500px;
height: 300px;
float: left;
overflow: auto;
}
#center table {
width: 100%;
}
</style>
</head>
<body>
<div id="left">
<br>
<br>
<h3>Navigation</h3>
<br>
<br>
<br>
</div>
<div id="center">
<table>
<thead><th>H1</th><th>H2</th><th>H3</th><th>H4</th><th>H5</th><th>H6</th><th>H7</th></thead>
<tbody>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr>
</tbody>
</table>
</div>
</body>
</html>
Thanks in advance,
Migrate