Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS media queries for telephone numbers

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #43690
    Pamela
    Member

    I don’t understand much about media queries. I am making my website’s phone number live for mobiles. I have done that. But how do I hide that live anchor in the desktop version with a media query?

    #129803
    Alen
    Participant

    Can you provide us with a working example so we can dig into the code and figure it out for you?

    #129833
    Anonymous
    Inactive

    At higher media queries, you could change the number to something like this:

    .phone-number {
    color: #000;
    cursor: default;
    pointer-events: none;
    }

    Obviously, make the color match whatever your default text is, but the number will still be a link, it just won’t look or act like one anymore. There are probably other ways, but this is similar to one I’ve used in the past.

    Good Luck!

    #130160
    Pamela
    Member

    Hi, thanks for you help , this is the code I have in my html:

    0400 468 539

    /* this is in default stylesheet, styles.css: */

    .tel {
    text-decoration:none;
    color: #074867;
    cursor:default;
    }

    this for the media query:

    /* =Media Queries


    */

    @media only screen and (max-device-width: 480px) {

    .tel{
    text-decoration: underline;
    color: #074867;
    cursor:auto;
    }

    }

    Is the syntax correct for the media query?

    #130167
    Pamela
    Member

    Hi, Thank you for your help. I think I’ve sorted it.

    The

    .phone-number {
    color: #000;
    cursor: default;
    pointer-events: none;
    }

    Seems to work well

    #130186
    Anonymous
    Inactive

    Awesome, glad to help!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.