Tips for creating a responsive login form:

On the application, a Bootstrap logon form is created but on mobile devices, the logon form appears too small and centered with a lot of white space. This makes it difficult for users to enter their name and password.

Is there a way to fix this so that the login form appears native on mobile phones? Or perhaps there is a template that can be used to create a more user-friendly logon form across different screen resolutions?

<!DOCTYPE html>
<html>

<head>
    <link href="/admin/css/redmond/jquery-ui.css" rel="stylesheet" />
    <link href="/admin/Content/font-awesome.min.css" rel="stylesheet" />
    <link href="/admin/Content/bootstrap.css" rel="stylesheet" />
    <link href="/admin/Content/bootstrap-theme.css" rel="stylesheet" />
    <title>
        Login
    </title>
    <script src="/admin/Scripts/jquery-1.11.2.js"></script>
    <script src="/admin/Scripts/jquery-ui-1.11.4.js"></script>
    <script src="/admin/Scripts/bootstrap.js"></script>
</head>

<body>
    <div class='login-box container'>
        <form action="/admin/Account/LogOn" method="post">
            <fieldset>
                <legend>Login</legend>
                <div class="form-group">
                    <label for="user">User</label>
                    <input autofocus="1" class="form-control" id="user" maxlength="10" name="UserName" placeholder="User" required="True" style="width:auto" type="text" value="" />
                </div>
                <div class="form-group">
                    <label for="password">Password</label>
                    <input class="form-control" id="password" name="Password" placeholder="Password" required="True" style="width:auto" type="password" />
                </div>
                <div class="checkbox">
                    <label>
                        <input id="RememberMe" name="RememberMe" type="checkbox" value="true" />
                        <input name="RememberMe" type="hidden" value="false" /> Remember me
                    </label>
                </div>
            </fieldset>
            <input type="submit" value='Logon' class="btn btn-primary" />
        </form>
    </div>
    <script type="text/javascript">
    $(function() {
        $("input:text:visible:first").focus();
    });
    </script>
</body>

</html>

This setup uses HTML5, Bootstrap 3, jQuery, jQuery UI, ASP.NET MVC 4, and Razor.

Answer №1

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example for Vertical Form</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Vertical (basic) form example</h2>
  <form role="form">
    <div class="form-group">
      <label for="email">Email Address:</label>
      <input type="email" class="form-control" id="email" placeholder="Enter your email address">
    </div>
    <div class="form-group">
      <label for="pwd">Password:</label>
      <input type="password" class="form-control" id="pwd" placeholder="Enter your password">
    </div>
    <div class="checkbox">
      <label><input type="checkbox"> Remember me</label>
    </div>
    <button type="submit" class="btn btn-default">Submit</button>
  </form>
</div>

</body>
</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for maximizing website performance on touch-enabled devices

When using a touch device such as an iPhone, iPad, or Android device, it can be challenging to accurately tap on small buttons with your finger. So far, there is no universal method in CSS media queries to detect touch devices. As a workaround, I check if ...

I have to define a specific identifier in Django so that I can easily incorporate it into Bootstrap later on

I am working on creating a portfolio in Django. I have a section in my HTML code that connects to my jobs list in Django using {% for ... %} in order to display images, summaries, and titles of my projects. However, there is an ID within this div that refe ...

Show a message notifying the user of an incorrect password input

Hey there, currently I have a script set up which logs into live.com in this manner: WebBrowser1.Document.GetElementById("login").SetAttribute("value", txtUsername.Text) WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", txtPass ...

Exploring ways to update the design of my navigation bar when clicked by utilizing hooks to dynamically incorporate a new className

Can someone help me understand how to change the styling of my hamburger icon when it's clicked? I'm trying to add a new className to it using hooks and then target that class in Sass. The className is being added correctly, but the new styles ar ...

Pattern matching technique to capture content within a span tag

In C#, I am looking to extract the value "nHKS8cG006" from the following code snippet: "Content from Eikon: <span class="tr-pnac" id="x2">ID:nHKS8cG006</span>" The text "Content from Eikon" should be part of the regular expression, and the cla ...

