Bootstrap aligning h2 and accordion - html

I have a sidebar on the right that uses 3 elements of a bootstrap grid. I am trying to have the content always to the right of this sidebar (so they must always take up 9). I currently have an accordion and an h2, however I am having a difficult time left-aligning them with the rest of the content on the page. The sidebar is coded as follows:
<div class="col-md-3">
<div class="list-group">
example
</div>
</div>
Each "content div" is as follows (these are aligning properly)
<div class="col-md-9 pull-right">
<div class="panel panel-default">
<div class="panel-heading">
<h4>title</h4>
</div>
<div class="panel-body">
<p>content</p>
</div>
</div>
</div>
This is the h2 and accordion that isn't properly aligning with the content.
<div class="col-md-9 pull-right">
<div class="row">
<div class="col-md-12">
<h2 class="page-header col-md-9 pull-left">Action Strategies: What We Can Do Now</h2>
</div>
</div>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading together">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">What We Can Do Together</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
<ul>
<li>list</li>
</ul>
</div>
</div>
</div>
Image to help visualize the problem
without pull-right

Remove the pull-right from the classes list:
<div class="col-md-9 pull-right">
<!-------------------^^^^^^^^^^ This is the culprit to pull it to the right.
The pull-right class just adds float: right !important; to the styles, which make the content to be pushed right.

Related

accordion - one panel nested in some div

How I can nested one panel in div?
Problem is when this panel nested in div is open then cannot close when I open other panel. I need this because I am going to hide few panel. The div which panels are nested I want to set on display: none.
<div class="panel-group" id="accordion1">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">Panel 1</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">Panel 2</div>
</div>
</div>
<div class="divWhichIWantHide">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseThree">
Collapsible Group Item #1
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">Panel 3</div>
</div>
</div>
</div>
SAMPLE
When wrapping a div to another div, ask yourself : in what this particular div is special ? Can this div be avoided ?
In general, when you add a div to wrap another div, lets say this :
<div class="div1">
<div class="div2"></div>
</div>
You can merge the "class" to themselves, like you must have seen with Bootstrap components :
<div class="div1 div2"></div>
Doing that, you just have to be sure properties of div1 will not alter effect of css for class div2.
here is your fixed project : Editable Bootply sample

Not able to collapse panel

I'm trying to use bootstrap to have a collapsible panel.
Here's my html:
<div class="col-xs-12 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Amérique du nord/North America <span data-toggle="collapse" target-target="#panelBodyOne" class="collapsed">+</span></div>
<div id="panelBodyOne" class="panel-body collapse"> Test</div>
</div>
</div>
Can anyone tell me why this isn't working?
You have your target attribute named as target-target but it should be data-target.
<span data-toggle="collapse" data-target="#panelBodyOne" class="collapsed">+</span>
Add data-target attribute on your span Tag
try this code
<div class="col-xs-12 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Amérique du nord/North America
<span data-toggle="collapse" data-target="#panelBodyOne"
class="collapsed">+</span>
</div>
<div id="panelBodyOne" class="panel-body collapse">Test</div>
</div>
</div>

Move Bootstrap 3rd column to top of row after responding to breakpoint

I have this 3-column row in Bootstrap that looks like this:
At some break point, it flips vertical and becomes ordered top to bottom with the ABC list showing last as expected. I would like to know if there's a feature (like a data attribute) of Bootstrap that will move the ABC list of the third column to the vertical top of the row.. maybe an index or something implemented by Bootstrap. If not, this is the HTML snippet in question - is the same result achievable with CSS?
<div class="row">
<div class="panel panel-default col-md-4">
<div class="panel-heading">
<h3 class="panel-title">Weekly News</h3>
</div>
<div class="panel-body">
Panel body
</div>
</div>
<div class="panel panel-default col-md-4">
<div class="panel-heading">
<h3 class="panel-title">Daily Events</h3>
</div>
<div class="panel-body">
Panel body
</div>
</div>
<div class="list-group col-md-4">
A
B
C
</div>
</div>
You can use .col-md-push-* and .col-md-pull-* to reorder your columns.
<div class="container">
<div class="row">
<div class="col-md-4 col-md-push-8">
<div class="list-group">
A
B
C
</div>
</div>
<div class="col-md-4 col-md-pull-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Weekly News</h3>
</div>
<div class="panel-body">
Panel body
</div>
</div>
</div>
<div class="col-md-4 col-md-pull-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Daily Events</h3>
</div>
<div class="panel-body">
Panel body
</div>
</div>
</div>
</div>
</div>
JSFiddle
Bootstrap link: Column ordering

