【问题标题】:Trying to make a fixed page size using HTML and CSS尝试使用 HTML 和 CSS 制作固定的页面大小
【发布时间】:2015-05-09 05:22:55
【问题描述】:

我希望我的网页宽度为特定大小。这样它会在移动设备上自动更改为全屏。这是页面布局的理想示例,我正在尝试制作:http://sidebar.io/new。现在我有普通的 html 和 css 文件,它们显示一个普通的桌面页面。我试图将 body 元素的宽度更改为 600px,但事实并非如此,我正在尝试这里描述的方法:height and width on html and body elements,但这也与我想要的不同。我希望我的网站具有与第一个链接完全相同的布局。任何人都可以请至少给我一个关于如何做到这一点的线索吗?

这是我尝试过的一些代码。

body {
    width: 200px;
     position: fixed;
     top:auto;
     bottom:0px;
     right:0px;
     left:auto;
}

另一个:

body {
    width: 600px;
    overflow-y:scroll;
    border: 1px solid black;
}

#childOfTheBody{
    height:100%;
    background-color: #a2e89f;
}

#childOfTheChild{
    height: 500px
}

【问题讨论】:

  • 你能发布一些你尝试过的代码吗?

标签: android html ios css web


【解决方案1】:

不是以像素为单位给出大小,而是以百分比给出。

Eg : instead of width: 600px give width : 50%

【讨论】:

    猜你喜欢
    • 2015-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-25
    • 1970-01-01
    • 1970-01-01
    • 2022-01-25
    相关资源
    最近更新 更多