SorryEh
SorryEh

Reputation: 928

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

Upvotes: 1

Views: 1582

Answers (2)

JPeG
JPeG

Reputation: 821

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; 
}

Upvotes: 0

Teuta Koraqi
Teuta Koraqi

Reputation: 1898

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!

Upvotes: 3

Related Questions