[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Table width of 100% excludes scrollbar under XHTML 1.0

When using
I have an intranet application that is only required to work for IE.
There scrolling tables inside a divs as follows:
      overflow-y: scroll;
      border-color: #AEB1AD;
      border-style: solid;
      border-width: 1px;
<div class="scrollbox" style="width:xpx;height:ypx">
<table width="100%">

When I use
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

it all looks good

but when I use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >

A horizontal scroll bar appears to account for the with of the vertical scrollbar which is now no longer accounted for the the 100% width of the table.

I need to use XHTML 1.0 for other reasons.

My Question is: is there a tidy way to make the width of the table exactly fit its parent div INCLUDING the width of the vertical scroll bar under XHTML 1.0.

  • 2
  • 2
1 Solution
I can't think of anyway to do that short of assuming the scroll bar will always be there and setting the width based on that.
dchellAuthor Commented:
I'm happy to have the scrollbar mermanently in place, But the outer div must stretch to the size of the window and the table has to stretch to the size of the div minus the scrollbar width, easy enough to do in javascript, just wondered if there was a cleaner way to do it.
You can force the scrollbar to always be on and set the widths based on that...

I would use javascript.
dchellAuthor Commented:
Looks like it will have to be javascript then

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now