1

我试图将一组图标放在屏幕中间,下面是代码:

 <div data-role="content" class="ui-content ui-body-a" style="vertical-align: middle" data-theme="a">

        <fieldset class="ui-grid-a icon-set" style="vertical-align: middle"  data-theme="b">

           <div class="ui-block-a center" style="vertical-align: middle">
               <a href="test">
                <div>
                <img src="css/images/test5.png" style="width: 80px;height: 80px"/>
                </div>
                <div>
                    Login
                </div>
                </a>

           </div>

           <div class="ui-block-b center">
                  <a href="#settings" data-transition='slide'>
                    <div>   <img src="css/images/test4.png" style="width: 80px;height: 80px"/></div>
                    <div>Settings</div>
                  </a>

           </div>

             <div class="ui-block-a center">

                  <a href="test">
                    <div>   <img src="css/images/test2.png" style="width: 80px;height: 80px"/></div>
                    <div>Aboutus</div>
                    </a>

              </div>

               <div class="ui-block-b center">

                  <a href="test">
                    <div>   <img src="css/images/test1.png" style="width: 80px;height: 80px"/></div>
                    <div>Contact Us</div>
                    </a>

           </div>

       </fieldset>
        </div>
4

2 回答 2

1

vertical-align does not work as most people would expect - this property is only available for tables or elements that have style of table-cell or similar (http://www.w3schools.com/cssref/pr_class_display.asp)

you will need to give the DIV element a default size for this to work as well... check this JSBin example and this StackOverflow answer for more insight

于 2012-08-30T09:51:17.063 回答
0

做这个:

<div data-role="content" class="ui-content ui-body-a" style="text-align: center;" data-theme="a">

然后对于您想要居中的任何 div :

style="margin:0 auto;"
于 2012-08-30T10:00:29.413 回答