gpt4 book ai didi

Webpage displays small on mobile device(网页在移动设备上显示较小)

转载 作者:bug小助手 更新时间:2023-10-24 21:13:40 26 4
gpt4 key购买 nike



I have developed a website for a charity using ASP.NET and SQL Server. The webpages were developed and tested on a PC (I know now.) The pages appear tiny on mobile devices and most users will be on phones. I used HTML years ago, but am new to CSS and "Responsive Design" ideas. I have read numerous articles about browser detection, responsive design, CSS, Javascript, @Media queries, etc:

我用ASP.NET和SQL Server为一家慈善机构开发了一个网站。这些网页是在PC上开发和测试的(我现在知道了)。这些页面在移动设备上看起来很小,大多数用户将使用手机。我几年前就用过HTML语言,但对css和“响应式设计”的概念还是个新手。我读过很多关于浏览器检测、响应性设计、CSS、Java脚本、@Media查询等的文章:


I have tried several different approaches, but none have worked for me.

我尝试了几种不同的方法,但没有一种对我有效。


Below is the HTML for one of the pages and screenshots showing the current and desired (simply zoomed in) appearance.

下面是其中一个页面的HTML和屏幕截图,显示了当前和所需的(简单地放大)外观。


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="logon.aspx.cs" Inherits="mysite.logon" %>

<!DOCTYPE html

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login</title>
<style type="text/css">
html, body {
height: 100vh;
height: calc(var(--vh, 1vh) * 100);
}
.blank_row
{
height: 5px;
}
</style>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1" />
</head>
<body>
<form id="login" runat="server">
<div>
<table width="100%">
<tr>
<td colspan="4">
<div style="margin-left: auto; margin-right: auto; text-align: center;">
<asp:Label ID="lblLogin" runat="server" Text="LOGIN" Font-Bold="true" Font-Size="XX-Large"
CssClass="StrongText"></asp:Label>
</div>
</td>
</tr>
<tr class="blank_row">
<td colspan="4"></td>
</tr>
<tr>
<td width="25%"></td>
<td width="25%">
<div style="text-align:right">
<asp:Label Text="Email: " runat="server"/>
</div>
</td>
<td width="25%">
<asp:TextBox ID="txtEmail" runat="server" />
</td>
<td width="25%"></td>
</tr>
<tr>
<td width="25%"></td>
<td width="25%">
<div style="text-align:right">
<asp:Label Text="Password: " runat="server" />
</div>
</td>
<td width="25%">
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"/>
</td>
<td width="25%"></td>
</tr>
<tr>
<td colspan="4">
<div style="margin-left: auto; margin-right: auto; text-align: center;">
<asp:Button Text="Login" ID="btnLogin" runat="server" OnClick="btnLogin_Click"/>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div style="margin-left: auto; margin-right: auto; text-align: center;">
<asp:Label Text="" ID="lblErrorMessage" runat="server" ForeColor="Red"/>
</div>
</td>
</tr>
<tr class="blank_row">
<td colspan="4"></td>
</tr>
<tr>
<td colspan="4">
<div style="margin-left: auto; margin-right: auto; text-align: center;">
<asp:HyperLink ID="ForgotPassword" runat="server" Text="Forgot password" NavigateUrl="~/ForgotPassword.aspx"></asp:HyperLink>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div style="margin-left: auto; margin-right: auto; text-align: center;">
<asp:HyperLink ID="CreateAccount" runat="server" Text="Create account" NavigateUrl="~/Account.aspx"></asp:HyperLink>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

https://imgtr.ee/image/MobileSizing.2CUxv

Https://imgtr.ee/image/MobileSizing.2CUxv


更多回答

Change 'max-width' to 'min-width' on '.image-viewer-container img' and remove the height css from the image. That should get you close to what you need.

将图像查看器容器img上的“max-idth”更改为“min-idth”,并从图像中删除高度的css。这应该会让你接近你需要的东西。

优秀答案推荐

Try changing your viewport meta tag to this:

尝试将视口元标记更改为以下内容:


<meta name="viewport" content="width=device-width, initial-scale=1.0">


Further reading

进一步阅读


更多回答

26 4 0