Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

Hide a Drupal block on mobile devices

I'm making a new Drupal site which is based on a non-bootstrap theme and makes heavy use of blocks to place content. Some blocks display content that is better to hide on smaller screens to have a nicer look and feel. I want to hide them, but I don't know how to do it. I'm using Drupal 9. I understand that there are some modules that can help in this situation, but those I know don't work with D9.

question from:https://stackoverflow.com/questions/65602362/hide-a-drupal-block-on-mobile-devices

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Why use modules when CSS will do, something like

@media only screen and (max-width: 600px) {
  .blockname {
    display: none;
 }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...