Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add button to right side of header

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>
like image 514
KawaGreen Avatar asked Apr 12 '12 09:04

KawaGreen


People also ask

How do you put a button on the right side?

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>.

How do I move the button to the right side in bootstrap?

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.

How do you put a button in the top right corner of bootstrap 5?

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.


2 Answers

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>
like image 86
Hardik Patel Avatar answered Sep 20 '22 02:09

Hardik Patel


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>
like image 34
Andy-G Avatar answered Sep 22 '22 02:09

Andy-G