WordPress.org

Ready to get started?Download WordPress

Forums

Sunspot
[resolved] Is it possible to hide some objects while in mobile view? (3 posts)

  1. Eos Rose
    Member
    Posted 1 year ago #

    I've created a child theme with a page template that has a six-column table. Obviously this table is too big to look good in mobile view. Is there a way to modify my php so that some specific columns are hidden when mobile view is activated? I'm very new to the concept of mobile view; I'm still trying to grasp what's possible and what's not.

  2. Aditya Pandey
    Member
    Posted 1 year ago #

    You don't need to edit PHP.
    You can do it using media query in CSS.

    For example, you want to hide 3 elements with class, .element1, .element2, .element3.
    Then you can hide these elements in mobile by following code.

    @media (max-width: 480px){
    .element1, .element2, .element3 {
            display: none;
    }

    That'll hide these 3 elements from device with width less or equal to 480px but you can choose whatever you want.

  3. Eos Rose
    Member
    Posted 1 year ago #

    Thank you! I'm sure this will be very helpful for keeping my site accessible for mobile devices. I should have known the fix would be an easy one.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic