Inline LI with Spans - html

I have a button called Delete next to a link inside a DIV per list item. To confirm I have another button that should appear next to called Confirm Delete. When that is clicked it is posted back to server. The Delete appears correctly but the confirm drops down to the next line instead of appearing on the same line.
Source:
<ul>
<li>
<div style="font-size: x-large;">
<a href="/item/detail/123>Rearden Steel</a>
</div>
<button type="button" name="delete" value="Delete" onclick="ShowDeleteButton('Delete123', this);" class="btn btn-default btn-primary disableOnClickSubmit">Delete</button>
<span id="Delete123" style="display: none;">
<form action="/item/ItemDelete" method="post">
<input id="id" name="id" type="hidden" value="123" />
<button type="submit" name="deleteConfirm" value="DeleteConfirm" class="btn btn-default disableOnClickSubmit">Confirm Delete</button>
</form>
</span>
</li>
<li> ... </li>
<ul>
What style do I need to apply to have the confirm Delete button appear on the same line as the link and Delete button?
I'm using Bootstrap 3.
Bootply Example: http://www.bootply.com/VsU984gbLs

You just need to do either of these to make <li> come in the same line.
display: inline-block: You should ensure you have no space character between <li>s.
float: left: You should ensure to clear the floats.
Remember the caveats above. Since you are using Bootstrap, you may use the utility class: pull-left or pull-right. The best thing is to make sure the pattern you want is already present in the framework and use the mark-up instead of creating your own styles.

Related

Set fixed position for buttons

I have this html code which I use with Bootstrap:
<div class="text-center offset-top-20">
<input id="update" class="btn btn-primary" type="submit" value="Update" />  
<input id="cancel" class="btn btn-primary" type="submit" value="Cancel" />
</div>
Demo: https://jsfiddle.net/02jmwd85/1/
When I resize the web page and reduce the width the buttons are moved and the second goes below the first. Is there some way to to keep their position and keep them horizontally?
The responsive design feature of Bootstrap allows the UI elements to automatically stack up one below the other on narrow screens.
This is a desirable feature in many scenarios.
This functionality can be overridden by custom style specified at the component level.
In the current scenario, the custom style can be applied to the <div> that encloses the two buttons - Update and Cancel to prevent those from stacking up.
This can be done by specifying a minimum width for the enclosing div.
Here is an example:
<div class="text-center offset-top-20" style="min-width: 500px">
<input id="update" class="btn btn-primary" type="submit" value="Update" />  
<input id="cancel" class="btn btn-primary" type="submit" value="Cancel" />
</div>
How does the above solution prevent the buttons from stacking up?
The custom style attribute - style="min-width: 500px;" makes sure that the enclosing div cannot become narrower than 500 pixels.
The 500 pixels of width will give enough room for both the buttons to stay side by side.
This will in turn prevent the buttons from stacking up.

HTML Button Won't Right Align

I have the following HTML. I want the "Get Geotag" button to be right aligned and the text to be anywhere before/to the left of the button. However, currently I cannot figure out a way to get the buttons aligned properly and to continue functioning (the text for the input is based off of getLoc()). Any help would be appreciated!
<button class="button button-positive button-clear pull-right" ng-click="getLoc()" readonly>
Get Geotag
</button>
<input type="text" value="{{geoString}}">
There is no related CSS.
I tried this:
Get Geotag
which aligns correctly but then the location functionality goes away. I also tried to use things like float: right and right-align to no avail.
<div class="center">
<button class="button button-positive button-clear pull-right" ng-click="getLoc()" readonly>
Get Geotag
</button>
<input type="text" value="{{geoString}}"></div>
Two Options:
1.
.center{display:inline-block;}
2.
.center{display:flex;
flex-direction:row;
justify-content:space-around; /* you could also use justify-content:space-between; *\
}
My code had a typing mistake. Fixed it
It is difficult to say without your css. But I'm trying to help you.
CSS:
.my_css{display:inline-block}
HTML:
<button class="button button-positive button-clear pull-right my_css" ng-click="getLoc()" readonly>
Get Geotag
</button>
<input type="text" value="{{geoString}}">

How to make an <i> tag an HREF on Bootstrap3?

I'm working with Bootstrap version 3.3.4 and I'm trying to make a search form, however, in order to make my search glyphicon get inside my search bar I need to use an tag , here is the code I'm currently using:
<form id="searchform" method="get" action="/search/" class="navbar-form navbar-right">
<div>
<div class="right-inner-addon>
</i>
<input id="query" name="query" type="search" class="form-control searchbox" placeholder="Search" />
</div>
</div>
</form>
As for Css I only use this costum apart, aside from all the bootstrap:
.searchbox {
border-radius: 20px;
height: 25px;
margin-top: 5px;
}
Even though when clicking enter the search bar works, for some reason the glyphicon-search won't work as button so users also have the option on clicking on it to complete their search.
Any ideas ? :S
You're missing a closing " after <div class="right-inner-addon>, which is causing the rest of your code to render improperly. Fix your code like this:
<form id="searchform" method="get" action="/search/" class="navbar-form navbar-right">
<div>
<div class="right-inner-addon">
</i>
<input id="query" name="query" type="search" class="form-control searchbox" placeholder="Search" />
</div>
</div>
</form>
And it works fine.
Check this Bootply.
Always try to use an IDE (Netbeans, Visual Studio, etc) with syntax highlighting; this issue would have been caught instantly.
Edit
Since using the icon in the search-bar negates the ability to click on it, I would suggest using a segmented button (as I can't figure out a way to capture the click event on the icon and not the input). Here would be the code:
<form id="searchform" method="get" action="/search/" class="navbar-form navbar-right">
<div>
<div class="input-group">
<input class="form-control" placeholder="Search" type="text">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
</div>
</form>
And another Bootply.
My standard guess is based off of an assumption since I don't have a working version of your code.
Anchor tags typically do not have a specific height or width set to them on their own. It's very possible that your anchor tag does not have width or height while your icon does.
Open your browser's dev tools by right clicking the icon and selecting inspect element. You should be able to trouble shoot it from there.
My guess. If that's not working would be z-indexing. I don't have firebug on my phone, but anyways if you hover over it does it only highlight the search bar? Or can you highlight the icon? If you can't...in your CSS change the Z-index of the form to let's say
#YourFormID{
Z-index: 1;
}
Then for the icon do
#yourIconID{
Z-index: 100;
}
This will bring the icon on top of the form much like layers in a photoshop document. If that doesn't work still, I'll try again tonight from my PC. But if what everyone else says doesn't work...this may be your issue.

Bootstrap button group pre-select button with html only

Using Bootstrap I want a button group but with one button preselected. If I use the html below then the first button gets preselected, but it remains active even when I click on one of the other buttons.
Using only html how can I define the button group with one button selected where that button will deselect when I click on one of the other buttons.
<div class="btn-group">
<button type="button" class="btn btn-default active">Left</button>
<button type="button" class="btn btn-default">Middle</button>
<button type="button" class="btn btn-default">Right</button>
</div>
It's not completely possible to do this with HTML only - (as your title implies).
Really, the only thing you could do without JavaScript is add the attribute autofocus="autofocus" to the desired element like this:
<button type="button" class="btn btn-default" autofocus="autofocus">Left</button>
As the attribute implies, the button will automatically be focused in supported browsers. If another button is clicked, the focus of the first button will be removed.
EXAMPLE HERE
It's worth noting that the styling of .btn-default.active is the same as .btn-default:focus:
.btn-default:focus, .btn-default.active {
color: #333;
background-color: #ebebeb;
border-color: #adadad;
}
Unfortunately, the focus will also be removed when clicking anywhere else on the page too. If this is a problem, JavaScript would be needed to solve this. The solution would be to have the active class on the desired element and then remove it when clicking on any of the sibling button elements. The selection would be mutually exclusive like with radio elements.
Here is an example taken directly from the Bootstrap JS documentation. It's worth noting that the Bootstrap JS file/jQuery need to be included.
EXAMPLE HERE
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="options" id="option1"> Option 1
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2"> Option 2
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option3"> Option 3
</label>
</div>

Bootstrap 3 - Trouble Vertically Aligning Input Group Button and Form

Sort of a weird problem. I'm following this section exactly but having a little trouble. When the button is aligned to the left of the field they align perfectly but when the button is aligned to the right (which I think of as more natural for a "submit" type behavior) there is about 5-10px of padding on top of the button that I can't get rid of:
My code is below:
<div class="col-sm-7">
<h3>Get the latest Amazon News first:</h3>
<div class="input-group">
<input type="text" class="form-control" placeholder="E-mail" />
<span class="input-group-btn">
<button class="btn btn-default btn-group" type="submit">Sign Up</button>
</span>
</div><!-- /input-group -->
</div><!-- /col-7 -->
<div class="col-sm-5">
<h3>Get Started Now:</h3>
<a class="btn btn-large btn-primary" href="#"><i class="icon-caret-right icon-space-right"></i>Start a Free Trial!</a>
</div>
I'm pretty confused why it would work on one side and not the other. Any help would be appreciated!
Something seems to be wrong if you have written any of your custom css. I just copied your html and created a pen using bootstrap cdn css hosted files. Check this pen/demo.
It's because somehow you are adding break tag i.e. above and below of your button element. just remove those breaks.