Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Bootstrap css to change alignment without using padding

Posted on 2016-11-25
3
Medium Priority
?
104 Views
Last Modified: 2016-11-26
    <div id="custom-bootstrap-menu" class="navbar navbar-default " role="navigation">
    <div class="container">
        <div class="navbar-header"><a class="navbar-brand" href="#">
     
        <img src="logo-small.png" ></a>
  
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse navbar-menubuilder">
            <ul class="nav navbar-nav navbar-right">

      <div class= "text">
      <input type="text" name="username" id="username" class= "input" placeholder="Username" value="" required>
      <input type="password" name="password" class= "input" id="password" placeholder="Password" required>
<button type="button" class="btn btn-primary">Sign-in</button>
     </div>
    <div class="col-md-11 text-right button password">
    <a href="forgot.php">Forgot your Password? </a>
    </div>
   
            </ul>
        </div>
    </div>
</div>

Open in new window


My username and password, are all the way to the top of the page, how can I center them and make forgot password be under password?
My css:
#custom-bootstrap-menu.navbar-default .navbar-brand
{
    color: rgb(255, 255, 255);
    text-transform: uppercase;
    font-family: 'Times New Roman' , Times, serif;
    font-size: x-large;
    font-weight: bold;
	padding-bottom: 65px;
}
#custom-bootstrap-menu.navbar-default {
    font-size: 14px;  
    border-width: 1px;
    border-radius: 0px;
    background: #333;
	background: rgba(51, 51, 51, 0.1);
	border: 0;
	-o-transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -ms-transition: all .3s; transition: all .3s;
	
}
#custom-bootstrap-menu.navbar-default .navbar-nav > li > a
{
    background-color: rgba(248, 248, 248, 0);
    color: #FFFFFF;
	padding-top: 30px;
}
#custom-bootstrap-menu.navbar-default .navbar-nav > li > a:hover, #custom-bootstrap-menu.navbar-default .navbar-nav > li > a:focus
{
    color: rgb(153, 255, 204);
    background-color: rgba(248, 248, 248, 0);
}
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:hover,
#custom-bootstrap-menu.navbar-default .navbar-nav>.active>a:focus {
    color: rgba(85, 85, 85, 1);
    background-color: rgba(231, 231, 231, 1);
}
#custom-bootstrap-menu.navbar-default .navbar-toggle {
    border-color: #ddd;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus {
    background-color: #ddd;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle .icon-bar {
    background-color: #888;
}
#custom-bootstrap-menu.navbar-default .navbar-toggle:hover .icon-bar,
#custom-bootstrap-menu.navbar-default .navbar-toggle:focus .icon-bar {
    background-color: #888;
}

Open in new window

0
Comment
Question by:Jasmine Ikhreishi
  • 2
3 Comments
 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41901659
I did this jfiddle
https://jsfiddle.net/jasmine825/ezs9ncyc/

there is an image on the right, I want there to be padding instead it being stuck to the top
0
 
LVL 1

Author Comment

by:Jasmine Ikhreishi
ID: 41901661
But with using vertical aligiment?
0
 
LVL 60

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 41902541
Some notes
1. Your fiddle does not include Bootstrap so the bootstrap styles are not in effect
2. Your code is contained inside <ul> tags but with no <li> - so it is invalid
3. Your Forgot password is inside a col-md-11 - why not col-md12
4. You need to put your col- classes inside a row class container to get rid of the margin's the former create.

Something like this (assumes you included your Bootstrap CSS)
<div id="custom-bootstrap-menu" class="navbar navbar-default " role="navigation">
  <div class="container">
    <div class="navbar-header"><a class="navbar-brand" href="#">
      <img src="logo-small.png" ></a>
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
    </div>
    <div class="collapse navbar-collapse navbar-menubuilder">
      <ul class="nav navbar-nav navbar-right">
        <li>
          <div class= "text">
            <input type="text" name="username" id="username" class= "input" placeholder="Username" value="" required>
            <input type="password" name="password" class= "input" id="password" placeholder="Password" required>
            <button type="button" class="btn btn-primary">Sign-in</button>
          </div>
          <div class="row">
            <div class="col-md-12 text-right button password">
              <a href="forgot.php">Forgot your Password? </a>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</div>

Open in new window

Sample here
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question