'How to fix content that is wider then screen on mobile
I've got a login form that is attached with a CSS file, it displays fine on desktop but on mobile the form displays really small and you have to zoom in with fingers to type on it.
I want the form to automatically be in the same size of the clients screen (on mobile).
Who can help on that?
@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
html,
body {
background: #6665ee;
font-family: 'Poppins', sans-serif;
}
::selection {
color: #3d3d3d;
background: #3d3d3d;
}
.container {
position: absolute;
max-width: 440px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.container .form {
max-width: 440px;
background: #fff;
padding: 30px 35px;
border-radius: 5px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.container .form form .form-control {
height: auto;
font-size: auto;
}
.container .form form .forget-pass {
margin: -15px 0 15px 0;
}
.container .form form .forget-pass a {
font-size: 15px;
}
.container .form form .button {
background: #6665ee;
color: #fff;
font-size: 17px;
font-weight: 500;
transition: all 0.3s ease;
}
.container .form form .button:hover {
background: #5757d1;
}
.container .form form .link {
padding: 5px 0;
}
.container .form form .link a {
color: #6665ee;
}
.container .login-form form p {
font-size: 14px;
}
.container .row .alert {
font-size: 14px;
}
<div class="container">
<form>
<input type="text" />
<p>Paragraph.</p>
</form>
</div>
Solution 1:[1]
I think your issue here is your viewport and not your CSS. Try adding this line into your <head>
element:
<!-- Disables Scaling on multi-touch interfaces -->
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
This basically tells the browser to adjust to mobile devices.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | mdurchholz |