I am trying to align the controls in my angular 8 application. Basically I need to align the Amount column like shown in the screenshot below. Could somebody tell me how to achieve that. Currently using col-sm-5 for Amount column. If I do col-sm-6 it would push the edit button further out which i don't want.I need to get the textbox upto the red line shown in screenshot 1
screenshot 1
Screenshot 2
<form [formGroup]="settlementForm" (ngSubmit)="addAccount()" class="form-horizontal argentex-form" novalidate>
<div class="modal-body">
<div *ngIf="messageViewerModel.messages.length > 0" class="viewer">
<app-message-viewer [messageViewer]="messageViewerModel"></app-message-viewer>
</div>
<!-- Remaining balanace input -->
<div class="form-group has-feedback">
<label class="col-sm-4 control-label">Remaining Balance</label>
<div class="col-sm-6">
<currency class="form-control" [stringModel]="remainingBalance()" [isDisabled]="true"></currency>
</div>
</div>
<!-- Dropdown Accounts -->
<div class="form-group">
<label class="col-sm-4 control-label">Account</label>
<div class="col-sm-6">
<div class="selectdiv">
<select class="form-control" id="selectedAccount" #selectedAccountID
name="selectedAccountFormControl" formControlName="selectedAccountFormControl">
<option *ngFor="let account of accounts; let ind=index;" value="{{ ind }}"
ngDefaultControl>
{{ account.accountName }}
</option>
</select>
</div>
</div>
</div>
<!-- Amount in the traded currency -->
<div class="form-group has-feedback">
<label class="col-sm-4 control-label">Amount ({{settlement.tradedCurrency}})</label>
<div class="col-sm-5">
<currency class="form-control" [isDisabled]=editMode [(numModel)]="settlement.amount" [stringModel]="settlement.amount"
[required]="true" [readonly]="settlement.isPayTotal"></currency>
</div>
<div class="col-sm-1" style="padding-top: 5px">
<!-- settlement?.isPayTotal -->
<div *ngIf="editMode">
<a href="javascript:;" class="btn-edit" (click)="editAmount()">
<img src="../../assets/images/icon-sp-edit.png" alt=""/>
</a>
</div>
<div *ngIf="!editMode">
<a href="javascript:;" class="btn-edit" (click)="cancelAmount()">
<img src="../../assets/images/icon-sp-cancel.png" alt=""/>
</a>
</div>
</div>
</div>
<!-- Value Date -->
<div class="form-group has-feedback">
<label class="col-sm-4 control-label">Value Date</label>
<div class="col-md-6">
<input type="text"
name="valueDate"
formControlName="valueDate"
class="form-control"
[(ngModel)]="settlement.valueDate"
bootstrapDatepicker />
</div>
</div>
<!-- Reference -->
<div class="form-group">
<label class="col-sm-4 control-label">Reference</label>
<div class="col-sm-6">
<input type="text" formControlName="reference" name="reference" class="form-control"
[(ngModel)]="settlement.reference" />
</div>
</div>
</div>
<div class="modal-footer">
<hr>
<button type="submit" class="btn" [disabled]="settlementForm.disabled || !settlementForm.valid || selectedAccountID.value <= 0 || !settlement.amount" >Save</button>
<button type="button" class="btn btn-close" (click)="closeModal()">Cancel</button>
</div>
</form>
Proposed solution
Its near but not still what I want
screenshot
Used the folowing css
.custom-css-input {
width: 100%;
/* float: left; */
}
.icon-button {
width: 40px;
float: left;
}
p.clear {
clear: both;
margin: 0;
padding: 0;
height: 0;
}
Following html
<div class="form-group has-feedback">
<label class="col-sm-4 control-label">Amount ({{settlement.tradedCurrency}})</label>
<div class="col-sm-5" >
<currency class="form-control custom-css-input" [(numModel)]="settlement.amount" [(stringModel)]="settlement.amount"
[isDisabled]=!editMode [required]="true" ></currency>
</div>
<div style="padding-top: 5px">
<div *ngIf="!editMode" class="icon-button">
<a href="javascript:;" class="btn-edit" (click)="editAmount()">
<img src="../../assets/images/icon-sp-edit.png" alt="" />
</a>
</div>
<div *ngIf="editMode" class="icon-button">
<a href="javascript:;" class="btn-edit" (click)="cancelAmount()">
<img src="../../assets/images/icon-sp-cancel.png" alt="" />
</a>
</div>
</div>
<p class="clear"></p>
</div>
sry for not posting bootstrap solution, but if you are in hurry, simple css can work for you. I have added three custom css classes (custom-css-input,icon-button,clear), .clear is only there if floats disturb the rest of your form, but that's just in case. You can play width calc width and fixed width in order to achive your desired look. (Wrap whole input+button component in one single column and play inside with widths)
.custom-css-input {
width: calc(100% - 50px);
float: left;
}
.icon-button {
width: 40px;
float: right;
}
p.clear {
clear: both;
margin: 0;
padding: 0;
height: 0;
}
<div class="col-sm-6">
<currency class="form-control custom-css-input" [isDisabled]=editMode [(numModel)]="settlement.amount" [stringModel]="settlement.amount" [required]="true" [readonly]="settlement.isPayTotal"></currency>
<div *ngIf="editMode" class="icon-button">
<a href="javascript:;" class="btn-edit" (click)="editAmount()">
<img src="../../assets/images/icon-sp-edit.png" alt="" />
</a>
</div>
<div *ngIf="!editMode" class="icon-button">
<a href="javascript:;" class="btn-edit" (click)="cancelAmount()">
<img src="../../assets/images/icon-sp-cancel.png" alt="" />
</a>
</div>
<p class="clear" />
</div>
Related
I'm creating a Santa letter writing website and I'm trying to get a graphic of Santa to look like it is riding on top of the snow. The issue is I cannot seem to get it to work responsively. For reference below is a mockup image of how I would like the Santa graphic placed with everything else I have. How can I make this work?
The container needed bit restructuring to make it work. On the image set following classes img-fluid w-50 h-50 align-self-end
<!DOCTYPE html>
<html lang="en" referrerpolicy="no-referrer">
<head referrerpolicy="no-referrer">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- remove following in production-->
<meta name="referrer" content="no-referrer">
<title>Reindeer Express</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet" />
<!-- link rel="stylesheet" href="css/style.css" -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script>
<script src="https://kit.fontawesome.com/1463370ce3.js" crossorigin="anonymous"></script>
<style>
.bg-img {
background-image: url("https://i.imgur.com/9L54Zdw.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.custom-shape-divider-bottom-1637548946 {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
line-height: 0;
transform: rotate(180deg);
}
.custom-shape-divider-bottom-1637548946 svg {
position: relative;
display: block;
width: calc(100% + 1.3px);
height: 70px;
}
.custom-shape-divider-bottom-1637548946 .shape-fill {
fill: #FFFFFF;
}
#stop-btn {
display: none;
}
#how-to-mail {
display: none;
}
#hidden-template {
display: none;
}
.img-anim {
transform-origin: 25% 75%;
animation: ride 2s ease-in-out 0s infinite alternate;
}
#keyframes ride {
0% {
transform: rotateZ(356deg);
}
100% {
transform: rotateZ(359deg);
}
}
</style>
</head>
<body onload=display_countdown; referrerpolicy="no-referrer">
<div class="bg-img">
<nav class="navbar navbar-dark navbar-expand-sm">
<div class="container-fluid position-relative">
<a class="navbar-brand position-absolute fixed-top" style="left:12px" href="#">
<img src="https://i.imgur.com/vavioW9.png" alt="" width="24" height="29"
class="d-inline-block align-text-top">
Reindeer Express
</a>
<div class="navbar-collapse collapse flex-grow-0 mx-auto">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link text-white" href="#"><u>Home</u></a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="#"><u>Nav Item</u></a>
</li>
<li class="nav-item ">
<a class="nav-link text-white" href="#"><u>Nav Item</u></a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container col-xxl-8 px-4 py-5">
<div class="d-sm-flex justify-content-between">
<img class="img-fluid w-50 h-50 align-self-end img-anim" src="https://i.imgur.com/4n4uujr.png">
<div class="col flex-lg-row-reverse align-items-center g-5 p-5">
<div class="col-10">
<h1 class="fw-bold lh-1 mb-3 text-white">Reindeer Express</h1>
<p class="lead text-white" id="welcome">Welcome Friends to the Reindeer Express! Have you ever wanted to
write
a letter
to Santa Clause? Well now you can! Fill out the form below to let Santa know what you would like for
Christmas!
But that is not all! You can also download a copy of your letter once you send it! How cool is that?</p>
</div>
<div class="">
<h1 class="text-white" id="countdown_days"></h1>
</div>
</div>
</div>
</div>
<div class="custom-shape-divider-bottom-1637548946">
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none">
<path
d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z"
opacity=".25" class="shape-fill"></path>
<path
d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z"
opacity=".5" class="shape-fill"></path>
<path
d="M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z"
class="shape-fill"></path>
</svg>
</div>
</div>
<section id="form-area" class="py-3">
<div class="container">
<div class="row py-5">
<div class="col text-center">
<h2>Write a letter to Santa</h2>
</div>
</div>
<div class="row">
<div class="col-md-5 col-sm-12 ">
<img class="img-fluid d-block mx-auto w-75" src="https://i.imgur.com/ZeukS4C.png"
alt="santa standing by a reindeer">
</div>
<div class="col-md-7 col-sm-12">
<form id="form" onsubmit="handleSubmit(event)">
<div class="mb-3 form-floating">
<input type="email" placeholder="ex: parent#mail.com" class="form-control" id="parentEmail"
oninput="handleChange(event)" required>
<label for="parentEmail" class="form-label">Parent's Email Address</label>
</div>
<div class="row">
<div class="col">
<div class="form-floating mb-3 ">
<input type="text" placeholder="ex: Sally Smith" class="form-control" id="name"
oninput="handleChange(event)" required>
<label for="name" class="form-label">Name</label>
</div>
</div>
<div class="col">
<div class="form-floating mb-3 ">
<input type="number" placeholder="3" class="form-control" id="age" oninput="handleChange(event)"
required min="0" max="150">
<label for="age" class="form-label">Age</label>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-floating mb-3">
<select class="form-select" id="gender" aria-label="select gender" oninput="handleChange(event)"
required>
<option>Pick boy or girl</option>
<option value="boy">Boy</option>
<option value="girl">Girl</option>
</select>
<label for="gender" class="form-label">Gender</label>
</div>
</div>
<div class="col">
<div class="form-floating mb-3">
<select class="form-select" id="behavior" aria-label="select naughty or nice"
oninput="handleChange(event)" required>
<option>Select option</option>
<option value="nice">Nice</option>
<option value="naughty">Naughty</option>
<option value="okay">Okay</option>
</select>
<label for="behavior" class="form-label">Behavior</label>
</div>
</div>
</div>
<div class="mb-3">
<label for="wishlistOne" class="form-label">Name three things you would like for Christmas:</label>
<input type="text" placeholder="1." class="form-control" id="wishlistOne" oninput="handleChange(event)"
required>
</div>
<div class="mb-3">
<input type="text" placeholder="2." class="form-control" id="wishlistTwo" oninput="handleChange(event)"
required>
</div>
<div class="mb-3">
<input type="text" placeholder="3." class="form-control" id="wishlistThree" oninput="handleChange(event)"
required>
</div>
<div class="mb-3 form-floating">
<textarea class="form-control textbox" id="message" oninput="handleChange(event)" rows="10"
required></textarea>
<label for="message" class="form-label">Write a message for Santa</label>
<div class="row mt-1">
<div class="col">
<p id="instructions" class="text-muted"></p>
</div>
<div class="col d-flex flex-row-reverse">
<button class="btn btn-outline-primary btn-sm" id="start-btn">
<i class="fas fa-microphone"></i>
Start Voice to Text
</button>
<button class="btn btn-outline-primary btn-sm" id="stop-btn">
<i class="fas fa-microphone-slash"></i>
End Voice to Text
</button>
</div>
</div>
</div>
<div class="col-12">
<button id="send-letter-btn" class="btn btn-danger" type="submit" value="submit">
<i class="fas fa-paper-plane"></i> Submit
</button>
</div>
</form>
</div>
</div>
</div>
</section>
<section id="how-to-mail" class="py-3">
<div class="container">
<div class="row">
<div class="col text-center">
<h3>How to mail your letter</h3>
<p class="fw-light">Instructions from the USPS</p>
</div>
</div>
<div class="row">
<div class="col mail-instructions">
<p>
<span class="number">1. </span>Print downloaded PDF with your letter
</p>
<p>
<span class="number">2. </span>Place letter in envelope
</p>
<p>
<span class="number">3. </span>Address letter to "Santa Claus, North Pole"
</p>
<p>
<span class="number">4. </span>Place First-Class Mail stamp to envelope
</p>
<p>
<span class="number">5. </span>Have parent mail your letter!
<br>
<small class="fw-light">Additional instructions for parents</small>
</p>
</div>
</div>
</div>
</section>
<footer class="py-5 bg-light">
<p>footer</p>
</footer>
<!-- hidden template goes here -->
<div id="hidden-template">
<div class="container">
<div class="row">
<div class="col">
<p id="letter-name"></p>
<p id="letter-age"></p>
<p id="letter-gender"></p>
<p id="letter-behavior"></p>
<p id="letter-wishlist-one"></p>
<p id="letter-wishlist-two"></p>
<p id="letter-wishlist-three"></p>
<p id="letter-message"></p>
</div>
</div>
</div>
<div id="elementH"></div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="./js/bootstrap.bundle.js"></script>
<script src="./js/form.js"></script>
<script src="./js/speech.js"></script>
<script>
var display_countdown = setInterval(function () {
countdown();
}, 10)
function countdown() {
var currentDate = new Date();
var christmasDate = new Date("12/25/2021 12:00:00");
var timeLeft = christmasDate.getTime() - currentDate.getTime();
var days_Left = Math.round(timeLeft / (1000 * 60 * 60 * 24));
if (currentDate.getTime() !== christmasDate.getTime()) {
days_Left - 1;
document.getElementById('countdown_days').innerHTML = "Christmas is in " + days_Left + " Days!";
} else {
document.getElementById('countdown_days').innerHTML = "MERRY CHRISTMAS!";
}
display_countdown;
}
</script>
</body>
</html>
Note: In order to make your code work in my environment I had to made some changes. Like putting entire style.css in <style> tag, added meta referer tag, added bootstrap cdn link. Remove the animation if you don't like it.
Compress the background image it's too big 1.77mb. Convert it to jpg, because the png is not transparent.
That should work just great if you add img-fluid to the image Class.
<img src="https://i.imgur.com/4n4uujr.png" class="img-fluid">
I have a HTML which has a div with multiple inputs(with placeholder). For some reason the placeholder is not displayed properly.Also, need the 2 input button(text) to be placed next to each other.
Here is the jsfiddle.
http://jsfiddle.net/o2qt6910/
HTML
<div class="container">
<div class="row row-bordered voffset4">
<div class="col-md-12">
<label class="radio-inline"><input type="radio" name="optradio">Aisles</label>
<label class="radio-inline"><input type="radio" name="optradio">Poses</label>
<label class="radio-inline"><input type="radio" name="optradio">Exclusion Zones</label>
</div>
</div>
<div class="row row-bordered">
<div class="col-md-4">
<button type="button" class="btn" id="add-aisle">Add</button>
<div id="aisle-coordinate-container">
<div class="col-md-1"> <input type="text" class="form-control" id="inputKey" placeholder="X"> </div>
<div class="col-md-1"> <input type="text" class="form-control" id="inputValue" placeholder="Value"> </div>
</div>
</div>
<div class="col-md-8">
<canvas id="myCanvas"></canvas>
</div>
</div>
<!--<div class="row">-->
<!--<img src="/static/images/lena.png" alt="Italian Trulli">-->
<!--</div>-->
</div>
CSS
#import "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css";
.row-bordered:after {
content: "";
display: block;
border-bottom: 5px solid #ccc;
margin: 0 25px;
}
.voffset { margin-top: 2px; }
.voffset1 { margin-top: 5px; }
.voffset2 { margin-top: 10px; }
.voffset3 { margin-top: 15px; }
.voffset4 { margin-top: 30px; }
.voffset5 { margin-top: 40px; }
.voffset6 { margin-top: 60px; }
.voffset7 { margin-top: 80px; }
.voffset8 { margin-top: 100px; }
.voffset9 { margin-top: 150px; }
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
Try this:
<div class="row row-bordered">
<div class="col-md-4">
<div class="col-xs-12">
<button type="button" class="btn col-xs-2" id="add-aisle">Add</button>
</div>
<div id="aisle-coordinate-container">
<div class="col-sm-6">
<input type="text" class="form-control" id="inputKey" placeholder="X">
</div>
<div class="col-sm-6">
<input type="text" class="form-control" id="inputValue" placeholder="Value">
</div>
</div>
</div>
<div class="col-md-8">
<canvas id="myCanvas"></canvas>
</div>
</div>
There is some issue in Fiddle in alignments. I've tested this in my browser, input elements are now in one line with placeholders visible properly.
<div class="row row-bordered">
<div class="col-md-4">
<button type="button" class="btn" id="add-aisle">Add</button>
</div>
</div>
<div class="row">
<div id="coordinate-container">
<div class="col-md-3 col-sm-3"> <input type="text" class="form-control" id="inputKey" placeholder="X"> </div>
<div class="col-md-3 col-sm-3"> <input type="text" class="form-control" id="inputValue" placeholder="Value"> </div>
</div>
</div>
<div class="col-md-8">
<canvas id="myCanvas"></canvas>
</div>
</div>
Is this how you want it to be? I'm having a hard time visualising what is it that you want.
Do you want the add button and the inputs on the same line or next?
Edit: Changed the button to be on another row. There is no need for it to be on the same row, if you want it on another line.
Its not an issue with the code but more how you are using the bootstrap grid. Your parent container has col-md-4 but the div with the input boxes have col-md-1 which only 1/4th of the width to be shown so its squished down. If you remove the col-md-1 classes it shows up correctly.
Quick suggestion: If you want to use a col-md-x class you can add row class to the <div id="coordinate-container">
I am having a very minor issue but i have been trying to fix it for few hours with no luck at all. I have a simple page that uses bootstrap. Following is the screenshot.
In this screenshot, I had my browser window maximized. As you can see the search bar is centered well and the names of 3 favorite players in the bottom are not. Now when i make the browser window size half of it. This is what i see.
Now the search bar no longer is center and the names of favorite players are centered. This is definitely not responsive as it should be.
Problem
I have identified two issues. One is that the search bar is somehow not releative and the names of the players are not. So I tried various css by making its div to absolute and relative and messed around with padding but no luck.
I am sure i am missing something here and this might be a stupid question but it would help me because i have been stuck on this for long while now.
I have uploaded my code on BOOTPLY
Following is my HTML code:
<div class="container-fluid">
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
<!-- <div class="row">
--> <div class="col-lg-4">
<div class="searchPage-box text-left">
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
<!-- </div> -->
</div>
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title" class="row">FAVORITES</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
<!-- this favorites are hard-coded for now for purposes of demo -->
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
</div>
</div>
</div>
I highly appreciate all suggestions and approaches.
do not copy, learn how it works by looking at this example
This absolute not the correct way but give you a small idea!
Any questions ?? comment away! :)
#searchPage-small-title {
color: rgba(128, 128, 128, 1);
font-size: 16px;
font-family: "Open Sans";
text-align: center;
font-weight: 700;
}
#searchPage-title {
color: rgba(128, 128, 128, 1);
font-size: 50px;
font-family: "Open Sans";
text-align: center;
}
.searchPage-box {
text-align: center;
}
.searchPage-input {
width: 80%;
border-style: solid;
border-radius: 6px;
border-color: rgba(192, 189, 178, 1);
height: 59px;
font-size: 18px;
text-indent: 32px;
}
.fa-star {
color: rgba(220, 118, 28, 1);
}
#searchPage-favorites-title {
color: rgba(128, 128, 128, 1);
font-size: 18px;
font-family: "Open Sans";
text-align: center;
font-weight: 400;
margin-top: 40px;
margin-bottom: 30px;
}
.searchPage-favorites-item {
color: rgba(128, 128, 128, 1);
font-size: 20px;
font-family: "Open Sans";
display: inline-block;
text-align: center;
font-weight: 800;
padding-top: 30px;
height: 115px;
width: 140px;
border: 1px solid #444;
margin: auto 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="container-fluid">
<!--row I-->
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-small-title">NBA</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!--row II-->
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!-- row III -->
<div class="row" style="background-color: #eeede7; padding-bottom:100px;">
<div class="col-lg-12">
<div class="searchPage-box">
<form role="form" class="form" ng-submit="submit()">
<div class="form-group">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
</form>
</div>
</div>
</div>
<!-- row IV -->
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title">FAVORITES</div>
</div>
<div class="col-lg-1">
</div>
</div>
<!-- row V -->
<div class="row" style="background-color: #eeede7; padding-bottom:100px; text-align: center;">
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Jordan</i>
</div>
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Lebron</i>
</div>
<div class="col-lg-4 searchPage-favorites-item">
<i class="fa fa-star">Curry</i>
</div>
</div>
</div>
Edit:
The following div have the class col-lg-4 meaning the width if the available space will be 33,333333%. Also the first child of this div has text-left class. If you adjust col-lg-4 to col-lg-12 and the first child with text-left to text-center you will have the desire result.
Edit:
and alter the next css:
.searchPage-box {
/* padding-left: 590px; remove */
width: 100%;
margin-bottom: 60px;
border-radius: 0 0 0 0;
}
(from http://www.bootply.com/zYFA6mqMO1)
<div class="col-lg-4">
<div class="searchPage-box text-left">
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
Not at my computer now, so I will have to answer more fully in a bit, but one thing that jumps out to me: instead of having empty divs with bootstrap columns, use offsets; for example, col-lg-offset-1.
EDIT: Expanding my answer.
Here is a link to my forked version of your Bootply, showing my changes. The following is a small portion of the bootply:
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-xs-10 col-xs-offset-1">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
Yuri's answer does a pretty good job of explaining the issues you're coming up against. If you're going to use Bootstrap, in general, you need to only use Bootstrap's layout classes to set your layout - adding custom positions and other things like that can really mess with the page, as you've seen.
I won't go into a detailed explanation of the changes I made, in the hopes that you can have a look and figure out what makes it work, but I do have some notes:
First, rather than lg, it's better to define at least an xs behavior, and work your way up to bigger screens. By only defining col-lg-x classes for most of your items, you're not defining a responsive layout for viewports below that size.
Second, there were a couple places where you had row classes nested directly inside other row classes. This can also cause issues. The intended method of use is
<div class="row">
<div class="col-xs-x">
<!-- if you need to define another grid inside the above div,
start another row -->
<div class="row">
</div>
</div>
</div>
Third, as I mentioned in my initial response, rather than adding empty divs with column classes (which will be collapsed automatically), use col-{size}-offset-x classes on the first div in the row (in addition to the regular col-{size}-x class). Also, related to alignment: rather than using text-align: center, you can just add bootstrap's text-center class to what you want to center.
The only issue in my version is that the favorites box overlap on a small screen - this is because of their defined size. I'll leave that to you to fix.
I hope this answer helped you, and please let me know if you have any questions about my answer.
Heres what you should note:
.searchPage-box {padding-left: 590px}
Using padding-left and setting pixels is a bad idea, because when the screen size does change, pixels don't auto change. So if you want to center it, try this:
margin-left: auto !important;
margin-right: auto !important;
display: block !important;
width: 30% !important;
Those go under
.searchPage-box
Hope I helped :)
Your div around the search bar this one:
uses your css class searchPage-box, that one is using padding left 590px
.searchPage-box {
padding-left: 590px;
width: 100%;
margin-bottom: 60px;
border-radius: 0 0 0 0;
}
This cause 590px to the left of the search bar to be unused.
<div class="container-fluid">
<div class="row bg-success" style="background-color: #f6f5f1;padding-top:100px; padding-bottom:100px;">
<div class="row">
<div class="col-lg-10 col-lg-push-1">
<div id="searchPage-small-title">NBA</div>
</div>
</div>
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-title">Player Portal</div>
</div>
</div>
<!-- change in code is here -->
**<div class="row">
<div class="col-lg-6 col-md-6 col-sm-4 col-md-offset-2 col-lg-offset-3 col-sm-offset-1 text-left">**
<form role="form" class="form-inline" ng-submit="submit()">
<div class="form-group">
<div class="row">
<div class="col-lg-4">
<input type="text" class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
</div>
</form>
</div>
</div>
<!-- </div> -->
</div>
<div class="row bg-warning" style="background-color: #eeede7; padding-bottom:100px;">
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-10">
<div id="searchPage-favorites-title" class="row">FAVORITES</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
</div>
<!-- this favorites are hard-coded for now for purposes of demo -->
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
</div>
</div>
</div>
You are using col-sm-2 on the footer div but you lose responsive behaviour when you set width:140px in .searchPage-favorites-item.
Remove that rule and .col-sm-4 and use .col-sm-offset-3 instead:
<div class="col-sm-2 col-sm-offset-3 searchPage-favorites-item">
<i class="fa fa-star"></i>
Jordan
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Lebron
</div>
<div class="col-sm-2 searchPage-favorites-item">
<i class="fa fa-star"></i>
Curry
</div>
or better
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div class="row">
<div class="col-sm-2 col-sm-offset-3 searchPage-favorites-item"><i class="fa fa-star"></i> Jordan</div>
<div class="col-sm-2 searchPage-favorites-item"><i class="fa fa-star"></i> Lebron</div>
<div class="col-sm-2 searchPage-favorites-item"><i class="fa fa-star"></i> Curry</div>
</div>
</div>
</div>
For what concerns your form, if you want to have it centered and you have 1 column at end row, you have to have one at the beginning too (or you set offset-1)
<div class="row">
<div class="col-lg-10 col-lg-offset-1 text-center">
<input class="searchPage-input" autocomplete="off" ng-model="selected" placeholder="Search Player" typeahead="sponsor as label(sponsor) for sponsor in sponsorList
| filter:$viewValue | limitTo:12" typeahead-editable="true" typeahead-min-length="2" required="" name="sponsorName" type="text">
</div>
<div class="col-md-1">
<!-- using Bootstrap default for button -->
</div>
</div>
Or just use .col-lg-12 on it
Remember: with bootstrap you rarely have to deal with layout positioning in your custom css, since you can obtain a lot just using its classes. You should just style colors, shadows, text and things like these
I have a new weird html/bootstrap/jquery problem... When the screen have a certain width (more than the nav-toggle width, but less than the normal width), all select boxes gets "disabled".
Check my jsFiddle here. Notice then on wide screens it works perfectly, but on medium sies it does not show, while om small it works good again.
Don't really know how to search for this problem, but the searches I have done have returned nothing of interrest. Hope you guys have a clue...
I have tested the latest Chrome, and IE, an interresting thing though is that earlier versions of IE works as expected (9 and 10), but Edge/11 does not work.
<div class="container kidliste" style="" id="HEADER_243">
<div class="row" onclick="clickMessageList(243);">
<div class="col-sm-3">
<div class="text-left" style="display: inline-block; font-size: 0.8em; margin-top: 7px; margin-left: 2px">
<i class="fa fa-clock-o"></i> 27.02.2014 - 23:31
</div>
<div class="text-right" style="display: inline-block; font-size: 0.8em;">
<i class="fa fa-phone"></i> 40055206
</div>
</div>
<div class="col-sm-7">
<div style="display: inline-block">
<p style="margin: 0; overflow: hidden; height: 1.2em; margin: 3px;">
<a style=" ">test pricegroup</a>
</p>
</div>
</div>
<div class="col-sm-2 text- text-right">
</div>
</div>
</div>
<div class="panel panel-default midliste" data-kid="243" id="MELDINGER_243" style="margin: 0 0 25px 80px">
<div class="panel" style="margin: 2px;padding: 0; margin-bottom: 5; padding-bottom: 0; color: #D17600">
<div class="row">
<div class="col-sm-2" style="padding: 2px; margin-left: 15px">
27.02.2014 - 23:31 </div>
<div class="col-sm-7" style="display: inline-block ; min-height: 3em;">
test pricegroup </div>
<div class="col-sm-2 pull-right text-right" style="margin-right: 25px;">
<a onclick="confirmSensur(1043, 243)" style="text-decoration: underline; font-size: 0.8em;">Sensurer melding!</a>
</div>
</div>
</div>
<div class="panel" style="margin: 2px;padding: 0; margin-bottom: 5; padding-bottom: 0; color: grey">
<div class="row">
<div class="col-sm-2" style="padding: 2px; margin-left: 15px">
27.02.2014 - 23:31 </div>
<div class="col-sm-7" style="display: inline-block ; min-height: 3em;">
Meldingen er mottatt og vil bli behandlet så snart som mulig. Mvh Legene på Høyden </div>
<div class="col-sm-2 pull-right text-right" style="margin-right: 25px;">
</div>
</div>
</div>
<div class="panel" style="margin: 2px;padding: 0; margin-bottom: 0; padding-bottom: 0">
<div class="row">
<div class="col-md-2" style="margin-left: 15px"></div>
<div class="col-md-8">
<form class="form-inline sendMessage" id="sendMessage_243" role="form" method="post" action="index2.php?page=Innboks&action=sendMelding">
<input type="hidden" name="kid" value="243">
<input type="hidden" name="type" value="0">
<div class="input-group">
<span class="input-group-addon btn btnStandardmelding" onclick="$(this).MessageWiz('#TEXT_243')">
Standardmelding <i class="fa fa-caret-right"></i>
</span>
<textarea id="TEXT_243" name="msg" class="form-control custom-control" rows="2" style="resize:none;"></textarea>
<span onclick="$(this).parents('form').submit()" class="input-group-addon btn">Send</span>
</div>
</form>
</div>
</div>
</div>
<div class="panel" style="margin: 2px;padding: 0; margin-bottom: 0; padding-bottom: 0">
<div class="row">
<div class="col-md-2" style="margin-left: 15px"></div>
<div class="col-md-8">
<form id="oppdaterStatus_243" action="index2.php?page=Innboks&action=oppdaterStatus" method="post" class="form-horizontal oppdaterStatus">
<input type="hidden" name="kid" value="243">
<div class="form-group container" style="margin-left: -15px">
<label class="control-label col-sm-1" for="innboks">Flytt:</label>
<div class="col-sm-3">
<select class="input-xlarge form-control" name="innboks" id="innboks">
<option value="2">Ferdig</option>
<option value="1" selected="">Ubehandlet
</option>
<option value="4">Diverse</option>
<option value="3">Arbeidsliste
</option>
</select>
</div>
<label class="control-label col-sm-1" for="tag">Tag:</label>
<div class="col-sm-3">
<select id="tag" class="input-xlarge form-control" name="tag">
<option value="0">-</option>
<option value="1">Morten Andre Pedersen</option>
<option value="2">Richard Hagen</option>
<option value="47">Ola Nordmann</option>
<option value="58">Test Testesen</option>
</select>
</div>
<div class="text-right col-md-3">
<button type="submit" class="btn btn-default">Lagre oppdatering</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
The "Lagre oppdatering" button is displaying as a block element and covers the floating elements to the left (so you can't click them). Changing its style from text-align: right to float: right fixes it. But if you want to display elements below, you're going to need to use clear: both eventually.
In this bootply the welcome as well as the form is coming on the left hand side.But I want to bring it at the centre.Can any body please tell me how to do?
<form id="form1">
<div class="container-fluid">
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-bottom: 6px; margin-top: 0px; background: #efeee9">
<img src="ui_resources/img/ title.jpg" alt="" align="left">
<h2 align="center" style="margin-top: 18px;"></h2>
</div>
<div class="span1"></div>
</div>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="background: #eee; border: 1px solid #ddd;">
<div class="span7 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div><!--/span-->
<div class="row-fluid">
<div class="well span7 center login-box">
<div class="alert alert-info">
Please login with your Username and Password.
</div>
<fieldset>
<div class="input-prepend" title="Username" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-user"></i></span><input autofocus="" class="input-large span10" name="j_username" id="username" type="text" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Password" data-rel="tooltip" style="margin-left:80px;">
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="j_password" id="password" type="password" value="">
</div>
<div class="clearfix"></div>
<div class="input-prepend" style="margin-left:80px;">
<label class="remember" for="remember"><input type="checkbox" id="remember" style="display:">Remember me</label>
</div>
<div class="clearfix"></div>
<p class="center span6" style="margin-left:80px;">
<button type="submit" class="btn btn-primary">Login</button>
New Userregister
</p>
</fieldset>
</div><!--/span-->
</div><!--/row-->
</div><!--/row-->
</div>
<div class="span1"></div>
</div></form>
<div class="row-fluid">
<div class="span1"></div>
<div class="span10" style="margin-top: 6px;">
<div class="span1"></div>
</div>
</div>
try to set your welcome div in another div like this
<div class="row-fluid">
<div class="offset3 span6 center login-header">
<h2 style="color:#E86537 " align="center">Welcome </h2>
</div>
</div>
use offset
Move columns to the right using .offset* classes. Each class increases
the left margin of a column by a whole column. For example, .offset4
moves .span4 over four columns.
DEMO
Try using this in your CSS
.row-fluid .login-header,
.row-fluid .login-box{
float:none;
margin:0 auto !important;
}
Since .span* has float: left style by default, you can override it by using float:none;
.login-box {
margin:0 auto;
float:none;
}
margin:0 auto; is used to center your loginbox horizontally.