AtanuCSE
AtanuCSE

Reputation: 8940

Select & button not taking full width and not sitting inline - JQM

I'm using jQuery mobile. I want a fixed header where I put a title, a menu button, a dropdown and a load button. Purpose of this structure is that a list will be loaded in the content area, I want the header and content in fixed position while scrolling through the list.

<div data-role="page" id="home" data-theme='b'>

        <!--************** This is the menu panel **************-->
        <div data-role="panel" id="mypanel" data-theme="b"> 
            <h1 style="background:#b1ea99;text-align:center;">Menu</h1>
            <ul data-role="listview" style="color:white;">
                <li><a data-role="button" id="" data-rel="close" style="color:white;"><i class="lIcon fa fa-stop"></i> Close menu</a></li> 

            </ul>



        </div><!-- /panel -->



        <div data-role="header" data-position="fixed"  data-theme='b' data-tap-toggle="false">
            <a href="#mypanel" id="menu" data-ajax="false"><i class='lIcon fa fa-tasks'></i></a>
            <h1>Bangla</h1>
            <a href="#mypanel" data-role='button' class='ui-btn-right ui-btn' data-ajax="false" style="width:100px;background:#4488d9;color:white;padding:8px;">Menu</a>
            <br/>
            <div class="ui-grid-a">
                    <div class="ui-block-a">

                    <select name="year" id="year" data-theme="a" style="width:100%">
                         <option value="">Select a year</option>
                         <option value="1990">1990</option>
                         <option value="1991">1991</option>
                         <option value="1992">1992</option>
                         <option value="1993">1993</option>
                         <option value="1994">1994</option>
                         <option value="1995">1995</option>
                         <option value="1996">1996</option>
                         <option value="1997">1997</option>
                         <option value="1998">1998</option>
                         <option value="1999">1999</option>
                         <option value="2000">2000</option>
                         <option value="2001">2001</option>
                         <option value="2002">2002</option>
                         <option value="2003">2003</option>
                         <option value="2004">2004</option>
                         <option value="2005">2005</option>
                         <option value="2006">2006</option>
                         <option value="2007">2007</option>
                         <option value="2008">2008</option>
                         <option value="2009">2009</option>
                         <option value="2010">2010</option>
                         <option value="2011">2011</option>
                         <option value="2012">2012</option>
                         <option value="2013">2013</option>

                    </select>

                </div>
                    <div class="ui-block-b">
                    <input type="button" value="Load" data-theme="a" style="width:100%">
                </div>
            </div>
        </div><!--Header-->


        <div data-role="content" style="padding-left:4px;padding-right:4px;">



        </div><!--content-->



    </div>

Problem is that the dropdown and load buttons are not sitting in same line. Load button is getting a bit down. Also I want them both to take 50% width of the screen. You can view the problem in JSFiddle

I tried width:100% (to take full grid width), display:inline, data-position:inline etc. none of them worked. What am I missing? Please view the JSFiddle and correct me. I want those 2 element in same line and with same width.

Upvotes: 0

Views: 438

Answers (2)

ezanker
ezanker

Reputation: 24738

You can use a navbar widget for this:

<div data-role="navbar" class="mynav">
    <ul>
        <li>
            <select name="year" id="year" data-theme="a">
                <option value="">Select a year</option>
                <option value="1990">1990</option>
                <option value="1991">1991</option>
            </select>
        </li>
        <li>
            <input type="button" value="Load" data-theme="a" />
        </li>
    </ul>
</div>

Then you just need a little CSS to get the margins right:

.mynav .ui-select, .mynav .ui-btn {
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 2px;
    margin-right: 2px !important;
}

Updated fiddle DEMO

Upvotes: 1

Tarun Kumar
Tarun Kumar

Reputation: 142

check for updated link:"http://jsfiddle.net/3zLdu68o/3/"

   <fieldset class="ui-grid-a">
                <div class="ui-block-a">
                  //..do stuff here

                </div>

                <div class="ui-block-b">
                   //do stuff here
                    </div>
      </fieldset>

Upvotes: 0

Related Questions