如何使自定义css按钮响应? [英] How to make custom css button responsive?

查看:119
本文介绍了如何使自定义css按钮响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个CSS按钮,但它不响应。我已尝试添加 EM或%,但仍然不工作。我想根据屏幕分辨率更改<​​em> width 和 height

I have created a CSS button but it is not responsive. I have tried adding EM or % but still not working. I want to change width and height according to the screen resolution.

使用:

@media only screen and (min-width:321px) and (max-width:480px) { }

HTML

<div>
   <p>
      <button class="btn btn-1 btn-1a">Click Here To Enter The Future</button> 
   </p>
</div>

CSS

.btn {
  font-size:0.875em;
  display:block;
  left:-60px;
  margin-top:35px;
}

现在按钮从左向右移动,

Right now the button is moving from left to right, but I want the button to appear at the exact same place.

推荐答案

您可以添加 width:100%; 达成您的目标。

You could add width:100%; to achieve your objective.

.btn {
      font-size:0.875em;
      display:block;
      left:-60px;
      margin-top:35px;
      width:100%;
    }

这篇关于如何使自定义css按钮响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