HTML / CSS / JS / Bootstrap - Aligning content - html

I am working on creating a form page.
I have broken the problem into three meta challenges:
Creating the navigation within the form
Producing all the various inputs for the form
Appropriately display items from #2 based on selections in #1.
Right now, I am working on item #2
I have attached the output of my code from within Coda 2
I'm using an accordion for #1 and it appears to work just fine.
When I add the first two items from #2, they also appear to work just fine, staying aligned expected next to the accordion.
Ideally, what I want to do is align the lower radio buttons as well as any subsequent form inputs so they are immediately below the radio button/text inputs that are outside the sidebar and do not wrap under the accordion and into the sidebar. That is what is happening now.
I'm obviously missing something about how to apply my content within the bootstrap grid appropriately using containers, rows and class=col-md-n.
Marston
Here is what I think is the relevant code:
<!-- standard document stuff + jumbotron --->
<div class="container-fluid">
<div class="sidebar">
<div class="col-md-2">
<div class="panel-group" id="accordion">
<!-- NAVIGATION ITEMS --->
<!-- lots of working code that produces the accordion --->
</div>
</div>
</div>
<hr/>
<!-- radio buttons --->
<form class="form-horizontal">
<fieldset>
<!-- bunch of working code here that produces radio buttons --->
</fieldset>
</form>
<hr/>
<!-- Text input --->
<div class="main Content active Content">
<form role="form">
<div class="col-md-3">
<!-- more code here that produces text input --->
</div>
<!-- repeats for each form group --->
<!-- more code that works --->
</form>
</div>
</div>
<!-- check box section _-->
<!-- Preferred Contact Time --->
<form role="form">
<fieldset>
<div class="form-group">
<label class="col-md-3 control-label" for="radios1">Available Weekdays</label>
<div class="col-md-3">
<!-- Lots of radio button code --->
</div>
</div>
<!-- Repeats for 2nd set --->
</fieldset>
</form>

For disclosure, I haven't tasted your code.
From a quick look I have noticed that you're not putting your "col"s into rows. This will cause your layout to act strange.
Standard way to structure your elements is to use col inside row inside container :
<div class="container-fluid">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9"></div>
</div>
</div>
Hope that helps.

Related

How to fix checkbox select and deselect issue in angular js?

In my angular js project, I have four checkboxes. in that four checkboxes, three checkboxes have three conditions (like ng-hide and ng-show) and one checkbox has select all and deselects all conditions.
everything working fine. but initially if you select, select all checkbox everything got selected and conditions also working fine(other three checkboxes also got selected). but later without deselecting all checkbox if you uncheck the other three checkboxes that condition (like ng-hide and ng-show) not working.
Any way to fix this?
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app>
<div class="choose-group pt-0">
<input
type="checkbox"
ng-model="exptResultType.status"
value="1" >status
<input
type="checkbox"
ng-model="exptResultType.headercontent"
value=2>header
<input
ng-show="addNlpStepForm.restfulEntity.method != 'HEAD'"
type="checkbox"
ng-model="exptResultType.bodycontent"
value=3>body
<input
type="checkbox"
id="all"
ng-click="(exptResultType.status=exptResultType.all);
(exptResultType.headercontent=exptResultType.all);
(exptResultType.bodycontent=exptResultType.all)"
ng-checked="exptResultType.status&&exptResultType.headercontent&&
exptResultType.bodycontent"
name="exptResultType"
ng-model="exptResultType.all"
value=4>all
</div>
<!-- show status content-->
<div class="form-group pb-30 ts-col-100"
ng-show="(exptResultType.status==true)||(exptResultType.all==true)" >
status code
</div>
<!-- header content -->
<div class="form-group d-flex flex-wrap ts-col-100 pb-10"
ng-show="(exptResultType.headercontent==true)||(exptResultType.all==true)">
header
</div>
<!-- body content -->
<div class="form-group pb-0 ts-col-100" ng-show="(exptResultType.bodycontent==true)||(exptResultType.all==true)">
body
</div>
</div>
The problem is that exptResultType.all will still be true, while the checkbox for all is coupled to the other three values, the property itself is not. The easiest thing to do is ignore the fact it exists for computation purposes:
<!-- show status content-->
<div class="form-group pb-30 ts-col-100"
ng-show="exptResultType.status">
status code
</div>
<!-- header content -->
<div class="form-group d-flex flex-wrap ts-col-100 pb-10"
ng-show="exptResultType.headercontent">
header
</div>
<!-- body content -->
<div class="form-group pb-0 ts-col-100"
ng-show="exptResultType.bodycontent">
body
</div>

Form element within two separate grid columns

