Problems with alignment in Bootstrap

Struggling to master Bootstrap functionalities, I'm facing challenges when it comes to aligning my login form:

<form name="signup" class="span8 form-inline" ng-submit="signup.$valid && IsSubmitEnabled && loginController.validateLogin(utilisateur)" novalidate>

        <div class="row">
            <label class="control-label span1" for="username"  >{{ 'HOME_LOGIN_CONTENT_USERNAME' | translate }} : </label>
            <input class="form-control span7"  ng-model="utilisateur.login" Name="username" placeholder="{{ 'HOME_LOGIN_CONTENT_USERNAME' | translate }}" type="text" required/>
        </div>

        <div class="row">   
            <label class="control-label span1" for="password"  >{{ 'HOME_LOGIN_CONTENT_PASSWORD' | translate }} : </label>
            <input class="form-control span7"  ng-model="utilisateur.password" Name="password" placeholder="{{ 'HOME_LOGIN_CONTENT_PASSWORD' | translate }}" type="password" required />
        </div>

        <div class="row">
            <button type="submit" class="btn btn-primary">{{ 'HOME_LOGIN_CONTENT_VALIDATE' | translate }}</button>
        </div>

</form>

The current outcome is:

https://i.sstatic.net/4OFA7.png

Employing the latest versions of Bootstrap and AngularJS to incorporate my form in the code snippet below:

<!-- MAIN CONTENT AND INJECTED VIEWS -->
        <div id="main" class="mainContainer" >

            <div ng-view 
            style="height:100%"></div>
        </div>

My CSS tweaks:

    .mainContainer {
     float: none;
     margin-left: auto;
     margin-right: auto;
    text-align: center;
    width:100%;
}

The objective remains to centrally align my login form horizontally and ensure that labels are positioned correctly as illustrated in this example:

https://i.sstatic.net/JE6UF.png

(source image from this discussion thread: bootstrap form input fields alignment)

Answer №1

The column classes you are currently using in Bootstrap are from version 2, such as span2, but Bootstrap 3 requires classes like col-md-2.

To learn more about creating horizontal forms with Bootstrap 3, check out this link: http://getbootstrap.com/css/#forms-horizontal

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

Make sure to include !important for the hidden property when applying inline styles in React jsx

Is there a way to include !important in the hidden property within React JSX inline style? I'm attempting to conceal the scroll bar in an Ag Grid table component as it is displayed by default. I've already attempted: ref={(nod ...

Step-by-step guide on concealing elements and subsequently displaying them upon clicking the containing DIV

It's a bit tricky to explain without visuals, so I suggest checking out the JSFiddle link provided. Essentially, when a specific div is clicked, it should expand to reveal some inputs and buttons. However, the issue I'm facing is that upon loadin ...

Leveraging the "selected" attribute within a directive

I have implemented the code below in my controller and it works perfectly. However, when I try to use it within a directive, it does not work as expected. It seems like the issue lies with the selected items not functioning correctly within directives. ...

Update the row striping pattern once an element has been removed

I've been working on creating a todo-list and implemented row striping. Everything was going smoothly until I realized that when I delete a task, the row striping does not update as intended. Instead of changing to white, white, beige after a deletion ...

List of items:1. The first item is elevated in its position

Can anyone explain why the first li item is displaying higher than the rest when I assign an id or class to the div element? https://i.sstatic.net/9SMdT.png Take a look at the code snippet below: <div id="pickList"> <ul *ngFor="let channel ...

default browser's drag and reposition feature

I'm trying to make an image draggable on my webpage by using default browser behavior, but it's not working for some reason. Here is the code snippet I'm using: <div style="position:relative;width:1000px; height:900px;border:solid;z-inde ...

Sending input data without a form

Currently, I am in the process of developing a website game and facing a challenge with implementing a feature I refer to as "dialogue". Initially, I attempted to address this issue by using a form element, but encountered a problem where pressing enter o ...

Tracking the progress of reading position using Jquery within an article

Here is an example of a reading progress indicator where the width increases as you scroll down the page: http://jsfiddle.net/SnJXQ/61/ We want the progress bar width to start increasing when the article content div reaches the end of the article c ...

Styling for older versions of Internet Explorer (IE10 and earlier)

Could it be true that IE 10, 9, and others no longer support conditional statements? Is it also accurate to say that JQuery does not support the browser object above version 1.9? I am facing an issue with CSS rendering differently in Chrome and IE. A Goog ...

implementing a webpage enhancement that enables loading content asynchronously

I find myself puzzled. Lately, I've delved into learning Spring MVC through the development of a web application designed to display live sports scores in real-time. The core functionalities are already in place, but I'm unsure about how to creat ...

Guide to populate Div content using JSON information

I am working with a JSON object that contains arrays, and my goal is to dynamically populate a div element. I have a dropdown menu (select option) that I want to fill with all the keys from my JSON data. Each key in my JSON has an array of data as its va ...

What could be causing the malfunction in my 'sort' function? I have thoroughly checked for errors but I am unable to locate any

Exploring the world of JavaScript objects to enhance my understanding of functions and object manipulation. I have created a program that constructs an Array of Objects, each representing a person's 'firstName', 'middleName', and & ...

Utilizing either AJAX or PHP to input information into a predetermined section within a text document

I am currently in the process of developing a website that involves intricate table structures and text files acting as databases. At the moment, I have a page that displays all the available data to the user, shown below: all_data <html> <h ...

Leverage the power of the select function in Angular to transmit multiple parameters

In Angular Js, is there a way to utilize a select element in a manner similar to how you can use a list of links? For instance, if I have links set up like this: <a ng-click="ctrl.change('argument1','argument2')">One</a> & ...

How can I leverage the enum name when the ngGrid cell value is based on an enum value?

Here is my ngGrid setup: $scope.notesGrid = { data: 'notes', enableHighlighting: true, enablePinning: false, enableColumnResize: true, keepLastSelected: false, columnDefs: [ {field:'date', displayName:& ...

Mastering Anchors in AngularStrap ScrollSpy

Is there a way to effectively utilize AngularStrap's ScrollSpy feature to link to anchors within the same document? Upon reviewing the AngularStrap documentation, I noticed that when a link is clicked, a double hash is generated in the URL. For examp ...

What is the process for implementing filtered HTML attributes in a directive?

I’ve created a custom directive that generates a popup menu by extracting data from HTML content. The purpose is to transform a group of Bootstrap carousel-compatible elements into a structured list. However, each .item element contains an attribute with ...

Finding the width or height of an image that is dynamically determined by its proportions using JQuery

Using the "img" tag with only a width value in CSS will automatically calculate the height proportionally. However, finding the height value using developer tools or jQuery's height() method may not work as expected. See the example below: HTML code ...

Is it possible to absolutely position an element using its own bottom edge as a reference point?

Looking to achieve precise positioning of an element just off the top of the screen, specifically a sliding menu. Utilizing position: absolute and top: 0px is straightforward, but this aligns the element based on its top edge. Is there a way to achieve th ...

MUI provides the flexibility to adjust the opacity separately for Chip labels/icons and backgrounds

My objective is to customize the opacity of label/icon and background in MUI Chip. I want the label & icon to have an opacity of 1, while the background should have an opacity of 0.0571. Technologies used in this project include React, TypeScript, Materia ...