在同一行中对齐href按钮和图像按钮

问题描述 投票:0回答:2

我在div内的html中定义了以下2个按钮,为:

<div class="button-div" align="center">

            <a id="cancel" style="background-color: #4b82c3;color: white;display:inline;text-decoration: none !important; font-size: 12px; padding: 10px 11px;margin: 8px 0;border: 1px;border-radius: 20px;" href="/">Cancel</a>

            <input type="image" id="btn" src="/static/images/submit-button.png" value="Submit" alt="Submit" width="90" height="40">

          </div>

以某种方式,使用a tag创建的按钮与定义为图像的按钮未对齐。如何将这些按钮对齐?

PS:如果两个按钮都定义为图像,我不会遇到问题。

html css href
2个回答
1
投票

尝试将display:flexflex-direction: row结合使用:


0
投票

使用css flex属性将您的元素对齐在一行中。

© www.soinside.com 2019 - 2024. All rights reserved.