Как выровнять текст с помощью ons-select? - PullRequest
0 голосов
/ 12 марта 2020

У меня есть этот HTML фрагмент:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsenui.css">
    <link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsen-css-components.min.css">
    <script src="https://unpkg.com/onsenui/js/onsenui.min.js"></script>
    <script src="https://unpkg.com/jquery/dist/jquery.min.js"></script>
</head>
<body>
    <p>
        Label for select:&nbsp;
        <ons-select id="any_id" modifier="material">
            <option value="0">Value 0</option>
            <option value="1">Value 1</option>
            <option value="2">Value 2</option>
        </ons-select>
    </p>
</body>
</html>

, который производит это:

Text is not properly aligned with ons-select. How to fix this?

Как видите, текст неправильно выровнен с ons-select. Как сделать так, чтобы они отображались в одной строке?

1 Ответ

1 голос
/ 12 марта 2020

используйте flexbox для такого типа вещей. Очень прост в реализации.

div{
display:flex;
align-items:center;
}
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsenui.css">
    <link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsen-css-components.min.css">
    <script src="https://unpkg.com/onsenui/js/onsenui.min.js"></script>
    <script src="https://unpkg.com/jquery/dist/jquery.min.js"></script>
</head>
<body>
   <div>
      Label for select:&nbsp;   
     
        <ons-select id="any_id" modifier="material">
            <option value="0">Value 0</option>
            <option value="1">Value 1</option>
            <option value="2">Value 2</option>
        </ons-select>
    </div>
</body>
</html>
...