Topic: Form Control login icons misaligned + No text input

jpcantalino pro asked 7 years ago


I'm using the modal login component template over a card page. The envelope and lock icons are centered rather than offset left of their respective fields. The text fields also do not accept any input. The CSS is not showing any way to fix either. UPDATE: I managed to fix the text input, but the icons are still misaligned. I'm not sure what rule is causing the problem.

jpcantalino pro answered 7 years ago


Fixed

Your content is centered, because you added text-xs-center to your .card-block. I guess you wanted to center your card-block text. I noticed your card block containts modal. Modal shouldn't be there. Try this code:
	<!--Card-->
	<div class="card">

		<!--Card content-->
		<div class="card-block text-xs-center">
			<!--Title-->
			<h4 class="card-title">For Patients</h4>
			<hr>
			<!--Text-->
			<p class="card-text">If you are current or new patient, click below to login.</p>
			<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-login">Login</button>
		</div>
		<!--/.Card content-->

	</div>
	<!--/.Card-->

	<!-- Modal -->

	<div class="modal fade modal-ext" id="modal-login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" role="document">
			
			<!--Content-->
			<div class="modal-content">
			
				<!--Header-->
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					
					<h3><i class="fa fa-user"></i> Login</h3>
				</div>

				<!--Body-->
				<div class="modal-body">
					<div class="md-form">
						<i class="fa fa-envelope prefix"></i>
						<input type="text" id="form2" class="form-control">
						<label for="form2">Your email</label>
					</div>

					<div class="md-form">
						<i class="fa fa-lock prefix"></i>
						<input type="password" id="form3" class="form-control">
						<label for="form3">Your password</label>
					</div>
					
					<div class="text-xs-center">
						<button class="btn btn-primary btn-lg">Login</button>
					</div>
				</div>

				<!--Footer-->
				<div class="modal-footer">
					<div class="options">
						<p>New Patient? <a href="#">Sign Up</a></p>
						<p>Forgot <a href="#">Password?</a></p>
					</div>
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</div>
		</div>
	</div>

	<!--/.Modal-->
Does it resolve your problem?

jpcantalino pro answered 7 years ago


                       <!--Card content-->
                            <div class="card-block text-xs-center">
                                <h4 class="card-title">For Patients</h4>
                                <hr>
                                <p class="card-text">If you are current or new patient, click below to login.</p>
                                    <button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-login">
                                        Login
                                    </button>
                                    <div class="modal fade modal-ext" id="modal-login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                        <div class="modal-dialog" role="document">
                                            <!--Content-->
                                            <div class="modal-content">

                                                <!--Header-->
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                    </button>
                                                    <h3><i class="fa fa-user"></i> Login</h3>
                                                </div>

                                                <!--Body-->
                                                <div class="modal-body">
                                                    <div class="md-form">
                                                        <i class="fa fa-envelope prefix"></i>
                                                        <input type="text" id="form2" class="form-control">
                                                        <label for="form2">Your email</label>
                                                    </div>

                                                    <div class="md-form">
                                                        <i class="fa fa-lock prefix"></i>
                                                        <input type="password" id="form3" class="form-control">
                                                        <label for="form3">Your password</label>
                                                    </div>
                                                    <div class="text-xs-center">
                                                        <button class="btn btn-primary btn-lg">Login</button>
                                                    </div>
                                                </div>

                                                <!--Footer-->
                                                <div class="modal-footer">
                                                    <div class="options">
                                                        <p>New Patient? <a href="#">Sign Up</a></p>
                                                        <p>Forgot <a href="#">Password?</a></p>
                                                    </div>
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                        </div>
                    </div>
                </div>


I just checked the modal login and it works. I think there's something wrong with your code. Can you show us your code?

jpcantalino pro answered 7 years ago


That didn't seem to fix anything. Here's what the problem looks like.

Michal Szymanski staff answered 7 years ago


This is caused by different width of icons itself. If you want you can center them by adding this css code:
.md-form .prefix {
    text-align: center;
} 


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags