i'm useing jquery mobile to do a demo... i want to let the width of localnav be 100%... but i don't know how to do that... code here...
<ul data-role="controlgroup" data-type="horizontal" class="localnav">
<li><a href="#" data-role="button" data-transition="fade" class="ui-btn-active">111</a></li>
<li><a href="#" data-role="button" data-transition="fade">222</a></li>
<li><a href="#" data-role="button" data-transition="fade">333</a></li>
</ul>
help me pls...thank you...
Here's what I did. Worked well.
CSS:
<style>
.ui-grid-a, .ui-grid-a .ui-controlgroup-controls {width: 100%}
#homePageButton {width:49%;float:left;margin-left:1%}
#logOutButton {width:49%}
#footer {height:45px}
</style>
HTML:
<div data-role="footer" data-position="fixed" id="footer">
<div data-role="controlgroup" data-type="horizontal" class="ui-grid-a">
<a href="#" data-role="button" data-icon="home" id="homePageButton">Home Page</a>
<a href="#" data-role="button" data-icon="forward" data-iconpos="right" id="logOutButton">Log Out</a>
</div>
</div>
Result:
Take a look at JQuery Mobile's navbar Though it's normally used in a header/footer, it can be used elsewhere. It will produce a full-width bar containing your buttons.
<div data-role="navbar">
<ul>
<li><a href="#" data-icon="plus" data-role="button">Button1</a></li>
<li><a href="#" data-icon="minus" data-role="button">Button2</a></li>
<li><a href="#" data-icon="check" data-role="button">Button3</a></li>
</ul>
</div>
Not sure why you are trying to wrap a <ul>
as a controlgroup. But you can have a full-width ControlGroup with the following approach:
<div data-role="controlgroup" data-type="horizontal" class="localnav">
<a href="#" data-role="button" data-transition="fade" class="ui-btn-active">111</a>
<a href="#" data-role="button" data-transition="fade">222</a>
<a href="#" data-role="button" data-transition="fade">333</a>
</div>
And in CSS, split the width equally among the number of <a>
elements:
a{width:33%;}
Sample jsfiddle: http://jsfiddle.net/pAuqm/1/
If you want to continue with <ul>
based structure; you could have full width controlgroup with following CSS:
li{
display: inline;
}
a{width:33%;}
Sample jsfiddle: http://jsfiddle.net/pAuqm/3/
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