Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to solve a fixed position of mobile application using HTML and CSS
    primarykey
    data
    text
    <p>I am designing a form for mobile application using HTML and CSS. The form has a registration page which contains several text fields. The header and footer positions are fixed. </p> <p>My problem is when I click on a particular text field (given <code>onfocus</code> functionality to the field) and scroll the page, the screen moves up within the header and footer as they are fixed but the selected field alone goes top of the header. I don't understand why this is happening when the selected text field alone goes up and the rest of the form sculls inside the header. </p> <p>The below image illustrates my problem:</p> <p><img src="https://i.stack.imgur.com/AbN3D.png" alt="Problem of mobile"></p> <p>When I select the username text box and scroll up, this field alone goes up to the header and the other fields are scrolling within the header and footer.</p> <p>Note: here the header and footer are kept fixed.</p> <p><strong>Updated Code</strong></p> <pre><code>&lt;body&gt; &lt;div style="background: #000;height: 60px;position: fixed; padding: 0 10px;width: 96%;z-index: 9999;" id="header-wrap"&gt; &lt;header class="center"&gt; &lt;h1 id="logo"&gt; &lt;a href="/"&gt;My App&lt;/a&gt; &lt;/h1&gt; &lt;h2 class="mob-usrname" style="display:none;"&gt;Mark&lt;/h2&gt; &lt;/header&gt; &lt;/div&gt; &lt;section id="main" class="tabs"&gt; &lt;div class="page-wrap"&gt; &lt;h2&gt;Register&lt;/h2&gt; &lt;form class="form" method="post"&gt; &lt;p&gt; &lt;label for="id_first_name"&gt;First name&lt;/label&gt; &lt;input id="id_first_name" class="textinput" type="text" maxlength="30" value="Dan" name="first_name"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_last_name"&gt;Last name&lt;/label&gt; &lt;input id="id_last_name" class="textinput" type="text" maxlength="30" value="Hibma" name="last_name"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_email"&gt;E-mail address&lt;/label&gt; &lt;input id="id_email" class="textinput" type="text" maxlength="75" value="mymail@mail.com" name="email"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_password1"&gt;Password&lt;/label&gt; &lt;input id="id_password1" class="textinput" type="password" name="password1"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_password2"&gt;Password Confirmation&lt;/label&gt; &lt;input id="id_password2" class="textinput" type="password" name="password2"&gt; &lt;span class="helptext"&gt;Enter the same password as above, for verification.&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_phone"&gt;Phone&lt;/label&gt; &lt;input id="id_phone" class="textinput" type="text" maxlength="20" value="257-635-4735" name="phone"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt; &lt;label for="id_button"&gt;Button&lt;/label&gt; &lt;input id="id_button" class="textinput" type="text" maxlength="32" value="sample" name="button" readonly="readonly"&gt; &lt;span class="helptext"&gt;&lt;/span&gt; &lt;/p&gt; &lt;input id="submit" type="submit" value="Save"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/section&gt; &lt;div style="background:#2C2C2C;bottom: 0;display: block !important;height: 60px;line-height: 60px;position: fixed;width: 100%;" class="mobile-footer" style="display:none"&gt; &lt;ul&gt; &lt;li class="sam"&gt; &lt;a href="/"&gt; &lt;span&gt;&lt;/span&gt; &lt;em&gt;My Footer&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;li class="mobile-sample sample"&gt; &lt;a href="/sample/logs"&gt; &lt;span&gt;&lt;/span&gt; &lt;em&gt;logs&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload