【发布时间】:2018-12-23 00:31:16
【问题描述】:
我有一个简单的输入和按钮。无论屏幕大小如何,该按钮在实际计算机上看起来都很好。第一个屏幕截图是从开发工具的移动视图中看到的。然而,当我真正用手机访问该网站时,我得到了第二张照片。如您所见,该按钮比桌面设置上的要短。关于如何解决这个问题的任何想法?
what it looks like on desktop and should look like on mobile
What it actually looks like on mobile
.input-field {
width: 370px;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
height: 35px;
outline: none;
border: none;
font-size: 16px;
@media (max-width: 500px) {
width: 250px;
}
}
.email-input {
display: flex;
height: 35px;
justify-content: center;
align-items: center;
margin-top: 60px;
}
.email-button {
height: 37px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
background-color: #50AE54;
color: white;
font-size: 16px;
width: 100px;
border: none;
outline: none;
@media (max-width: 600px) {
width: 75px;
}
<div class="email-input">
<input type="text" class="input-field" [(ngModel)]="email_address" placeholder="Email me for updates" />
<button class="email-button" (click)="subscribe()">Send</button>
</div>
【问题讨论】:
-
尝试将
box-sizing: border-box;添加到input和button,并将两者的高度都设置为100% -
它在 android chrome 上运行良好,但在 safari 或 ios chrome 上运行良好。
-
很高兴知道@Ammar
-
我尝试添加 box-sizing 但似乎没有什么不同@user184994
标签: javascript html css angular angular6