Sign Up

Browse


Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

WP Ask

WP Ask Logo WP Ask Logo

WP Ask Navigation

  • Home
  • Recent Questions
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
    • Recent Questions
  • Communities
  • Polls
  • Home
  • Recent Questions
  • Contact Us
Home/ Questions/Q 325
Next
Answered

WP Ask Latest Questions

margoo
  • 5
  • 5
margoo
Asked: August 25, 20202020-08-25T05:44:15+08:00 2020-08-25T05:44:15+08:00In: General

How can I make CSS to take effect on mobile phones?

  • 5
  • 5

Newbie here. I am curious how to target with CSS code a specific mobile phone with maximum screen width of like maybe 768px – meaning I want the CSS code to take effect only if the screen is 768 or below. I hope that make sense. Thank you in advance.

cssmobile
  • 3 3 Answers
  • 74 Views
  • 0 Followers
  • 0
  • Share
    Share
    • Share on Facebook
    • Share on Twitter

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

3 Answers

  • Voted
  • Oldest
  • Recent
  1. [Deleted User]
    [Deleted User]
    2020-08-25T10:47:27+08:00Added an answer on August 25, 2020 at 10:47 am

    You can make use of @media rule of CSS like below.

    /* Set the background color of body to tan */
    body {
    background-color: tan;
    }

    /* On screens that are 992px or less, set the background color to blue */
    @media screen and (max-width: 992px) {
    body {
    background-color: blue;
    }
    }

    /* On screens that are 600px or less, set the background color to olive */
    @media screen and (max-width: 600px) {
    body {
    background-color: olive;
    }
    }

      • 2
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
  2. aldinlapinig
    Best Answer
    aldinlapinig
    2020-08-26T07:51:00+08:00Added an answer on August 26, 2020 at 7:51 am

    For your case, you can use the following code directly.

    @media only screen and (max-width: 768px) {
       css code here…
    }

    Good luck!

      • 1
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
    • margoo
      margoo
      2020-10-09T20:00:20+08:00Replied to answer on October 9, 2020 at 8:00 pm

      Awesome you guys. I was able to make it work. Thanks for your help. Much appreciated.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

Sidebar

Most Popular Theme

aalan

Blazing Fast Cloud Hosting

aalan

Explore

  • Home
  • Questions
    • Recent Questions
  • Communities
  • Polls

© 2024 WP Ask. All Rights Reserved.
Powered by Ako.ph.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.