简体   繁体   English

如何使用HTML / CSS将宽度设置为移动屏幕尺寸

[英]How to set width to Mobile screen size using HTML / CSS

I am developing a website Register page. 我正在开发一个网站注册页面。

if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false)

With the above trap, I directed the page to a separate mobile page, where the problems started with setting the width. 通过上面的陷阱,我将页面定向到一个单独的移动页面,在那里,问题开始于设置宽度。

in the mobile page, I tried setting the width in CSS like width="auto" , width=100% and even a width element, but still the Register page occupies just 30%-40% of the screen ( used align: left ) and not visible. 在移动页面中,我尝试在CSS中设置宽度,例如width="auto"width=100%甚至是width元素,但是Register页面仍然只占据屏幕的30%-40%( used align: left )并且不可见。

I am using PHP and MySQL. 我正在使用PHP和MySQL。

Please help me how to come out of this problem 请帮我解决这个问题

Try to add this tag in the head tag: 尝试将此标签添加到head标签中:

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

and i advice you to use bootstrap it will be fix every thing for you 我建议您使用引导程序 ,它将为您解决所有问题

Take a look at this page: https://www.w3schools.com/html/html_responsive.asp 看一下此页面: https : //www.w3schools.com/html/html_sensitive.asp

There is an explanation on it as wel as examples. 作为示例,对此有一个解释。

see: <meta name="viewport" content="width=device-width, initial-scale=1.0"> 请参阅: <meta name="viewport" content="width=device-width, initial-scale=1.0">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android中为不同的屏幕尺寸宽度设置textview宽度? - How to set textview width for different screen size width in Android? 如何根据屏幕尺寸设置回收站视图项目的宽度大小? - How to set recycler view item width size base on screen size? 如何根据gridview中的屏幕尺寸设置图像宽度高度 - how to set image width height based on screen size in gridview 如何使用权重使按钮宽度与屏幕尺寸成比例? - How to keep button width in proportion to screen size using weights? 如何设置layout_width = screen_width? 与设备相比,如何管理合适的图像尺寸? - How to set the layout_width = screen_width ? And how to manage good size for image compared to the device? 如果有2个按钮(其中1个具有特殊宽度),如何设置按钮的宽度以固定线性布局中的其余屏幕尺寸 - How to set a Button's width to fix the remaining screen size inside a Linear Layout if there are 2 Buttons (1 with spcified width) 我正在使用 Libgdx 构建一个手机游戏。 有人可以告诉我如何将屏幕设置为一种尺寸吗? - I am using Libgdx to build a mobile game. Can someone please show me how set the screen to one size? 为什么android浏览器视口比手机的实际屏幕尺寸小得多,即使使用width = device-width? - Why android browser viewport is much smaller than actual screen size of the mobile phone, even when using width=device-width? 如何比较屏幕的宽度大小和String的大小? - How to compare width size of screen with size of String? 如何将RelativeLayout的宽度设置为屏幕宽度? - How I set the width of RelativeLayout to screen width?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM