bootstrap adding color to a column - html

So I have this issues with bootstrap I have a row with 3 column:
col-md-4
col-md-8
col-md-2
All the information that I want to display are in col-md-8. I want to add a background color behind it but not to the whole column just the button and the information that I have display.
Here is the picture of the outcome right now:
And I do not want that I want something like this:
The background color only cover the information rather than cover the whole column.
Here is the code:
<div class='container-fluid'>
<div class="row">
<div class ="row " style = "margin-bottom: 5px;padding:0px;margin-right: 0px;margin-left:0px; ">
<div class = "col-md-4" style = "margin:0px;padding:0px;"></div>
<div class = "col-md-8" style = "border:none;margin:0px;background-color: #dcfdd7;">
<div class = "row ">
<div class = "col-md-12 " style = "margin:0px;padding:0px;">
<div class = "col-md-6">
<g:if test="${cus.status =='Inactive'}">
<g:form class="activateStatus" controller="customer" action="activateStatus" id = "${cus.id}">
<button type="button" class="btn btn-success activate-Status" style ="color:white;font-weight: bold">Activate</button>
</g:form>
</g:if>
<g:if test="${cus.status =='Active'}">
<g:form class="changeStatus" controller="customer" action="changeStatus" id = "${cus.id}">
<button type="button" class="btn btn-danger change-Status" style ="color:white;font-weight: bold">Deactivate</button>
</g:form>
</g:if>
<g:link action="index" controller="customer"><button id = "back" type="button" class="btn btn-primary" style = "font-weight: bold">Back</button></g:link>
<g:link action="editCustomer" id="${cus.id}"><button id = "edit" type="button" class="btn" style = " font-weight: bold;color: white;background-color:#1f549c"><i id = "add-icon" class="fa fa-edit" aria-hidden="true"></i>Edit</button></g:link>
</div>
<div class = "col-md-4"></div>
<div class = "col-md-2"></div>
</div>
</div>
<div class = "row" style = "padding:0px;margin:0px;">
<div class = "col-md-12">
<div class="row">
<div class="col-md-4" style = "padding:0px;margin:0px;">
<h4>Name:</h4>
</div>
<div class="col-md-5" style = "padding:0px;margin:0px;">
<h4>${cus.name}</h4>
</div>
</div>
<div class="row">
<div class="col-md-4" style = "padding:0px;margin:0px;">
<h4>Code:</h4>
</div>
<div class="col-md-5" style = "padding:0px;margin:0px;">
<h4>${cus.code}</h4>
</div>
</div>
<div class="row">
<div class="col-md-4" style = "padding:0px;margin:0px;">
<h4>Contact Person:</h4>
</div>
<div class="col-md-5" style = "padding:0px;margin:0px;">
<h4>${cus.contactPerson}</h4>
</div>
</div>
<div class="row">
<div class="col-md-4" style = "padding:0px;margin:0px;">
<h4>Status:</h4>
</div>
<div class="col-md-5" style = "padding:0px;margin:0px;">
<h4>${cus.status}</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="customerId" value="${cus.id}">
</div>
</div>
</div>
Many thanks.

i tried to make the same website but your code is too complicated for the simple question you are asking , the main concept you should remember is "keep it simple" so it would be easy to help you , and for your self .
code :
https://stackblitz.com/edit/web-platform-v9i4fh?file=index.html
live website :
https://web-platform-v9i4fh.stackblitz.io/
here is a way of doing it , but in your code you have too much stuff going on , it is really difficult to understand how to solve it there . you need to remember the main concept of CSS . in a couple of minutes i will go through your code and will try to figure out what is going on

Related

How to write something in between two ".col-md-*"?

I am trying to write an "or" in between 2 ".col-md-1".
For example:
Green or Blue
This is my code:
<div class="row">
<div class="col-md-1">
<button class="btn">Green</button>
</div>
<div class="col-md-1">
<button class="btn">Blue</button>
</div>
</div>
What should I write inside the code or should I try another technique?
You could add another col-md-1 between the 2 elements (or whatever column size suits your needs):
<div class="row">
<div class="col-md-1">
<button class="btn">Green</button>
</div>
<div class="col-md-1">
<p>or</p>
</div>
<div class="col-md-1">
<button class="btn">Blue</button>
</div>
</div>
Depends on how the result should look like. You can do something like this for example:
<div class="col-md-3">
<button class="btn"> Green </button> or <button class="btn"> Blue </button>
</div>
Give them and ID.
<div class="row">
<div class="col-md-1" id="green">
<button class="btn">Green</button>
</div>
<div class="col-md-1" id="blue">
<button class="btn">Blue</button>
</div>
</div>
and then you can select the first one and append an element after it
$("$green").after('<div>OR</div>')
give them an ID & do the if else in Javaascript
<div class="row">
<div id="greenDiv" class="col-md-1">
<button class="btn">Green</button>
</div>
<div id= "redDiv" class="col-md-1">
<button class="btn">Blue</button>
</div>
</div>
in js
<script>
$(document).ready(function(){
if(someCondition == true){
$("#redDiv").show();
$("#greenDiv").hide();
}else{
$("#redDiv").hide();
$("#greenDiv").show();
}
});
</script>

