I work on sorting images on a website. I am given option to click either one of three buttons depending on the number of people in an image. The buttons have the below html structure and IDs.
<div>
<div class="col-6 col-md-3">
<button id="radio-0-choice-btn" class="submit-btn second-choice-btn">None</button>
</div>
<div class="col-6 col-md-3">
<button id="radio-1-choice-btn" class="submit-btn second-choice-btn">One</button>
</div>
<div class="col-6 col-md-3">
<button id="radio-2-choice-btn" class="submit-btn second-choice-btn">Two</button>
</div>
<div class="col-6 col-md-3">
<button id="radio-3-choice-btn" class="submit-btn second-choice-btn">Three +</button>
</div>
</div>
So if I decide the answer is button "Two", I want to be able to click ID "radio-2-choice-btn" using voice command.
Pardon me if I posted in the wrong group
Related
I'm having an issue with an input inside a Bootstrap card. I want it to behave as the button on the second card, but somehow it shrinks and stays in-line. I tried adding some min-width or fixing its width but can't make it work with the responsive behaviour of the button that stacks on top of the other on certain screen width and also shrinks and expands.
Here is the code on Bootsnipp and a screenshot of the issue:
Edit: Adding my code in the post as requested: This is the first card, the one with the input.
<div class="col-sm-12 col-md-6 col-lg-4 col-xl-3">
<div class="card">
<img class="card-img-top" src="https://dummyimage.com/600x600/55595c/fff" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">
Product title
</h4>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<div class="form-row">
<div class="col">
<select class="form-control btn-block">
<option>50</option>
<option>100</option>
<option>200</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>600</option>
</select>
</div>
<div class="col">
Add to cart
</div>
</div>
</div>
</div>
</div>
Just change the wrapper columns to col-12 use the 12 available ones, and add some margin bottom to the select with mb-3. The next code modification should work, i have tested it on your code:
<div class="form-row">
<div class="col-12 mb-3"> <!-- changes here ... -->
<select class="form-control btn-block">
<option>50</option>
<option>100</option>
<option>200</option>
<option>300</option>
<option>400</option>
<option>500</option>
<option>600</option>
</select>
</div>
<div class="col-12"> <!-- ... and here -->
Add to cart
</div>
</div>
I have a bootstrap grid system on my page and want two elements pulled to the right, but placed one below the other. This is the code I have right now. I want "Active" and "Primary" button place one below the other, but also pulled right. As of now, it looks like this:
If I were to add this to the button, then it aligns properly, but on mobile, it messes up.
<button type="button" class="btn btn-w-m btn-primary" style="margin-left: 261px;">Primary</button>
This is what I have so far. What can I do to achieve the desired result?
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row border-bottom white-bg dashboard-header">
<div class="col-md-3">
<h4>Dummy Name</h4>
<small>Dummy Street</small><br>
<small>Dummy Apt, Some City, Some State</small><br>
<small>United States</small><br>
</div>
<div class="col-md-3">
<h5>123-456-7890</h5>
</div>
<div class="col-md-3">
<h5>some_name#somecompany.com</h5>
</div>
<div class="col-md-3">
<h2 class="pull-right" style="margin-top: -5px">Active</h2><br>
<button type="button" class="btn btn-w-m btn-primary">Primary</button>
</div>
</div>
</div>
You do not need pull-right at all - all you need to right align the text of the heading and the button is text-align:right in the css or the text-right class on the parent div. Note that you need to open this snippet in "full screen mode due to the small size of the preview window.
I would also suggest that you put the css in its own style sheet rather than inline style rules. If you use text-align: right as a style rule then you can use a media query to apply it or left align on certain screen sizes as required.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row border-bottom white-bg dashboard-header">
<div class="col-xs-3 col-md-3">
<h4>Dummy Name</h4>
<small>Dummy Street</small><br>
<small>Dummy Apt, Some City, Some State</small><br>
<small>United States</small><br>
</div>
<div class="col-xs-3 col-md-3">
<h5>123-456-7890</h5>
</div>
<div class="col-xs-3 col-md-3">
<h5>some_name#somecompany.com</h5>
</div>
<div class="col-xs-3 col-md-3 text-right">
<h2>Active</h2><br>
<button type="button" class="btn btn-w-m btn-primary">Primary</button>
</div>
</div>
</div>
</div>
Im trying to create a navigation bar for my table using twitter bootstrap.
The end result would look something like this
Im trying to use bootstraps grid system for this and seem to have gotten the showing rows part to look as planned but cant get the buttons to be responsive when the user switches to mobile.
HTML
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8"> <!-- controls !-->
<div class="col-xs-12 col-sm-12">
Back
</div>
<div class="col-xs-12 col-sm-12">
First
</div>
<div class="col-xs-12 col-sm-12">
Previous
</div>
<div class="col-xs-12 col-sm-12">
Next
</div>
<div class="col-xs-12 col-sm-12">
Last
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"><!-- page number !-->
<div class="pull-right">
<span>Showing rows 1 to 10 of 20</span>
</div>
</div>
</div>
</div>
The buttons seem to only render on top of each other.
Here is a jsfiddle showing whats happening.
What about a button group?
<div class="btn-group" role="group" aria-label="...">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Back</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">First</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Previous</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Next</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Last</button>
</div>
<div class="btn-group" role="group">
<span>Showing rows 1 to 10 of 20</span>
</div>
</div>
EDIT added in showing rows and made more responsive on mobile devices
Each of your button is wrapped in a div with a bootstrap class "col-sm-12" and "col-xs-12" . This means that each of those div will occupy 12 columns EACH, thereby leaving no column for other buttons or divs to lie on the same row.
To obtain the desired result, change their classes to "col-sm-2" so that each button's div occupies two columns out of twelve.
I am learning how to use Twitter Bootstrap. I need to put two buttons in one row, one in the centre and the other to the right. The buttons are in the right positions column wise but they are in different rows.
Could anyone assist me with fixing my code below to get the two buttons on the same row?
<div class="row">
<div class="col-sm-6">
<p class="lead pull-right"><button class="btn btn-default ">Edit Button left</button></p>
</div>
<div class="col-sm-6 col-sm-offset-6">
<button class="btn btn-default lead pull-right ">Edit Button Right</button>
</div>
</div>
The problem is that on your second div class you use col-sm-offset-6. Delete this and it should align on the same row.
Using offset will give you a left margin of 6 columns, and since your first div already use 6 columns, there arent enough columns on the same row.
I agree with the above answer, here is the code from bootstrap page which has some fairly clear examples: http://getbootstrap.com/css/
<div class="col-sm-9">
<div class="row">
<div class="col-xs-8 col-sm-6">
<p class="lead pull-right"><button class="btn btn-default ">Edit Button left</button></p>
</div>
<div class="col-xs-4 col-sm-6">
<p class="lead pull-right"><button class="btn btn-default ">Edit Button Right</button></p>
</div>
</div>
It does leave a space between the buttons, I don't know if you want that there or not.
I am trying to get two buttons on the same line on mobile. The buttons are on the same line for the desktop but as soon as it goes mobile they stack on top of each other. I have tried adding an inline-block tag to the div class but they still stacked, albeit at the correct 50 50 size.
Here is my html:
<div class="buttonDiv">
<div class="row">
<div class="col-lg-6">
<button type="button" class="btn btn-primary btn-custom" id= "buttonCustom">SIGN UP</button>
</div>
<div class="col-lg-6">
<button type="button" class="btn btn-primary btn-custom" id= "buttonCustom">CHECK STANDINGS</button>
</div>
</div>
</div>
and here is the relevant CSS:
.buttonDiv{
position:relative;
bottom:90px;
font-family: "Cabin Condensed";
font-weight:700;
display:inline-block;
}
#buttonCustom{
position:relative;
margin-bottom:10px;
height:10%;
width:100%;
}
css looks like an overkill, unless OP solves some other design task (s)he didn't mention in the question.
If all you want is to keep 2 buttons inline on any device you can get away with...
<div class="row">
<div class="col-xs-12">
<button class="btn btn-primary">SIGN UP</button>
<button class="btn btn-primary">CHECK STANDINGS</button>
</div>
</div>
... and no additional css required.
fiddle.
Bootstrap has the classes xs for phones, and sm for tablets. You actually only need to add col-xs-6 to both your classes as this will affect all other widths unless otherwise stated. From the bootstrap docs:
Each tier of classes scales up, meaning if you plan on setting the same widths for xs and sm, you only need to specify xs.
add col-sm-6 col-xs-6 to the two btns. This indicates that when the screen is small size or xsmall size. They maintain 50% width.
You could look into this JsFiddle.
HTML
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1>Some content</h1>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3 col-md-3 col-lg-2">
<button class="btn btn-primary my-button">Sign Up</button>
</div>
<div class="col-xs-6 col-sm-3 col-md-3 col-lg-2">
<button class="btn btn-primary my-button">Check Standings</button>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h1>Some content</h1>
</div>
</div>
CSS
.my-button{
width:100%;
}
You can paly with the values of classes of these lines <div class="col-xs-6 col-sm-3 col-md-3 col-lg-2">. To understand this grid-system you can look at the official documentation. Happy Coding.