Width: 100%, position: relative; creates unnecessary scrollbars

Here’s the html page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic"%>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>IPT Management</title>
    <isomorphic:loadISC skin="standard"/>
  </head>

  <body style="margin-top: 0px;">

    <script>
        isc.HLayout.create({
            position: "relative",
            width: "100%",
            height: "100%",
            autoDraw: true,
            members: [
                isc.Label.create({
                    contents: "test"
                })
            ]
        });

    </script>

  </body>
</html>

I tried to simplify the scenario with the code above. With it, I get unnecessary horizontal and vertical scrollbars. However, if I remove the position attribute, it will fit fine within the window.

I’ve tried width: “", height: "” but that does not seem to register either. Is there a correct way for us to have a component span the width of it’s container completely without creating these unnecessary scrollbars?

Thanks

Hi Dleung,

It’s hard to recommend something without a better understanding of your usage, because in this particular example simply removing position:“relative” is going to give you the right behavior, and that’s just simpler and better.

More generally, if you are going to have SmartClient occupy the entire screen and you never want browser-level scrollbars to appear, you can eliminate them via setting body.overflow to “hidden”.

As far as inserting SmartClient components into legacy applications without changing their architecture, you can flow into available space via leaving a marker element where you intend to subsequently place a SmartClient component, then replace that marker DOM element via canvas.htmlElement. But this is for incremental upgrade of legacy applications only.

The idea is that we JSP pages with header sections. The header displays data variables and below the header, we want to have a tabset for subsections.

Main problem we’ve been having is that the tab set at 100% width goes beyond the browser width just a tad and thus creating the horizontal scrollbar. Changing it to 98% will fit correctly but I would like to know if there is a more correct way of fixing the issue.

Thanks

If you have some kind of server-generated header area, the best thing to do is to place the server-generated HTML into a SmartClient HTMLFlow, then combine the TabSet with the HTMLFlow into a VLayout. Alternatively, if the header is fixed size, set a large top margin on a 100% sized TabSet that is not relatively positioned.

The particular problem you are running into right now is due to IE having default non-zero left and right margins and can be corrected by setting “margon:0px” on the body. But again, relative positioning is an approach that existed in SmartClient only to help with upgrading legacy applications - we recommend you don’t use it unless you are forced to.

Thanks for the options. They’ve been useful so far.

Thanks