Solved

Bootstrap css to change alignment without using padding

Posted on 2016-11-25
3
28 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 51

Accepted Solution

by:
Julian Hansen earned 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now