I have two forms on a page. Both I would like in the left column in a two-column layout, but the second form has input fields stretching onto the second column.
I could of course create two separate "rows". However, the design calls for the top position of the columns to be at the same height, like columns in a two-column layout typically display.
I don't believe this is necessarily related to Bootstrap because this might be solved with other methods, but I was wondering if Bootstrap had a quick solution for this
This following approach is obviously incorrect syntax and moves the form element in and out of flow, but this is basically what I'd like to accomplish:
<div class="container">
<div class="row">
<div class="col-md-6">
<form id="form1">
</form>
...
<form id="form2">
<!-- ... #form2 inputs ... -->
</div>
<div class="col-md-6">
<!-- ... #form2 inputs cont'd ... -->
</form> <!-- end of #form2 -->
</div>
</div>
</div>
I can already separate the forms on two separate rows, but of course, the right column is lower than the left column.
<div class="container">
<div class="row">
<div class="col-md-6">
<form id="form1">
</form>
</div>
</div> <!-- end of row -->
<div class="row">
<form id="form2">
<div class="col-md-6">
<!-- ... #form2 inputs ... -->
</div>
<div class="col-md-6">
<!-- ... #form2 inputs cont'd ... -->
</div>
</form> <!-- // end of #form2 -->
</div>
</div>
Is there any trick to "collapsing" the space above the right column if this is how the html should be structured, or is there a Bootstrap approach that I'm missing? Open to non-bootstrap methods if necessary.
Have you considered using just one form element to wrap the whole lot, and then separating the two forms using their name attributes? For example:
value="form1[field_name]"
value="form2[field_name]"

Bootstrap 4 grid issue

I'm having some problems of respecting the grid of bootstrap 4. I have a content of col-sm-9 and a right sidebar of col-sm-3 float-right. But the sidebar does not start from the top, but start just after the end of col-sm-9. I would like to align both the column.
Here is how the page it is looking:
Here you can inspect the code of the page: Code
This is basically my html:
<section class="row clearfix" ng-cloak>
<div class="content-top no-gutters">
<div style="background-image: url({{post.better_featured_image.source_url}});" class="content-tracks-image">
</div>
<div class="content-featured-image">
<img>
</div>
</div>
<div class="clearfix"></div>
<div class="gs-track col-sm-9"><!--start player-->
<!---player--->
</div><!-- close player -->
<div class="col-sm-9 bg-white pt-3 pb-3" ng-cloak><!-- start content-->
<!--content->
</div><!-- close content -->
<div class="col-sm-3 float-right pt-3"><!-- start sidebar -->
<!-- sidebar -->
</div><!-- close sidebar -->
</section>
I was able to align the sidebar to the content but I had to move the sidebar box before the player, and I don't want to have this behaviour.
It was difficult working with your supplied link since when I tried to run the HTML I would not get the same content. But upon manually putting in my own content and trying to recreated I found that using bootstraps ROW on a container div worked.
<div class="row">
<div class="col-sm-9">CONTENT</div>
<div class="col-sm-3">SIDEBAR</div>
</div>
Try it and let me know if it works.

Switch element positions with css from above to aside when using Bootstrap 3.0 griding

I'm using Bootstrap 3.0 with its grid system and have on my page two divs one above the other.
I want to let the users the ability to switch the view so these divs will be one aside the other (on clicking a button). Can I do it using only CSS3?
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="alert alert-info">
<!-- first div content-->
</div>
<div class="alert alert-info">
<!-- second div content-->
</div>
</div>
</div>
</div>
You can use input checkbox for control state and make lable as button. Checkbox must be placed before your code.
In HTML:
<input type="checkbox" id="checkbox">
<label for="checkbox">It's button</label>
<div class="your_div">Your div</div>
Then you have two chunk of CSS:
#checkbox{ %unchecked state% }
#checkbox ~ .your_div{ %unchecked state% }
and
#checkbox:checked{ %checked state% }
#checkbox:checked ~ .your_div{ %checked state% }
Some time ago I test this trick http://codepen.io/KZee/pen/JdZeqv and it works perfect.

Unfixed div overlapping fixed div on bootstrap 3

I currently have my layout page divided into two columns using bootstrap 3 with something similar to this.
<div class="row">
<div class="col-md-4 info">
<!--some Markup -->
</div>
<div class = "col-md-8 tasks-column">
<!--some Markup -->
</div>
</div>
I want the div with class "info" to stay fixed on the top left side when scrolling the page. When I try the bootstrap "affix" class the content in "info" effectively gets fixed but the "tasks-column" suddenly moves all the way to the left completely covering it.
I have also tried the plain css position:fixed; on "info" but it does not do anything.
The content in info is NOT a navigation panel.
Thank you guys.
Edit: the content in info is dynamic (it varies depending on the user input).
You need to offset the tasks-column. Try this.
<div class="row">
<div class="col-md-4 info">
<!--some Markup -->
</div>
<div class = "col-md-8 col-md-offset-4 tasks-column">
<!--some Markup -->
</div>
This is because you are fixing the content that pushes "tasks-column" to the right.
The simple way to do what you want is just to move "info" inside col-md-4, like this:
<div class="row">
<div class="col-md-4">
<div class="info">
<!--some fixed Markup -->
</div>
</div>
<div class="col-md-8 tasks-column">
<!--some Markup -->
</div>
</div>
Hope this helps!