固定HTML中的屏幕尺寸 [英] Fixing screen size in HTML

查看:181
本文介绍了固定HTML中的屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我希望所有html页面的尺寸或屏幕分辨率都与1024 * 768相同,该怎么办?

If I want to have the same size or screen resolution as 1024 * 768 for all my html pages how can I do that?

推荐答案

包含页面内容在div中将宽度和高度设置为1024 x 768像素.
Contain the page content in a div and set the width and height to 1024 by 768 pixels.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <style type="text/css">
.fixedSize
{
    width:1024px;
    height:768px;
    /* use the below to centre the div */
    margin-left:auto;
    margin-right:auto;
    /* set the background to red so we can see the div */
    background:#ff0000;
}
</style>
</head>
<body>
<div class="fixedSize">
<p>Fixed Size!</p>
</div>
</body>
</html>


这篇关于固定HTML中的屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