5

私は次のhtmlを持っています、

http://jsfiddle.net/2bWfL/168/

<head> 
    <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
</head> 
<body> 

<div data-role="page">

    <div data-role="header">
        <h1>My Title</h1>
    </div><!-- /header -->

    <div data-role="content">    
        <ul data-role="listview">
                    <li>

        <a href="#">
            <img width="80" height"80" src="http://www.gravatar.com/avatar/7efa2e4098f60c15d230436ca99d7250?s=32&d=identicon&r=PG" />
            <h3>New Latest One</h3>
            <p>$12,000</p>
        <input type="text" style="width:75px"/>
            </a>
            </li>
        </ul>

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

</div><!-- /page -->
<style>
        .ui-input-text{
            width: 75px;
        }
    </style>
</body>

しかし、画像は垂直方向の中央にありません。それを中心にする方法は?

4

2 に答える 2

17

画像を縦に揃えたいと思います。その場合は、このcssを画像に適用する必要があります。

img {
    position:absolute;
    top:0;
    bottom:0;
    margin:auto;
}

デモ: http: //jsfiddle.net/yWkGR/

于 2013-03-25T09:50:44.513 に答える
4

解決

実例は次のとおりです:http://jsfiddle.net/Gajotres/XawBx/

使用されたcss:

#test {
    position:absolute; 
    top:0; 
    bottom:0; 
    left:0; 
    margin:auto; 
    height:80px; 
    width:80px;       
}

最終メモ

jQuery Mobileのページとウィジェットをカスタマイズする方法について詳しく知りたい場合は、この記事をご覧ください。jQuery Mobileに!importantが必要な理由など、多くの実用的な例が付属しています。

于 2013-03-25T09:50:48.243 に答える