gpt4 book ai didi

HTML 缩放问题

转载 作者:行者123 更新时间:2023-11-28 08:48:25 25 4
gpt4 key购买 nike

我有一个关于 HTML 的问题。由于我对此很陌生,所以我不确定我的编码方式是否有效。对我来说,主要问题是当页面在浏览器中放大时页面的外观,所有内容都会聚集在一起并相互重叠。我应该如何编写代码以仅使用纯 HTML 和 CSS 来解决此问题?

这里有一些图片链接:

在 100% 缩放时,页面如下所示:http://i.imgur.com/yW7OWlN.jpg

缩放 150% 时,页面如下所示:http://i.imgur.com/kmv9e3k.jpg

这是我的 HTML 代码:

<!DOCTYPE html>
<html>
<head>
<title>Sample Site</title>
<link rel="stylesheet" type="text/css" href="Site.css">
</head>
<body>
<div class="logo">
<img src="Website Logo.png" alt="Website Logo" height="180px" width="300px">
</div>

<div class="slogan">
<font color="#bfbfbf"><p>Good music, good friends, the rich aroma of
<font color="red">Strawberry</font>, <font color="blue">Blueberry</font>,
<font color="orange">Peach</font>, <font color="purple">Grape</font>, and cool
<font color="green">Menthol</font>.</p>
<p>Let our flavours enthrall you, as you rock the night away.</p></font>
</div>
<div class="sloganFooter">
<font class="part1" color="#bfbfbf">Come and </font>
<font class="part2" color="aqua">DISCOVER EXCITEMENT!</font></h3>
</div>

<div class="navigation">
<ul>
<li><p>HOME</p></li>
<li><p>PRODUCTS</p></li>
<li><p>VENDORS</p></li>
<li><p>FAQ</p></li>
<li><p>CONTACT</p></li>
</ul>
</div>

<div class="mainPageImage">
<img src="Main Page.png" alt="Main Page Image">
</div>

<div class="socialMediaLinks">
<img src="facebook.png" alt="Facebook" height="40px" width="40px"
style="margin-right:15px;">
<img src="twitter.png" alt="Twitter" height="40px" width="40px" style="margin-right:15px;">
<img src="instagram.png" alt="Instagram" height="40px" width="40px"
style="margin-right:15px;">
</div>
<div class="copyright">
<font color="#bfbfbf">&copy;2014 E-Clear Limited. All rights reserved.</font>
</div>
</body>
</html>

这是我的 CSS 代码:

body
{
background-image: url("Website BG.png");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-color: black;
}

ul
{
list-style-type: none;
}

.logo
{
margin-left: 17.500em;
margin-top: 2.500em;
}

.slogan
{
position: absolute;
left: 43%;
top: 5%;
font-size: 1.250em;
font-family: Calibri;
line-height: 50%;
}

.sloganFooter
{
position: absolute;
left: 65%;
top: 15%;
}

.part1
{
font-size: 1.250em;
}

.part2
{
font-size: 1.500em;
font-weight: bold;
}

.navigation
{
position: absolute;
color: #bfbfbf;
left: 12%;
top: 25%;
font-size: 2.188em;
}

.mainPageImage
{
position: absolute;
left: 26%;
top: 25%;
}

.socialMediaLinks
{
position: absolute;
top: 90%;
left: 50%;
}

.copyright
{
position: absolute;
top: 95%;
left: 46.5%;
}

最佳答案

您应该为“mainPageImage”div 使用相对位置。 Chrome 也有已知的缩放问题。我认为元视口(viewport)不会改变任何东西。

关于HTML 缩放问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27488985/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com