HTML页面不';t安装移动设备屏幕
这是我的HTML:HTML页面不';t安装移动设备屏幕,html,css,mobile,Html,Css,Mobile,这是我的HTML: 试验 身体{ 字体大小:40px; } .屏幕{ 字体大小:0.5em; 保证金:0; 背景色:红色; 位置:绝对位置; 宽度:8em; 高度:19公分; 左:0; 排名:0; } .screen.main{ 宽度:100%; 身高:100%; } 我们的利益是自由的,我们的利益是自由的,我们的利益是自由的,我们的利益是自由的,我们的利益是非特殊的,我们的利益是自由的,我们的利益是自由的,我们的利益是自由的。 您将屏幕的宽度设置为8em,将其更新为100%: .scree
试验
身体{
字体大小:40px;
}
.屏幕{
字体大小:0.5em;
保证金:0;
背景色:红色;
位置:绝对位置;
宽度:8em;
高度:19公分;
左:0;
排名:0;
}
.screen.main{
宽度:100%;
身高:100%;
}
我们的利益是自由的,我们的利益是自由的,我们的利益是自由的,我们的利益是自由的,我们的利益是非特殊的,我们的利益是自由的,我们的利益是自由的,我们的利益是自由的。
您将屏幕的宽度设置为8em
,将其更新为100%
:
.screen {
font-size: 0.5em;
margin: 0;
background-color: red;
position: absolute;
width: 100%;
height: 19em;
left: 0;
top: 0;
}
您还需要(可能,除非您使用CSS重置)删除正文上的边距和填充:
body {
font-size: 40px;
margin: 0;
padding: 0;
}
试试这个
body {
margin:0;
padding:0;
}
除了BenM的答案之外,在css中设置此选项可以从浏览器中删除默认样式
html, body {
font-size: 40px;
margin:0; /* remove default margin */
padding:0; /* remove default padding */
width:100%; /* take full browser width */
height:100%; /* take full browser height*/
}
因此,完整的css应该:
.screen {
font-size: 0.5em;
margin: 0;
background-color: red;
position: absolute;
width: 100% /* BenM mentioned this in answer*/
height: 100%; /* take full browser height */
left: 0;
top: 0;
}
.screen .main {
width: 100%; /* <--now this takes full browser dimension */
height: 100%; /* <--now this takes full browser dimension */
}
屏幕{
字体大小:0.5em;
保证金:0;
背景色:红色;
位置:绝对位置;
宽度:100%/*BenM在回答中提到了这一点*/
高度:100%;/*采用全浏览器高度*/
左:0;
排名:0;
}
.screen.main{
宽度:100%/*