简体   繁体   中英

Is it possible to put the button on the right center in a ´position: sticky´ and that in the mobile version it would disappear?

Is it possible to put the button on the right center in a ´position: sticky´ and that in the mobile version it would disappear? Right now its appear on all versions, I need only on Web and tablet

<div style="top: 75%; position: sticky; z-index: 1;">
<div style="position: absolute; right: -1.5%;">
<a href="..." class="btn-secondary h-red"
style="padding: 10px 34px 10px 20px;
font-size: 13px; font-weight:
700; border-radius: 20px;">Support</a>
</div>
</div>

First add an id or class or any other identifier to your element of choice in HTML:

<div style="top: 75%; position: sticky; z-index: 1;" id="yourStickyButton">

In CSS: If the browser window is 480px or smaller, the button will disappear:

@media only screen and (max-width: 480px) {
  #yourStickyButton{
    display:none;
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM