I would like to add an icon button to the right side of my header in jQuery mobile. I'm having trouble with the automatic left positioning.
Here's my header:
<div data-role="header" data-position="inline">
<h1>Resultaten</h1>
<a href="#Home" data-role="button" data-icon="home" data-iconshadow="false"
data-direction="reverse" onclick="empty()" data-transition="slide"
data-iconpos="notext">home</a>
</div>
If you want to move the button to the right, you can also place the button within a <div> element and add the text-align property with its "right" value to the "align-right" class of the <div>.
Bootstrap allows us to align elements by using the utility class float. As we want to align the button to the right side of the text box, we have to use the float-right class.
To place a button in the top right, there are several ways to do this. The easiest way to do this, Set “pull-right” in button class. Output: The button group is used for more than one button like in this example.
Use class="ui-btn-right"
or add a class ui-btn-right
in <a>
<div data-role="header" data-position="inline">
<h1>Resultaten</h1>
<a href="#Home" data-role="button" data-icon="home" data-iconshadow="false"
data-direction="reverse" onclick="empty()" data-transition="slide"
data-iconpos="notext" class="ui-btn-right">home</a>
</div>
If you have multiple buttons that you want to align to the right using the class="ui-btn-right"
in <a>
will place all the buttons on top of each other. Instead you can just wrap a div around it and float to the right.
<div data-role="header" data-position="inline">
<h1>Resultaten</h1>
<div style="float:right;">
<a href="#Home" data-role="button" data-icon="home" data-iconshadow="false"
data-direction="reverse" onclick="empty()" data-transition="slide"
data-iconpos="notext" class="ui-btn-right">btn 1</a>
<a href="#Home" data-role="button" data-icon="home" data-iconshadow="false"
data-direction="reverse" onclick="empty()" data-transition="slide"
data-iconpos="notext" class="ui-btn-right">btn 2</a>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With