Bootstrap 3: Display panels inside their wells on browser resize

How can I get these panels to stay inside their wells when the browser window is resized (particularly to the width of a mobile device)? It'd probably be best to resize the well too. I have some overlapping issues as well.
Here's full width:
Here's mobile width (ish):
I'd like that Summary to be in the Volume & Fees well, on its own line, not overlapping with the other wells.
Here's the HTML:
<div class="container">
<div class="row clearfix" id="content-row">
<div class="col-md-12 column">
<div class="well" id="volume-fees-well">
<div class="row clearfix" id="volume-fees-row">
<div class="col-md-9 column" id="volume-fees-chart">
<div class="panel panel-primary" id="volume-fees-panel">
<div class="panel-heading">
<h3 class="panel-title">
Volume & Fees
</h3>
</div>
<div class="panel-body">
<svg></svg>
</div>
</div>
</div>
<div class="col-md-3 column">
<div class="panel panel-primary" id="volume-fees-summary-panel">
<div class="panel-heading">
<h3 class="panel-title">
Summary
</h3>
</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
<div class="well" id="vehicle-class-well">
I'm using D3 for the charts, which is what the svg is for.
I'm using the Bootswatch Yeti theme and the standard Bootstrap.css. The only CSS I've overridden from the Bootstrap.css is:
#content-row {
margin-top: 50px;
}
#volume-fees-row, #vehicle-class-row, #consignor-map-row, #buyer-map-row {
height: 450px;
}
.panel {
max-width: 100%;
}
.panel-body {
height: 400px;
}
Please let me know if you have any questions!
How can I get these panels to stay inside their wells when the browser window is resized
Just use the .col-xs-* class (instead of col-md-*):
<div class="container">
<div class="row clearfix" id="content-row">
<div class="col-xs-12 column">
<div class="well" id="volume-fees-well">
<div class="row clearfix" id="volume-fees-row">
<div class="col-xs-9 column" id="volume-fees-chart">
<div class="panel panel-primary" id="volume-fees-panel">
<div class="panel-heading">
<h3 class="panel-title">
Volume & Fees
</h3>
</div>
<div class="panel-body">
<svg></svg>
</div>
</div>
</div>
<div class="col-xs-3 column">
<div class="panel panel-primary" id="volume-fees-summary-panel">
<div class="panel-heading">
<h3 class="panel-title">
Summary
</h3>
</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
<div class="well" id="vehicle-class-well">

Need help changing order of boxes when screen resized

I am using Twitter Bootstrap to make a new website. I am having an issue with the responsive side to this.
You can view my current site now: http://www.monroeorm.com/SNOA/
When you resize the page the sidebars and primary content boxes aren't in the order I need them in. When I resize the page, such as on mobile, sidebar1 shows up before the primary content. I am trying to make it display after the content once the site is resized or viewed in mobile.
Here's what I've got so far:
HTML:
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Sidebar1</h3>
</div>
<div class="panel-body">
Sidebar1
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Primary Content</h3>
</div>
<div class="panel-body">
Primary Content
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Sidebar2</h3>
</div>
<div class="panel-body">
Sidebar2
</div>
</div>
</div>
</div>
</div>
CSS:
http://www.monroeorm.com/SNOA/css/bootstrap.css
I'm probably making this harder than it seems - is there any way to get this achieved?
Is missing "col-sm-12 col-xs-12" on declaration >> http://leoncio.me/dev/stack/20338694.html
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-12 col-xs-12">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Sidebar1</h3>
</div>
<div class="panel-body">
Sidebar1
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Primary Content</h3>
</div>
<div class="panel-body">
Primary Content
</div>
</div>
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Sidebar2</h3>
</div>
<div class="panel-body">
Sidebar2
</div>
</div>
</div>
</div>
</div>
You could use flexbox and then add a media query to reorder the divs when the browser width is a certain size.