提问者:小点点

如何在同一行的一个角写标题,在另一个角写按钮?


预期:我正在尝试得到与在下面的图像相同。一边是“海底总动员”,另一边是“观看视频”按钮

实际情况:但我得到的是如下图中的“海底总动员”标题和“观看视频”按钮并排

所以我使用的HTML代码是-

<div class="heading-container d-flex flex-row justify-content-start">
    <h1 class="main-heading"> Finding Nemo </h1>
    <button class="button"> Watch Now </button>
</div>

在CSS中-

.heading-container {
    margin-top: 20px;
}

.main-heading {
    color: #ffffff;
    font-family: "Roboto";
    font-size: 24px;
    font-weight: bold;
}

.button {
    background-color: #ffffff;
    color: #ff8348;
    border-width: 0px;
    border-radius: 10px;
    height: 32px;
    width: 110px;
    font-size: 13px;
}

请你建议我把它修好


共1个答案

匿名用户

我看到您正在使用bootstrap,您只需将align-right添加到按钮的类中即可:

<button class="button float-right"> Watch Now </button>

相关问题