Flexbox list showing items with the remaining width, ellipsis, and additional content displayed on a separate line

Understanding the concept of flexbox has been a challenge for me as I try to learn. My goal is to create a list of emails, where each item is a flexbox container (see below). https://i.sstatic.net/2s4YZ.png Guidelines: The tag is optional, but if shown ...

What is the best way to locate a web element in Selenium using Python when it does not have an ID

I'm having trouble selecting an element on the minehut.com webpage that doesn't have an ID. Despite trying CSS Selectors, I haven't had any success. The element I want to select is: <button _ngcontent-c17 color="Primary" mat-raised-bu ...

Which alternative function can I use instead of onchange without having to modify the slider beforehand in order for it to function properly?

Check out my website: alainbruno.nl/form.html to see the "Race" form and the "Age" slider. I've noticed that the minimum and maximum values of the Age slider only update correctly when you first use the slider before selecting a different race. Any id ...

How to apply a custom CSS class to a Smarty tag in CMS Made Simple

Greetings! I am currently in the process of revamping a page using CMSmadesimple, However, I have limited knowledge when it comes to utilizing CMSms and Smartytags. The page contains various smartytags that require styling. One particular tag that needs ...

I'm struggling to locate the button element in HTML for use with selenium

Currently, I am developing a selenium script to automate browser tasks using the Tor browser, which does not save cookies. Every time the script navigates to a website, a pop-up appears asking for cookie consent. I need the script to automatically click on ...

Is there a way to clear the search box in a wenzhixin bootstrap table without refreshing the page when clicked on?

Is there a way to clear the search box in a wenzhixin bootstrap table without refreshing the page when clicking anywhere on the page? <table id="view_table" data-toggle="table" data-search="true" data-page-list="[5, 10, 20]" data- ...

Using Bootstrap and CSS to style a div element and fill it

I'm struggling with a div that splits in two, where I've placed an image on the left side. However, the image doesn't seem to fill the entire space and there are empty spaces on the sides. I'm using bootstrap, but any CSS solution would ...

Remove the innerHTML content of dynamically added elements using jQuery

After researching, it seems that event handlers are commonly added using methods such as .live(), .on(), .bind(), or .delegate(). My previous question may not have been clear, so I decided to delete it and ask a simpler one. Is there a way to clear the in ...

Transformation in input value does not manifest in other components

When adjusting the sliders, the input fields are supposed to update accordingly. However, I've noticed that the changes in the input fields only take effect if I manually change their values. The automatic reflection doesn't seem to occur when us ...

Adjust the section and aside elements to automatically expand when used within the main tag

Is there a way to ensure that the inner-section and sidebar have a minimum height, while also expanding vertically along with the main tag? Here is an example of the HTML code: <body> <header></header> <main> <s ...

Incorporating jQuery functions in the Angular app's main component file, app

I've been working on an Angular application and recently added the jQuery package with the following code: $ npm install jquery --save Now, I am attempting to transfer data from my HTML web page's .js file to the app.component.ts in Angular. I ...

Press the button to activate the function

<table class="calc" cellpadding=2> <td><input type="button" class="calc" id="screen" value="0" ></td> <td><input type="button" class="calc" id="screen" value="0" ></td> <tr> </ ...

I am trying to center align this image, but for some reason, it's not cooperating

Attempting to center the image using margin-left: auto and margin-right: auto properties in the code snippet above has proven unsuccessful. The image is not aligning as desired. What could be causing this issue with the code? Are there any other techniq ...

The element selected by document.getElementById(...) does not exist

There seems to be a common issue with the <div> statement not being ready in many questions on this subject. However, in my case, the <div> statement is indeed ready. The problem lies with the document.getElementById() functions which are only ...

Looping through a jQuery script to add a class if a certain condition is met in another class

$(document).ready(function() { if ($("#grid .media-box").hasClass("brand1")) { $("#grid .media-box-content").addClass("brand01") }; } }); and in body looping div grid <div id="grid"> <?php foreach($data as $items) { ?> <div cl ...