How to get bootstrap col appear side by side

I am usually able to do this. But for some reason everything I've tried just isn't working.
I've tried
<div class="row">
<div class="col-md-8">
<button>Toronto</button>
<button>Markham</button>
<button>Petawawa</button>
</div>
<div class="col-md-4">
<p>date</p>
<p>date</p>
<p>date</p>
</div>
</div>
And similar variations, but I can't seem to get the date and the event location to line up.
The code where the issue is occuring:
<div id="Location">
<div class="container">
<div class="row">
<div class="col-md-6 col-xs-12 aboutCopyContainer">
<p class="copyHeader" style="font-family: testFont;">Locations</p>
<p class="faqContent">Fall for the FEAST at an event near you!</p>
<div class="row">
<div class="col-md-6">
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Toronto.html'">Toronto</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">14</p>
<hr style="margin:0px;" />
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Petawawa.html'">Petawawa</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">7</p>
<hr style="margin:0px;"/>
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Markham.html'">Markham</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">22</p>
<hr style="margin:0px;"/>
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Here is the JS Fiddle of what's happening:
JSFiddle
and this is the website (under Locations section) to give you a better idea of what I'm trying to do (css styling etc applied).
Oktoberfeast Locations
Any suggestions are greatly appreciated! thank you for your time
You added fixed width inside bootstrap column child. And that width together with other element width exeeded bootsrap column width, so the class locationDateCont appeared underneath:
So, in your CSS file, remove that width from that class, and add this:
.btnLocationCont {
width: auto;
}
Hope this helps!
You probably don't want to do this that way. Reason being is on mobile devices they won't match up.
To keep them together and display on desktop and mobile you could do something like this:
<div class="row">
<div class="col-md-4">
<button>Toronto</button>
<p>date</p>
</div>
<div class="col-md-4">
<button>Markham</button>
<p>date</p>
</div>
<div class="col-md-4">
<button>Petawawa</button>
<p>date</p>
</div>
</div>
Fiddle:
https://jsfiddle.net/8t5mjhf8/4/
EDIT: To make sure the p's stay next to the buttons you need the following CSS. You will want to assign a class to the p's as to no interfere with other paragraphs.
p {
display: inline;
}

How to push form-control beside paragraph

I'm trying to push my form-control to the left beside of my paragraph. Which won't work it always put below of the paragraph.
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<div class = "panel-body">
<p class = "thicker">STUDENT ID</p>
<div class = "col-xs-3">
<input class = "form-control" name = "search">
</div>
</div>
</div>
<div>
<div>
Add col-xs-3 to your p tag and change the order of the elements inside the panel-body from
<div class = "panel-body">
<p class = "thicker">STUDENT ID</p>
<div class = "col-xs-3">
<input class = "form-control" name = "search">
</div>
</div>
to
<div class = "panel-body">
<div class = "col-xs-3">
<input class = "form-control" name = "search">
</div>
<p class = "thicker col-xs-3">STUDENT ID</p>
</div>
UPDATE Using bootstrap built in functionality
Bootstrap has already a functionality for what you are trying to do see http://getbootstrap.com/css/#forms-horizontal . Using the built in functionality might make things easier for you in the future when the window is being re-sized, etc. Here is what the code will look like
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<div class = "panel-body">
<form class="form-horizontal">
<div class="form-group">
<label for="studentID" class="col-xs-3 control-label">Student ID</label>
<div class="col-xs-3">
<input type="text" class="form-control" name="search" placeholder="Search">
</div>
</div>
</form>
</div>
</div>
</div>
</div>

Adjust Bootstrap width, but keep container class constraints

