gpt4 book ai didi

html - 如何在浏览器和手机端正确显示HTML页面

转载 作者:太空宇宙 更新时间:2023-11-04 04:14:49 25 4
gpt4 key购买 nike

我有一个如下的 HTML 页面。在此页面中,我在桌面和移动浏览器中遇到了不同的问题。

  1. 在桌面浏览器中显示所有内容,但图像太大。如果我试着把它变小,那么它对移动设备来说就变小了。那么如何实现它,使图标变得适合两个地方呢?

  2. 在移动浏览器中 border-bottom-style 不显示,但在桌面浏览器中显示。那么问题是什么?

HTML:

<body style="height:100%">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;" class="homebackground">
<tr height="10%">
<td colspan="3" style="background:url(../../stylesheets/images/user_male.png) no-repeat; background-size: contain;border-bottom-style:solid;border-color: #129AA2; border:1">&nbsp;</td>
</tr>

<tr height="80%" style="background:url(../../stylesheets/images/Logo_with_Blu_bg.png); background-size:98% 88%;">
<td colspan="3">
<table style="width:100%; height:100%;" border="0" cellpadding="0" cellspacing="0">
<tr style="height:20%;">
<td align="right" class="mainbodyup"><img src="../../stylesheets/images/phone.png"/></td>
<td>&nbsp;</td>
<td class="mainbodyup"><img src="../../stylesheets/images/groupchat.png"/></td>
</tr>
<tr height="60%">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr height="20%">
<td class="mainbodyup"><img src="../../stylesheets/images/recent.png"/></td>
<td>&nbsp;</td>
<td class="mainbodyup"><img src="../../stylesheets/images/search.png"/></td>
</tr>
</table>
</td>
</tr>
<tr height="10%">
<td colspan="3" style="background:url(../../stylesheets/images/setting_footer.png) no-repeat; background-size: contain;border-top-style:solid;border-color: #129AA2; border:1">&nbsp;</td>
</tr>
</table>
</body>

CSS:

    @media only screen and (min-width: 768px) {
.mainbodyup
{
height:20%;
width:33%;
padding:0px;
}
.mainbodyup img
{
max-width:30%;
margin:auto;
display:block;
}
}
@media only screen and (min-width: 100px) {
.mainbodyup
{
height:20%;
width:33%;
padding:0px;
}
.mainbodyup img
{
max-width:100%;
margin:auto;
display:block;
}
}

后期编辑

我将我的 css 更改为媒体查询。现在我面临的问题是最后一个媒体查询是有效的。如果我交换然后结果也是相同的。两个查询单独工作正常但是如果我把它们放在一起那么最后一个是有效的,那么问题是什么?

最佳答案

您必须以相反的方式使用您的媒体查询。首先,您定位最小 100 像素的屏幕,然后最小 768 像素。这样,后面的会覆盖第一个

关于html - 如何在浏览器和手机端正确显示HTML页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20116681/

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