如何扩展高分辨率的HTML页面?

时间:2016-12-08 00:34:23

标签: html css responsive-design

我目前正在网站上工作,并且我试图以高分辨率响应我的页面比例。

目前,页面对窗口调整大小反应很好,但是当我尝试不同分辨率(特别是高分辨率)的页面时,一切都变得非常微小。

如果用户的屏幕尺寸较大,我希望页面上的所有元素都能适当缩放。

这是我website的基本HTML模板的JSFiddle。

一段代码:



/* You can add global styles to this file, and also import other style files */
body, html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: lightgrey;
    position: absolute;
}

.flex-container {
    display: -webkit-flex;
    display: flex;
}

.flex-container-vertical {
    flex-direction: column;
}

.flex-item {
    float: left;
    height: 100%;
    margin: 1px;
}

.header {
    background-color: darkgreen;
    height: 20px;
    margin: 1px;
    padding: 0px;
}

#work-area {
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    margin: 1px;
}

#bars {
    width: inherit;
    height: auto;
    border: 0.5px solid black;
    margin-bottom: 1px;
}

#pane-container {
    border: 0.5px solid black;
}

#left-pane {
    width: 20%
}
#centre-pane {
    width: 60%;
}
#right-pane {
    width: 20%;
}

#operation-catalogue-pane, #operation-editor-pane {
    border: 0.5px solid black;
    height: 50%;
}

#canvas-pane {
    border: 1px solid black;
    height: 70%;
}

#canvas {
    margin: 1px;
    height: calc(100% - 24px);
}

#lower-control-pane {
    border: 1px solid black;
    height: 30%;
    width: calc(100% - 4px);
    margin-bottom: 2px;
}

#lower-control {
    margin: 1px;
    height: 100%;
}

#workspace-tree-pane {
    border: 1px solid black;
    height: 40%;
}

#tabs-area {
    height: inherit;
    margin: 1px;
}

<body>
      <div id="work-area" class="flex-container flex-container-vertical">
    <div id="bars" class="flex-item">
        <div id="menu-bar" class="header">
            <div class="overflowing-bar">
                <div>
                    <a href="/pixi-test.html">Pixi sandbox</a>
                </div>
            </div>
        </div>
        <div id="tool-bar" class="header">
            <div class="overflowing-bar">
                <div>
                    <a href="/pixi-test.html">Pixi sandbox</a>
                </div>
            </div>
        </div>
    </div>

    <div id="pane-container" class="flex-container flex-item">
        <div id="left-pane" class="flex-item flex-container flex-container-vertical">
                <div id="operation-catalogue-pane" class="flex-item">
                    <div id="operation-catalogue-header" class="header">
                        <div id="operation-catalogue-header-title">

                        </div>
                    </div>
                    <div id="operation-catalogue">

                    </div>
                </div>
                <div id="operation-editor-pane" class="flex-item">
                    <div id="operation-editor-header" class="header">
                        <div id="operation-editor-header-title">

                        </div>
                    </div>
                    <div id="operation-editor">

                    </div>
                </div>
        </div>
        <div id="centre-pane" class="flex-item flex-container flex-container-vertical">
            <div id="canvas-pane" class="flex-item flex-container flex-container-vertical">
                <div id="canvas-pane-header" class="header">
                </div>
                <div id="canvas">
                    <pixi-component id="pixi-component"></pixi-component>
                </div>
            </div>
            <div id="lower-control-pane" class="flex-item flex-container-vertical">
                <div id="lower-control">
                    <lower-control-component id="lower-control-component" class="flex-container-vertical"></lower-control-component>
                </div>
            </div>
        </div>
        <div id="right-pane" class="flex-item flex-container flex-container-vertical">
            <div id="workspace-tree-pane" class="flex-item">
                <div id="workspace-tree-pane-header">
                    <div id="workspace-tree-pane-header-title">

                    </div>
                </div>
                <div id="workspace-tree">

                </div>
            </div>
        </div>
    </div>
</div>
</body>
&#13;
&#13;
&#13;

您可以尝试查看在拖动视口时所有元素都可以很好地调整大小。然而,当我尝试以高分辨率查看网站时,使用chrome开发人员工具,一切都很小。它在绿色标题上最明显。

我想要做的是修改我的CSS,以确保页面适应高分辨率,所以我不会让任何元素非常小。我怎么能这样做?

编辑:这是我的头元素

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>WorkspacePrototype</title>
    <base href="/">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="workspace.png">
    <script src="/assets/pixi.js"></script>
    <script src="/assets/jquery-3.1.1.slim.min.js"></script>
  </head>

1 个答案:

答案 0 :(得分:0)

我认为link中描述的技术适用于您的项目:

它适用于css scale功能,并且具有很大的优势,无论屏幕有多大或多小,它的音阶始终如一。