So I have a major style change whereas when all my views were originally setup I had used Bootstrap and relied on the container class to adjust for media queries at breakpoints of 1200px, 992px, and 768px. All my form input and other content work their padding and all off of the container for paddings, margins, etc... Now, it is requested that the width be 100%, but all the content to stay where it is so that the background colors styling fills the width of display.
I was trying to think of how I can add another container class to make this work over all of the views. What are some recommendations on this with keeping the constraints of content to the 1200px and so on (for media queries and such), but make the other areas spread to that 100%?
Here is an image capture of it now. It is just the tan and dark gray area with the topo image that would expand 100% while all else stays within constraints of container class.
And my code is structured as so you can see where my delima is with over-riding bootstraps container class:
<div class="container">
<form role="form">
<div class="naviaHead col-md-12">
<div class="naviaHeader">
<div class="inner">
<div class="col-md-6 loginArea">
<h1 class="col-md-8">Login</h1>
<div class="form-group">
<div class="form-group col-md-8 naviaInp">
<input type="text" name="userName" class="form-control" placeholder="username" data-ng-model="loginData.userName"autofocus>
</div>
<div class="form-group col-md-8 naviaInp">
<input type="password" name="passWord" class="form-control" placeholder="password" data-ng-model="loginData.password">
</div>
<div style="clear: both;">
<input type="button" class="naviaBtn naviaBlue" data-ng-click="login()" value="login">
<div data-ng-hide="message == ''" class="alert alert-danger">
{{message}}
</div>
</div>
<div class="loginForget">
<span><a class="naviaLink" href="#/logreg/forgotUser">forgot username</a> or <a class="naviaLink" href="#/logreg/forgotPass">forgot password</a></span>
</div>
<div class="sowLogin">
<img class="col-md-3" src="ppt/assets/images/login/sowIcon.svg">
<p class="col-md-9"><a class="naviaLink" href="https://pebb.flex-plan.com/part/PortalRegistration.aspx">PEBB eligible State of Washington employees please click here to access the portal</a></p>
</div>
</div>
</div>
<div class="col-md-6">
<img style="padding-left: 25%;" src="ppt/assets/images/login/naviaLogo.png">
</div>
</div>
</div>
</div>
</form>
<div class="loginLearn">
<div id="area1" class="col-md-4 learnSections">
<img src="ppt/assets/images/login/teaserImage1-full.png">
<div class="learnText">
<h3 class="teaserTitle">Online Account Access</h3>
<p class="teaserText">24/7 Access to balances, claim submissions and all things Navia!</p>
<button type="button" class="btn btn-primary learnButtons">learn more</button>
</div>
</div>
<div id="area2" class="col-md-4 learnSections">
<img src="ppt/assets/images/login/teaserImage2-full.png">
<div class="learnText">
<h3 style="margin-top: 0;" class="teaserTitle">Navia Benefits Card</h3>
<p class="teaserText">Don't wait for reimbursement!</p>
<button type="button" class="btn btn-primary learnButtons">learn more</button>
</div>
</div>
<div id="area3" class="col-md-4 learnSections">
<img src="ppt/assets/images/login/teaserImage3-full.png">
<div class="learnText">
<h3 style="margin-top: 0;" class="teaserTitle">FlexConnect</h3>
<p class="teaserText">Link your FSA to your insurnace and file claims instantly!</p>
<button type="button" class="btn btn-primary learnButtons">learn more</button>
</div>
</div>
</div>
<div style="background-color: #ede8e2; height: 150px; clear: both;">
<!-- intentionally blank -->
</div>
</div>
This will solve your purpose
<div class="container-fluid" style="background-color:red;">//This will be 100% width
<div class="container">//Inside this put your content as it was to make it indent as previous
//Your page HTML here
</div>
</div>

bootstrap3 text area too small

I have a textarea in the following HTML code with Bootstrap3, which is too small. I gave its parent div class="col-xs-6", and expect it to take about half of the page width. But on a 1300x768 screen in a maximized browser window, the text area is only about 1/8 of the screen width.
Can some help explain what's the cause of the small size and how to fix it?
Thanks
Code is below (and js fiddle):
<div class="container">
<div class="row">
<div class="col-xs-6 col-md-6">
<div class = "row">
<textarea id="dataquery" name="data"></textarea>
</div>
<div class = "row">
<button id="datasubmit" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-arrow-right"></span></button>
</div>
<div class = "row">
Status: <br/>
<span id="dataresult"> </span>
</div>
</div>
<div class="col-xs-6 col-md-6">
Results:
<div class="table-responsive">
<table id="datatable" class="table table-striped table-bordered">
</table>
</div>
</div>
</div>
</div>
You can use bootstrap class form-control to textarea like
<textarea id="dataquery" name="data" class="form-control"></textarea>
This class takes 100% width of the parent